Class: Buffer::Api::Update

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

Overview

Returns a social media update api instance.

id - Identifier of a social media update

Instance Method Summary collapse

Constructor Details

#initialize(id, client) ⇒ Update

Returns a new instance of Update.



10
11
12
13
# File 'lib/buffer/api/update.rb', line 10

def initialize(id, client)
  @id = id
  @client = client
end

Instance Method Details

#destroy(options = {}) ⇒ Object

Permanently delete an existing status update. ‘/updates/:id/destroy’ POST



64
65
66
67
68
69
70
# File 'lib/buffer/api/update.rb', line 64

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

  response = @client.post "/updates/#{@id}/destroy", body, options

  return response
end

#interactions(options = {}) ⇒ Object

Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes. ‘/updates/:id/interactions’ GET



29
30
31
32
33
34
35
# File 'lib/buffer/api/update.rb', line 29

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

  response = @client.get "/updates/#{@id}/interactions", body, options

  return response
end

#share(options = {}) ⇒ Object

Immediately shares a single pending update and recalculates times for updates remaining in the queue. ‘/updates/:id/share’ POST



53
54
55
56
57
58
59
# File 'lib/buffer/api/update.rb', line 53

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

  response = @client.post "/updates/#{@id}/share", body, options

  return response
end

#show(options = {}) ⇒ Object

Returns a single social media update. ‘/updates/:id’ GET



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

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

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

  return response
end

#top(options = {}) ⇒ Object

Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time. ‘/updates/:id/move_to_top’ POST



75
76
77
78
79
80
81
# File 'lib/buffer/api/update.rb', line 75

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

  response = @client.post "/updates/#{@id}/move_to_top", body, options

  return response
end

#update(text, options = {}) ⇒ Object

Edit an existing, individual status update. ‘/updates/:id/update’ POST

text - The status update text.



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

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

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

  return response
end