Class: Juggernaut::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/juggernaut/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, body, signature) ⇒ Message

Returns a new instance of Message.



8
9
10
11
12
13
# File 'lib/juggernaut/message.rb', line 8

def initialize(id, body, signature)
 @id         = id
 @body       = body
 @signature  = signature
 @created_at = Time.now
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/juggernaut/message.rb', line 5

def body
  @body
end

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/juggernaut/message.rb', line 6

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/juggernaut/message.rb', line 3

def id
  @id
end

#signatureObject

Returns the value of attribute signature.



4
5
6
# File 'lib/juggernaut/message.rb', line 4

def signature
  @signature
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/juggernaut/message.rb', line 15

def to_s
  { :id => @id.to_s, :body => @body, :signature => @signature }.to_json
end