Class: Playtypus::Call
- Inherits:
-
Object
- Object
- Playtypus::Call
- Defined in:
- lib/playtypus/call.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#path ⇒ Object
Returns the value of attribute path.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#verb ⇒ Object
Returns the value of attribute verb.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(timestamp, path, verb, headers, body) ⇒ Call
constructor
A new instance of Call.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(timestamp, path, verb, headers, body) ⇒ Call
Returns a new instance of Call.
16 17 18 19 20 21 22 |
# File 'lib/playtypus/call.rb', line 16 def initialize(, path, verb, headers, body) @timestamp = Time.iso8601() @path = path @verb = verb @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/playtypus/call.rb', line 6 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/playtypus/call.rb', line 6 def headers @headers end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/playtypus/call.rb', line 6 def path @path end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/playtypus/call.rb', line 6 def @timestamp end |
#verb ⇒ Object
Returns the value of attribute verb.
6 7 8 |
# File 'lib/playtypus/call.rb', line 6 def verb @verb end |
Class Method Details
.from_hash(hash) ⇒ Object
12 13 14 |
# File 'lib/playtypus/call.rb', line 12 def self.from_hash(hash) return self.new(hash['timestamp'], hash['path'], hash['verb'], hash['headers'], hash['body']) end |
Instance Method Details
#to_hash ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/playtypus/call.rb', line 24 def to_hash { 'timestamp' => @timestamp, 'path' => @path, 'verb' => @verb, 'headers' => @headers, 'body' => @body } end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/playtypus/call.rb', line 34 def to_s self.to_hash.to_json end |