Class: Sensit::Api::Subscription
- Inherits:
-
Object
- Object
- Sensit::Api::Subscription
- Defined in:
- lib/sensit/api/subscription.rb
Overview
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
Instance Method Summary collapse
-
#create(subscription, options = {}) ⇒ Object
Create a subscription which will connect to the server and listen for feed data for any of the associated topics.
-
#delete(options = {}) ⇒ Object
Delete the subscription and stop listening for feed data for the associated topics.
-
#find(options = {}) ⇒ Object
Get the information of a specific subscription.
-
#initialize(id, client) ⇒ Subscription
constructor
A new instance of Subscription.
-
#list(options = {}) ⇒ Object
Get the list of all subscriptions for importing feed data to the associated topics.
-
#update(subscription, options = {}) ⇒ Object
Returns an object with the current configuration that Buffer is using, including supported services, their icons and the varying limits of character and schedules.
Constructor Details
#initialize(id, client) ⇒ Subscription
Returns a new instance of Subscription.
10 11 12 13 |
# File 'lib/sensit/api/subscription.rb', line 10 def initialize(id, client) @id = id @client = client end |
Instance Method Details
#create(subscription, options = {}) ⇒ Object
Create a subscription which will connect to the server and listen for feed data for any of the associated topics. Requires authorization of manage_any_subscriptions, or manage_application_subscriptions. ‘/subscriptions’ POST
subscription - A Hash containing`name`:The channel or name to identify the subscription(required).‘host`:The ip address or host of the connection(required).`protocol`:the protocol to communicate over (http, tcp, udp, mqtt) (required)`port`:The port of the connection.
41 42 43 44 45 46 47 48 |
# File 'lib/sensit/api/subscription.rb', line 41 def create(subscription, = {}) body = .has_key?(:body) ? [:body] : {} body[:subscription] = subscription response = @client.post "/subscriptions", body, return response end |
#delete(options = {}) ⇒ Object
Delete the subscription and stop listening for feed data for the associated topics. Requires authorization of manage_any_subscriptions, or manage_application_subscriptions. ‘/subscriptions/:id’ DELETE
66 67 68 69 70 71 72 |
# File 'lib/sensit/api/subscription.rb', line 66 def delete( = {}) body = .has_key?(:body) ? [:body] : {} response = @client.delete "/subscriptions/#{@id}", body, return response end |
#find(options = {}) ⇒ Object
Get the information of a specific subscription. Requires authorization of read_any_subscriptions, or read_application_subscriptions. ‘/subscriptions/:id’ GET
29 30 31 32 33 34 35 |
# File 'lib/sensit/api/subscription.rb', line 29 def find( = {}) body = .has_key?(:query) ? [:query] : {} response = @client.get "/subscriptions/#{@id}", body, return response end |
#list(options = {}) ⇒ Object
Get the list of all subscriptions for importing feed data to the associated topics. Requires authorization of read_any_subscriptions, or read_application_subscriptions. ‘/subscriptions’ GET
18 19 20 21 22 23 24 |
# File 'lib/sensit/api/subscription.rb', line 18 def list( = {}) body = .has_key?(:query) ? [:query] : {} response = @client.get "/subscriptions", body, return response end |
#update(subscription, options = {}) ⇒ Object
Returns an object with the current configuration that Buffer is using, including supported services, their icons and the varying limits of character and schedules. Requires authorization of manage_any_subscriptions, or manage_application_subscriptions. ‘/subscriptions/:id’ PUT
subscription - A Hash containing`name`:The channel or name to identify the subscription(required).‘host`:The ip address or host of the connection(required).`protocol`:the protocol to communicate over (http, tcp, udp, mqtt) (required)`port`:The port of the connection.
54 55 56 57 58 59 60 61 |
# File 'lib/sensit/api/subscription.rb', line 54 def update(subscription, = {}) body = .has_key?(:body) ? [:body] : {} body[:subscription] = subscription response = @client.put "/subscriptions/#{@id}", body, return response end |