Class: Sensit::Api::Feed
- Inherits:
-
Object
- Object
- Sensit::Api::Feed
- Defined in:
- lib/sensit/api/feed.rb
Overview
Returns api instance to get auxilary information about Buffer useful when creating your app.
topic_id - The key for the parent topic id - The id of the feed
Instance Method Summary collapse
-
#create(feed, options = {}) ⇒ Object
Create a feed on a given topic.
-
#delete(options = {}) ⇒ Object
Deletes the desired feed.
-
#find(options = {}) ⇒ Object
Returns a specific feed for a topic.
-
#initialize(topic_id, id, client) ⇒ Feed
constructor
A new instance of Feed.
-
#list(options = {}) ⇒ Object
Returns a list of feeds for a given topic.
-
#update(feed, options = {}) ⇒ Object
Update an associated Feed to the Topic.
Constructor Details
#initialize(topic_id, id, client) ⇒ Feed
Returns a new instance of Feed.
11 12 13 14 15 |
# File 'lib/sensit/api/feed.rb', line 11 def initialize(topic_id, id, client) @topic_id = topic_id @id = id @client = client end |
Instance Method Details
#create(feed, options = {}) ⇒ Object
Create a feed on a given topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds’ POST
feed - A Hash containing ‘at`: a formatted time of the event. Defaults to the current time if not present.`tz`: The time zone of the time given in `at`. Defaults to UTC`data`:A hash of data to be stored
43 44 45 46 47 48 49 50 |
# File 'lib/sensit/api/feed.rb', line 43 def create(feed, = {}) body = .has_key?(:body) ? [:body] : {} body[:feed] = feed response = @client.post "/topics/#{@topic_id}/feeds", body, return response end |
#delete(options = {}) ⇒ Object
Deletes the desired feed. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:id’ DELETE
68 69 70 71 72 73 74 |
# File 'lib/sensit/api/feed.rb', line 68 def delete( = {}) body = .has_key?(:body) ? [:body] : {} response = @client.delete "/topics/#{@topic_id}/feeds/#{@id}", body, return response end |
#find(options = {}) ⇒ Object
Returns a specific feed for a topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:id’ GET
31 32 33 34 35 36 37 |
# File 'lib/sensit/api/feed.rb', line 31 def find( = {}) body = .has_key?(:query) ? [:query] : {} response = @client.get "/topics/#{@topic_id}/feeds/#{@id}", body, return response end |
#list(options = {}) ⇒ Object
Returns a list of feeds for a given topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds’ GET
20 21 22 23 24 25 26 |
# File 'lib/sensit/api/feed.rb', line 20 def list( = {}) body = .has_key?(:query) ? [:query] : {} response = @client.get "/topics/#{@topic_id}/feeds", body, return response end |
#update(feed, options = {}) ⇒ Object
Update an associated Feed to the Topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:id’ PUT
feed - A hash containing ‘data`:A hash of data to be stored
56 57 58 59 60 61 62 63 |
# File 'lib/sensit/api/feed.rb', line 56 def update(feed, = {}) body = .has_key?(:body) ? [:body] : {} body[:feed] = feed response = @client.put "/topics/#{@topic_id}/feeds/#{@id}", body, return response end |