Class: Buffer::Api::User

Inherits:
Object
  • Object
show all
Defined in:
lib/buffer/api/user.rb

Overview

Returns authenticated user api instance.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ User

Returns a new instance of User.



9
10
11
# File 'lib/buffer/api/user.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#create_update(text, profile_ids, options = {}) ⇒ Object

Create one or more new status updates. ‘/updates/create’ POST

text - The status update text. profile_ids - An array of profile id’s that the status update should be sent to. Invalid profile_id’s will be silently ignored.



40
41
42
43
44
45
46
47
48
# File 'lib/buffer/api/user.rb', line 40

def create_update(text, profile_ids, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:text] = text
  body[:profile_ids] = profile_ids

  response = @client.post "/updates/create", body, options

  return response
end

#profiles(options = {}) ⇒ Object

Returns an array of social media profiles connected to the authenticated users account. ‘/profiles’ GET



27
28
29
30
31
32
33
# File 'lib/buffer/api/user.rb', line 27

def profiles(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/profiles", body, options

  return response
end

#show(options = {}) ⇒ Object

Returns information about the authenticated user. ‘/user’ GET



16
17
18
19
20
21
22
# File 'lib/buffer/api/user.rb', line 16

def show(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/user", body, options

  return response
end