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(name, host, protocol, 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(name, host, protocol, 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(name, host, protocol, 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
name - The channel or name to identify the subscription. host - The ip address or host of the connection protocol - the protocol to comminivate over
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/sensit/api/subscription.rb', line 43 def create(name, host, protocol, = {}) body = .has_key?(:body) ? [:body] : {} body[:name] = name body[:host] = host body[:protocol] = protocol 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
74 75 76 77 78 79 80 |
# File 'lib/sensit/api/subscription.rb', line 74 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(name, host, protocol, 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
name - The channel or name to identify the subscription. host - The ip address or host of the connection protocol - the protocol to comminivate over
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/sensit/api/subscription.rb', line 60 def update(name, host, protocol, = {}) body = .has_key?(:body) ? [:body] : {} body[:name] = name body[:host] = host body[:protocol] = protocol response = @client.put "/subscriptions/#{@id}", body, return response end |