Module: Buffer::Client::Profile

Included in:
Buffer::Client
Defined in:
lib/buffer/profile.rb

Instance Method Summary collapse

Instance Method Details

#profile_by_id(id) ⇒ Object


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

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

#profilesObject


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

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

#schedules_by_profile_id(id) ⇒ Object


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

def schedules_by_profile_id(id)
  response = get("/profiles/#{id}/schedules.json")
  response.map { |a_response| Buffer::Schedule.new(a_response) }
end

#set_schedules(id, options) ⇒ Object


19
20
21
22
23
24
# File 'lib/buffer/profile.rb', line 19

def set_schedules(id, options)
  schedules = Buffer::Encode.encode(
                  options.fetch(:schedules) { raise ArgumentError })
  post("/profiles/#{id}/schedules/update.json",
                  body: { schedules: schedules })
end