jam-cloud/web/app/views/api_teachers/detail.rabl

120 lines
2.8 KiB
Plaintext
Raw Normal View History

object @teacher
attributes :id,
:biography,
:created_at,
:id,
:introductory_video,
:lesson_duration_120,
:lesson_duration_30,
:lesson_duration_45,
:lesson_duration_60,
:lesson_duration_90,
:price_per_lesson_120_cents,
:price_per_lesson_30_cents,
:price_per_lesson_45_cents,
:price_per_lesson_60_cents,
:price_per_lesson_90_cents,
:price_per_month_120_cents,
:price_per_month_30_cents,
:price_per_month_45_cents,
:price_per_month_60_cents,
:price_per_month_90_cents,
:prices_per_lesson,
:prices_per_month,
:teaches_advanced,
:teaches_age_lower,
:teaches_age_upper,
:teaches_beginner,
:teaches_intermediate,
:updated_at,
:user_id,
:website,
:years_playing,
:years_teaching,
:teaches_test_drive,
:test_drives_per_week,
:errors,
2016-05-16 16:39:20 +00:00
:profile_pct,
2017-07-10 02:21:29 +00:00
:school_id,
:background_check_at
2016-01-14 18:45:55 +00:00
child :review_summary => :review_summary do
attributes :avg_rating, :wilson_score, :review_count
2016-09-08 10:59:58 +00:00
end
2016-01-14 18:45:55 +00:00
2016-09-08 10:59:58 +00:00
child :school => :school do
attributes :id, :education
2016-01-13 13:15:58 +00:00
end
child :recent_reviews => :recent_reviews do
2016-01-15 20:51:22 +00:00
attributes :id, :description, :rating, :created_at
2016-01-13 13:15:58 +00:00
child(:user => :user) {
attributes :id, :first_name, :last_name, :name, :photo_url
}
end
node :profile_pct_summary do |teacher|
teacher.profile_pct_summary
end
2016-01-13 13:15:58 +00:00
2016-01-13 02:37:00 +00:00
node :instruments do |teacher|
teacher.instruments.collect{|o|o.id}
end
2016-01-13 02:37:00 +00:00
node :subjects do |teacher|
teacher.subjects.collect{|o|o.id}
end
2016-01-13 02:37:00 +00:00
node :genres do |teacher|
teacher.genres.collect{|o|o.id}
end
2016-01-13 02:37:00 +00:00
node :languages do |teacher|
teacher.languages.collect{|o|o.id}
end
2016-01-13 02:37:00 +00:00
node :experiences_teaching do |teacher|
teacher.experiences_teaching.collect do |o|
{
name: o.name,
experience_type: o.experience_type,
organization: o.organization,
start_year: o.start_year,
end_year: o.end_year
}
end # collect
end
2016-01-13 02:37:00 +00:00
node :experiences_education do |teacher|
teacher.experiences_education.collect do |o|
{
name: o.name,
experience_type: o.experience_type,
organization: o.organization,
start_year: o.start_year,
end_year: o.end_year
}
end # collect
end
2016-01-13 02:37:00 +00:00
node :experiences_award do |teacher|
teacher.experiences_award.collect do |o|
{
name: o.name,
experience_type: o.experience_type,
organization: o.organization,
start_year: o.start_year,
end_year: o.end_year
}
end # collect
end
2016-05-16 16:39:20 +00:00
if current_user
node :has_rated_teacher do |teacher|
current_user.has_rated_teacher(teacher)
end
end