Class: Ari::Application
- Defined in:
- lib/ari/resources/application.rb
Instance Attribute Summary collapse
-
#bridge_ids ⇒ Object
readonly
Returns the value of attribute bridge_ids.
-
#channel_ids ⇒ Object
readonly
Returns the value of attribute channel_ids.
-
#device_names ⇒ Object
readonly
Returns the value of attribute device_names.
-
#endpoint_ids ⇒ Object
readonly
Returns the value of attribute endpoint_ids.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.get(options = {}) ⇒ Object
GET /applications/%applicationName.
-
.list(options = {}) ⇒ Object
GET /applications.
-
.subscribe(options = {}) ⇒ Object
POST /applications/%applicationName/subscription.
-
.unsubscribe(options = {}) ⇒ Object
DELETE /applications/%applicationName/subscription.
Instance Method Summary collapse
Methods inherited from Resource
#add_listener, client, #client, #remove_all_listeners!, #remove_listener
Methods inherited from Model
Constructor Details
This class inherits a constructor from Ari::Model
Instance Attribute Details
#bridge_ids ⇒ Object (readonly)
Returns the value of attribute bridge_ids.
15 16 17 |
# File 'lib/ari/resources/application.rb', line 15 def bridge_ids @bridge_ids end |
#channel_ids ⇒ Object (readonly)
Returns the value of attribute channel_ids.
15 16 17 |
# File 'lib/ari/resources/application.rb', line 15 def channel_ids @channel_ids end |
#device_names ⇒ Object (readonly)
Returns the value of attribute device_names.
15 16 17 |
# File 'lib/ari/resources/application.rb', line 15 def device_names @device_names end |
#endpoint_ids ⇒ Object (readonly)
Returns the value of attribute endpoint_ids.
15 16 17 |
# File 'lib/ari/resources/application.rb', line 15 def endpoint_ids @endpoint_ids end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/ari/resources/application.rb', line 15 def name @name end |
Class Method Details
.get(options = {}) ⇒ Object
GET /applications/%applicationName
Stasis application
Parameters:
applicationName (required) - Application’s name
38 39 40 41 42 43 |
# File 'lib/ari/resources/application.rb', line 38 def self.get( = {}) raise ArgumentError.new("Parameter applicationName must be passed in options hash.") unless [:applicationName] path = '/applications/%{applicationName}' % response = client().get(path, ) Application.new(response.merge(client: [:client])) end |
.list(options = {}) ⇒ Object
GET /applications
Stasis applications
23 24 25 26 27 |
# File 'lib/ari/resources/application.rb', line 23 def self.list( = {}) path = '/applications' response = client().get(path, ) response.map { |hash| Application.new(hash.merge(client: [:client])) } end |
.subscribe(options = {}) ⇒ Object
POST /applications/%applicationName/subscription
Stasis application
Parameters:
applicationName (required) - Application’s name eventSource (required) - URI for event source (channel:channelId}, bridge:bridgeId, endpoint:deviceState:{deviceName
59 60 61 62 63 64 65 |
# File 'lib/ari/resources/application.rb', line 59 def self.subscribe( = {}) raise ArgumentError.new("Parameter applicationName must be passed in options hash.") unless [:applicationName] raise ArgumentError.new("Parameter eventSource must be passed in options hash.") unless [:eventSource] path = '/applications/%{applicationName}/subscription' % response = client().post(path, ) Application.new(response.merge(client: [:client])) end |
.unsubscribe(options = {}) ⇒ Object
DELETE /applications/%applicationName/subscription
Stasis application
Parameters:
applicationName (required) - Application’s name eventSource (required) - URI for event source (channel:channelId}, bridge:bridgeId, endpoint:deviceState:{deviceName
81 82 83 84 85 86 87 88 89 |
# File 'lib/ari/resources/application.rb', line 81 def self.unsubscribe( = {}) raise ArgumentError.new("Parameter applicationName must be passed in options hash.") unless [:applicationName] raise ArgumentError.new("Parameter eventSource must be passed in options hash.") unless [:eventSource] path = '/applications/%{applicationName}/subscription' % response = client().delete(path, ) Application.new(response.merge(client: [:client])) rescue Ari::RequestError => e raise unless e.code == '404' end |
Instance Method Details
#get(options = {}) ⇒ Object
45 46 47 |
# File 'lib/ari/resources/application.rb', line 45 def get( = {}) self.class.get(.merge(applicationName: self.id, client: @client)) end |
#subscribe(options = {}) ⇒ Object
67 68 69 |
# File 'lib/ari/resources/application.rb', line 67 def subscribe( = {}) self.class.subscribe(.merge(applicationName: self.id, client: @client)) end |
#unsubscribe(options = {}) ⇒ Object
91 92 93 |
# File 'lib/ari/resources/application.rb', line 91 def unsubscribe( = {}) self.class.unsubscribe(.merge(applicationName: self.id, client: @client)) end |