Class: SoftLayer::Messaging::Message
- Inherits:
-
Object
- Object
- SoftLayer::Messaging::Message
- Defined in:
- lib/softlayer/messaging/message.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
- #body ⇒ Object
- #delete ⇒ Object
-
#initialize(parent_resource, data) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(parent_resource, data) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 |
# File 'lib/softlayer/messaging/message.rb', line 6 def initialize(parent_resource, data) @id = data[:id] @data = data @resource = parent_resource["messages/#{@id}"] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/softlayer/messaging/message.rb', line 4 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/softlayer/messaging/message.rb', line 4 def id @id end |
#resource ⇒ Object
Returns the value of attribute resource.
4 5 6 |
# File 'lib/softlayer/messaging/message.rb', line 4 def resource @resource end |
Instance Method Details
#body ⇒ Object
12 13 14 |
# File 'lib/softlayer/messaging/message.rb', line 12 def body data[:body] end |
#delete ⇒ Object
16 17 18 |
# File 'lib/softlayer/messaging/message.rb', line 16 def delete JSON.parse(@resource.delete, :symbolize_names => true) end |
#to_s ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/softlayer/messaging/message.rb', line 20 def to_s if data[:body].length > 10 "Message<#{@id}, \"#{data[:body][0..9]}...\">" else "Message<#{@id}, \"#{data[:body]}\">" end end |