Class: Whisper::Message
- Inherits:
-
Struct
- Object
- Struct
- Whisper::Message
- Defined in:
- lib/whisper/message.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#from ⇒ Object
Returns the value of attribute from.
-
#has_read ⇒ Object
Returns the value of attribute has_read.
-
#id ⇒ Object
Returns the value of attribute id.
-
#sent_date ⇒ Object
Returns the value of attribute sent_date.
-
#star_check ⇒ Object
Returns the value of attribute star_check.
Class Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def content @content end |
#from ⇒ Object
Returns the value of attribute from
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def from @from end |
#has_read ⇒ Object
Returns the value of attribute has_read
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def has_read @has_read end |
#id ⇒ Object
Returns the value of attribute id
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def id @id end |
#sent_date ⇒ Object
Returns the value of attribute sent_date
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def sent_date @sent_date end |
#star_check ⇒ Object
Returns the value of attribute star_check
1 2 3 |
# File 'lib/whisper/message.rb', line 1 def star_check @star_check end |
Class Method Details
.from_hash(hsh) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/whisper/message.rb', line 6 def self.from_hash(hsh) ret = new(hsh['id'].to_i, hsh['from'], hsh['content'], DateTime.parse(hsh['sent_date'])) ret.has_read = hsh['hasRead'].to_s == 'yes' ret.star_check = hsh['starCheck'].to_s == 'yes' ret end |
.parse_collection(xml) ⇒ Object
2 3 4 |
# File 'lib/whisper/message.rb', line 2 def self.parse_collection(xml) Hash.from_xml(xml)['messages'].map{|hsh| from_hash(hsh)} end |