Class: Bitmessage::ApiClient::Message
- Inherits:
-
Object
- Object
- Bitmessage::ApiClient::Message
- Defined in:
- lib/bitmessage/api_client.rb
Constant Summary collapse
- ENCODING_IGNORE =
0- ENCODING_TRIVIAL =
1- ENCODING_SIMPLE =
2- FOLDER_UNKNOWN =
:unknown- FOLDER_INBOX =
:inbox- FOLDER_OUTBOX =
:outbox
Instance Attribute Summary collapse
-
#ack_data ⇒ Object
outbox attributes.
-
#encoding ⇒ Object
common attributes.
-
#folder ⇒ Object
common attributes.
-
#from ⇒ Object
common attributes.
-
#last_action_at ⇒ Object
outbox attributes.
-
#message ⇒ Object
common attributes.
-
#msgid ⇒ Object
common attributes.
-
#read ⇒ Object
inbox attributes.
-
#received_at ⇒ Object
inbox attributes.
-
#status ⇒ Object
outbox attributes.
-
#subject ⇒ Object
common attributes.
-
#to ⇒ Object
common attributes.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ Message
Returns a new instance of Message.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bitmessage/api_client.rb', line 38 def initialize hash self.folder = FOLDER_UNKNOWN self.msgid = hash['msgid'] self.to = hash['toAddress'] self.from = hash['fromAddress'] self.subject = Base64.decode64(hash['subject']) self. = Base64.decode64(hash['message']) self.encoding = hash['encodingType'].to_i if hash.keys.include?('receivedTime') self.folder = FOLDER_INBOX self.received_at = Time.at(hash['receivedTime'].to_i) self.read = hash['read'] == 0 ? false : true elsif hash.keys.include?('ackData') self.folder = FOLDER_OUTBOX self.last_action_at = Time.at(hash['lastActionTime'].to_i) self.status = hash['status'] self.ack_data = hash['ackData'] end end |
Instance Attribute Details
#ack_data ⇒ Object
outbox attributes
36 37 38 |
# File 'lib/bitmessage/api_client.rb', line 36 def ack_data @ack_data end |
#encoding ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def encoding @encoding end |
#folder ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def folder @folder end |
#from ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def from @from end |
#last_action_at ⇒ Object
outbox attributes
36 37 38 |
# File 'lib/bitmessage/api_client.rb', line 36 def last_action_at @last_action_at end |
#message ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def end |
#msgid ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def msgid @msgid end |
#read ⇒ Object
inbox attributes
34 35 36 |
# File 'lib/bitmessage/api_client.rb', line 34 def read @read end |
#received_at ⇒ Object
inbox attributes
34 35 36 |
# File 'lib/bitmessage/api_client.rb', line 34 def received_at @received_at end |
#status ⇒ Object
outbox attributes
36 37 38 |
# File 'lib/bitmessage/api_client.rb', line 36 def status @status end |
#subject ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def subject @subject end |
#to ⇒ Object
common attributes
32 33 34 |
# File 'lib/bitmessage/api_client.rb', line 32 def to @to end |
Instance Method Details
#to_s ⇒ Object
59 60 61 |
# File 'lib/bitmessage/api_client.rb', line 59 def to_s self.msgid end |