Class: SoftLayer::Messaging::Subscription
- Inherits:
-
Object
- Object
- SoftLayer::Messaging::Subscription
- Defined in:
- lib/softlayer/messaging/subscription.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #delete ⇒ Object
- #endpoint ⇒ Object
- #endpoint_type ⇒ Object
-
#initialize(parent_resource, data) ⇒ Subscription
constructor
A new instance of Subscription.
- #to_s ⇒ Object
Constructor Details
#initialize(parent_resource, data) ⇒ Subscription
Returns a new instance of Subscription.
6 7 8 9 10 |
# File 'lib/softlayer/messaging/subscription.rb', line 6 def initialize(parent_resource, data) @id = data[:id] @data = data @resource = parent_resource["subscriptions/#{@id.to_s}"] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/softlayer/messaging/subscription.rb', line 4 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/softlayer/messaging/subscription.rb', line 4 def id @id end |
#resource ⇒ Object
Returns the value of attribute resource.
4 5 6 |
# File 'lib/softlayer/messaging/subscription.rb', line 4 def resource @resource end |
Instance Method Details
#delete ⇒ Object
20 21 22 23 24 |
# File 'lib/softlayer/messaging/subscription.rb', line 20 def delete result = resource.delete JSON.parse(result, :symbolize_names => true) true end |
#endpoint ⇒ Object
12 13 14 |
# File 'lib/softlayer/messaging/subscription.rb', line 12 def endpoint data[:endpoint] end |
#endpoint_type ⇒ Object
16 17 18 |
# File 'lib/softlayer/messaging/subscription.rb', line 16 def endpoint_type data[:endpoint_type] end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/softlayer/messaging/subscription.rb', line 26 def to_s "Subscription<#{@id}, #{data[:endpoint_type]}>" end |