Class: Sensit::Api::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/sensit/api/data.rb

Overview

Get the value of a specific field within a feed

topic_id - The key for the parent topic feed_id - The id of the parent feed id - The key of the specific field

Instance Method Summary collapse

Constructor Details

#initialize(topic_id, feed_id, id, client) ⇒ Data

Returns a new instance of Data.



12
13
14
15
16
17
# File 'lib/sensit/api/data.rb', line 12

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

Instance Method Details

#find(options = {}) ⇒ Object

Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:feed_id/data/:id’ GET



22
23
24
25
26
27
28
# File 'lib/sensit/api/data.rb', line 22

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

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

  return response
end

#update(options = {}) ⇒ Object

Update a specific value of a field within a feed with the data passed in. Requires authorization of read_any_data, or read_application_data. ‘/topics/:topic_id/feeds/:feed_id/data/:id’ PUT



33
34
35
36
37
38
39
# File 'lib/sensit/api/data.rb', line 33

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

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

  return response
end