Class: Appcast::Client::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/appcast/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#connectionObject (readonly)

Returns the value of attribute connection.



11
12
13
# File 'lib/appcast/client.rb', line 11

def connection
  @connection
end

#contentObject

Returns the value of attribute content.



12
13
14
# File 'lib/appcast/client.rb', line 12

def content
  @content
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/appcast/client.rb', line 12

def id
  @id
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/appcast/client.rb', line 12

def name
  @name
end

Instance Method Details

#destroyObject



29
30
31
# File 'lib/appcast/client.rb', line 29

def destroy
  connection.delete(URI.escape(location)).code == '200'
end

#locationObject



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