Class: Appcast::Client::Message
- Inherits:
-
Object
- Object
- Appcast::Client::Message
- Defined in:
- lib/appcast/client.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#content ⇒ Object
Returns the value of attribute content.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(connection, attributes = {}) ⇒ Message
constructor
A new instance of Message.
- #location ⇒ Object
- #location=(value) ⇒ Object
Constructor Details
#initialize(connection, attributes = {}) ⇒ Message
Returns a new instance of Message.
14 15 16 17 18 19 |
# File 'lib/appcast/client.rb', line 14 def initialize(connection, attributes = {}) @connection = connection attributes.each do |key, value| send("#{key}=", value) end if attributes end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/appcast/client.rb', line 11 def connection @connection end |
#content ⇒ Object
Returns the value of attribute content.
12 13 14 |
# File 'lib/appcast/client.rb', line 12 def content @content end |
#id ⇒ Object
Returns the value of attribute id.
12 13 14 |
# File 'lib/appcast/client.rb', line 12 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/appcast/client.rb', line 12 def name @name end |
Instance Method Details
#destroy ⇒ Object
29 30 31 |
# File 'lib/appcast/client.rb', line 29 def destroy connection.delete(URI.escape(location)).code == '200' end |
#location ⇒ Object
25 26 27 |
# File 'lib/appcast/client.rb', line 25 def location "/messages/#{id}" end |
#location=(value) ⇒ Object
21 22 23 |
# File 'lib/appcast/client.rb', line 21 def location=(value) self.id = value.to_s.scan(/\d+$/).first end |