class Sensit::Api::Subscription

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

Public Class Methods

new(id, client) click to toggle source
# File lib/sensit/api/subscription.rb, line 10
def initialize(id, client)
  @id = id
  @client = client
end

Public Instance Methods

create(subscription, options = {}) click to toggle source

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.

# File lib/sensit/api/subscription.rb, line 41
def create(subscription, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:subscription] = subscription

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

  return response
end
delete(options = {}) click to toggle source

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

# File lib/sensit/api/subscription.rb, line 66
def delete(options = {})
  body = options.has_key?(:body) ? options[:body] : {}

  response = @client.delete "/subscriptions/#{@id}", body, options

  return response
end
find(options = {}) click to toggle source

Get the information of a specific subscription. Requires authorization of read_any_subscriptions, or read_application_subscriptions. ‘/subscriptions/:id’ GET

# File lib/sensit/api/subscription.rb, line 29
def find(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

  response = @client.get "/subscriptions/#{@id}", body, options

  return response
end
list(options = {}) click to toggle source

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

# File lib/sensit/api/subscription.rb, line 18
def list(options = {})
  body = options.has_key?(:query) ? options[:query] : {}

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

  return response
end
update(subscription, options = {}) click to toggle source

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.

# File lib/sensit/api/subscription.rb, line 54
def update(subscription, options = {})
  body = options.has_key?(:body) ? options[:body] : {}
  body[:subscription] = subscription

  response = @client.put "/subscriptions/#{@id}", body, options

  return response
end