Class: Sensit::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(auth = {}, options = {}) ⇒ Client

Returns a new instance of Client.



17
18
19
# File 'lib/sensit/client.rb', line 17

def initialize(auth = {}, options = {})
  @http_client = Sensit::HttpClient::HttpClient.new auth, options
end

Instance Method Details

#data(topic_id, feed_id, id) ⇒ Object

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



46
47
48
# File 'lib/sensit/client.rb', line 46

def data(topic_id, feed_id, id)
  Sensit::Api::Data.new topic_id, feed_id, id, @http_client
end

#feed(topic_id, id) ⇒ Object

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



37
38
39
# File 'lib/sensit/client.rb', line 37

def feed(topic_id, id)
  Sensit::Api::Feed.new topic_id, id, @http_client
end

#field(topic_id, id) ⇒ Object

.

topic_id - The key for the parent topic id - Username of the user



77
78
79
# File 'lib/sensit/client.rb', line 77

def field(topic_id, id)
  Sensit::Api::Field.new topic_id, id, @http_client
end

#percolator(topic_id, id) ⇒ Object

A Percolator is a reverse query much like a match rule which is run whenever a new feed is added. These can be used to create alerts by causing the sensit to publish the feed that was just added. A percolator query is defined by a ‘name` and and valid `query` according to the according the the [elasticsearch Query DSL](www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html). For more information about Percolator queries please refer to the [elasticsearch percolator documentation](www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html).

topic_id - The key for the parent topic id - The name of the percolator query



54
55
56
# File 'lib/sensit/client.rb', line 54

def percolator(topic_id, id)
  Sensit::Api::Percolator.new topic_id, id, @http_client
end

#report(topic_id, id) ⇒ Object

Reports are stored filter and facet queries on the Feed data. A report is a assigned a ‘name` and the `query` is any elasticsearch query which filters only the desired data for the facets (See the [elasticsearch Query DSL](www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-queries.html) for valid queries). A report can have many `facets` with each facet is referred to by a user defined `name`. Valid `type`’s of facet include terms, range, histogram, filter, statistical, query, terms_stats, or geo_distance. The ‘query` within a facet defines the field counts or statistics which the data is calculated over. See the [elasticsearch facet dsl](www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html) for information about the various facet types and valid query fields.

topic_id - The key for the parent topic id - The identifier of the report



62
63
64
# File 'lib/sensit/client.rb', line 62

def report(topic_id, id)
  Sensit::Api::Report.new topic_id, id, @http_client
end

#subscription(id) ⇒ Object

Subscriptions allows feed data to imported using a socket rather than just using the Feed REST API. By creating a subscription sensit will start to listen for feed data being imported using the specified ‘host` and while using the topic name as the `channel` name.

id - The identifier for the subscription



69
70
71
# File 'lib/sensit/client.rb', line 69

def subscription(id)
  Sensit::Api::Subscription.new id, @http_client
end

#topicObject

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).



29
30
31
# File 'lib/sensit/client.rb', line 29

def topic()
  Sensit::Api::Topic.new @http_client
end

#userObject

<no value>



23
24
25
# File 'lib/sensit/client.rb', line 23

def user()
  Sensit::Api::User.new @http_client
end