Class: Buffer::Api::Schedule
- Inherits:
-
Object
- Object
- Buffer::Api::Schedule
- Defined in:
- lib/buffer/api/schedule.rb
Overview
Returns scheduling api instance for social media profile.
id - Identifier of a social media profile
Instance Method Summary collapse
-
#initialize(id, client) ⇒ Schedule
constructor
A new instance of Schedule.
-
#list(options = {}) ⇒ Object
Returns details of the posting schedules associated with a social media profile.
-
#update(schedules, options = {}) ⇒ Object
Set the posting schedules for the specified social media profile.
Constructor Details
#initialize(id, client) ⇒ Schedule
Returns a new instance of Schedule.
10 11 12 13 |
# File 'lib/buffer/api/schedule.rb', line 10 def initialize(id, client) @id = id @client = client end |
Instance Method Details
#list(options = {}) ⇒ Object
Returns details of the posting schedules associated with a social media profile. ‘/profiles/:id/schedules’ GET
18 19 20 21 22 23 24 |
# File 'lib/buffer/api/schedule.rb', line 18 def list( = {}) body = .has_key?(:query) ? [:query] : {} response = @client.get "/profiles/#{@id}/schedules", body, return response end |
#update(schedules, options = {}) ⇒ Object
Set the posting schedules for the specified social media profile. ‘/profiles/:id/schedules/update’ POST
schedules - Each item in the array is an individual posting schedule which consists of days and times to match the format return by the above method.
30 31 32 33 34 35 36 37 |
# File 'lib/buffer/api/schedule.rb', line 30 def update(schedules, = {}) body = .has_key?(:body) ? [:body] : {} body[:schedules] = schedules response = @client.post "/profiles/#{@id}/schedules/update", body, return response end |