Class: Nuntius::Envelope
- Inherits:
-
Object
- Object
- Nuntius::Envelope
- Includes:
- Enumerable
- Defined in:
- lib/nuntius/envelope.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#key ⇒ Object
Returns the value of attribute key.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(attributes) ⇒ Envelope
constructor
A new instance of Envelope.
- #raw_data ⇒ Object
- #raw_key ⇒ Object
- #raw_signature ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Envelope
Returns a new instance of Envelope.
6 7 8 9 10 |
# File 'lib/nuntius/envelope.rb', line 6 def initialize(attributes) self.data = attributes[:raw_data] ? encode(attributes[:raw_data]) : attributes[:data] self.key = attributes[:raw_key] ? encode(attributes[:raw_key]) : attributes[:key] self.signature = attributes[:raw_signature] ? encode(attributes[:raw_signature]) : attributes[:signature] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/nuntius/envelope.rb', line 4 def data @data end |
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/nuntius/envelope.rb', line 4 def key @key end |
#signature ⇒ Object
Returns the value of attribute signature.
4 5 6 |
# File 'lib/nuntius/envelope.rb', line 4 def signature @signature end |
Instance Method Details
#each(&block) ⇒ Object
32 33 34 |
# File 'lib/nuntius/envelope.rb', line 32 def each(&block) self.to_hash.each(&block) end |
#raw_data ⇒ Object
20 21 22 |
# File 'lib/nuntius/envelope.rb', line 20 def raw_data decode data end |
#raw_key ⇒ Object
24 25 26 |
# File 'lib/nuntius/envelope.rb', line 24 def raw_key decode key end |
#raw_signature ⇒ Object
28 29 30 |
# File 'lib/nuntius/envelope.rb', line 28 def raw_signature decode signature end |
#to_hash ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/nuntius/envelope.rb', line 12 def to_hash { :data => data, :key => key, :signature => signature } end |