Module: Buff::Client::Profile

Included in:
Buff::Client
Defined in:
lib/buff/profile.rb

Instance Method Summary collapse

Instance Method Details

#profile_by_id(id, options = {}) ⇒ Object



9
10
11
12
# File 'lib/buff/profile.rb', line 9

def profile_by_id(id, options={})
  response = get("/profiles/#{id}.json")
  Buff::Profile.new(response)
end

#profile_schedules_by_id(id, options = {}) ⇒ Object



14
15
16
17
# File 'lib/buff/profile.rb', line 14

def profile_schedules_by_id(id, options={})
  response = get("/profiles/#{id}/schedules.json")
  response.map { |r| Buff::Schedule.new(r) }
end

#profiles(options = {}) ⇒ Object



4
5
6
7
# File 'lib/buff/profile.rb', line 4

def profiles(options={})
  response = get("/profiles.json", options)
  response.map { |profile| Buff::Profile.new(profile) }
end

#set_schedules(id, options = {}) ⇒ Object

TODO massive bug currently deletes schedule due to malformed request



21
22
23
24
25
# File 'lib/buff/profile.rb', line 21

def set_schedules(id, options={})
  # schedules = options.fetch(:schedules) { raise ArgumentError }
  response = post("/profiles/#{id}/schedules/update.json", options )
    Buff::Response.new(JSON.parse(response.body))
end