Module: Buff::Client::Profile
- Included in:
- Buff::Client
- Defined in:
- lib/buff/profile.rb
Instance Method Summary collapse
- #profile_by_id(id) ⇒ Object
- #profiles ⇒ Object
- #schedules_by_profile_id(id) ⇒ Object
- #set_schedules(id, options) ⇒ Object
Instance Method Details
#profile_by_id(id) ⇒ Object
9 10 11 12 |
# File 'lib/buff/profile.rb', line 9 def profile_by_id(id) response = get("/profiles/#{id}.json") Buff::Profile.new(response) end |
#profiles ⇒ Object
4 5 6 7 |
# File 'lib/buff/profile.rb', line 4 def profiles response = get("/profiles.json") response.map { |profile| Buff::Profile.new(profile) } end |
#schedules_by_profile_id(id) ⇒ Object
14 15 16 17 |
# File 'lib/buff/profile.rb', line 14 def schedules_by_profile_id(id) response = get("/profiles/#{id}/schedules.json") response.map { |a_response| Buff::Schedule.new(a_response) } end |
#set_schedules(id, options) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/buff/profile.rb', line 19 def set_schedules(id, ) schedules = Buff::Encode.encode( .fetch(:schedules) { raise ArgumentError }) post("/profiles/#{id}/schedules/update.json", body: { schedules: schedules }) end |