Class: Sensit::Api::Topic

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

Overview

A topic is root that data is attached to. It is the equivalent of a source in searchlight/solink and acts as a table which has columns(Fields) and rows(Feeds).

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Topic

Returns a new instance of Topic.



9
10
11
# File 'lib/sensit/api/topic.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#create(topic, options = {}) ⇒ Object

Requires authorization of manage_any_data, or manage_application_data. ‘/topics’ POST

topic - A hash containing the name/id of the topic (required) and a description of the topic.



39
40
41
42
43
44
45
46
# File 'lib/sensit/api/topic.rb', line 39

def create(topic, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:topic] = topic

  response = @client.post "/topics", body, options

  return response
end

#delete(options = {}) ⇒ Object

Requires authorization of manage_any_data, or manage_application_data. ‘/topics/:id’ DELETE



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

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

  response = @client.delete "/topics/:id", body, options

  return response
end

#find(options = {}) ⇒ Object

Requires authorization of read_any_data, or read_application_data. ‘/topics/:id’ GET



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

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

  response = @client.get "/topics/:id", body, options

  return response
end

#list(options = {}) ⇒ Object

Requires authorization of read_any_data, or read_application_data. ‘/topics’ GET



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

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

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

  return response
end

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

Requires authorization of manage_any_data, or manage_application_data. ‘/topics/:id’ PUT

topic - A hash containing the name/id of the topic (required) and a description of the topic.



52
53
54
55
56
57
58
59
# File 'lib/sensit/api/topic.rb', line 52

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

  response = @client.put "/topics/:id", body, options

  return response
end