class Sensit::Api::Feed

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

Public Class Methods

new(topic_id, id, client) click to toggle source
# File lib/sensit/api/feed.rb, line 11
def initialize(topic_id, id, client)
  @topic_id = topic_id
  @id = id
  @client = client
end

Public Instance Methods

create(feed, options = {}) click to toggle source

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

# File lib/sensit/api/feed.rb, line 43
def create(feed, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:feed] = feed

  response = @client.post "/topics/#{@topic_id}/feeds", body, options

  return response
end
delete(options = {}) click to toggle source

Deletes the desired feed. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:id’ DELETE

# File lib/sensit/api/feed.rb, line 68
def delete(options = {})
  body = options.has_key?(:body) ? options[:body] : {}

  response = @client.delete "/topics/#{@topic_id}/feeds/#{@id}", body, options

  return response
end
find(options = {}) click to toggle source

Returns a specific feed for a topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:id’ GET

# File lib/sensit/api/feed.rb, line 31
def find(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/topics/#{@topic_id}/feeds/#{@id}", body, options

  return response
end
list(options = {}) click to toggle source

Returns a list of feeds for a given topic. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds’ GET

# File lib/sensit/api/feed.rb, line 20
def list(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/topics/#{@topic_id}/feeds", body, options

  return response
end
update(feed, options = {}) click to toggle source

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

# File lib/sensit/api/feed.rb, line 56
def update(feed, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:feed] = feed

  response = @client.put "/topics/#{@topic_id}/feeds/#{@id}", body, options

  return response
end