Class: Buffer::Api::Schedule

Inherits:
Object
  • Object
show all
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

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(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/profiles/#{@id}/schedules", body, options

  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, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:schedules] = schedules

  response = @client.post "/profiles/#{@id}/schedules/update", body, options

  return response
end