Class: Algorithmia::Response
- Inherits:
-
Object
- Object
- Algorithmia::Response
- Defined in:
- lib/algorithmia/response.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Instance Method Summary collapse
- #alerts ⇒ Object
- #content_type ⇒ Object
- #duration ⇒ Object
-
#initialize(result) ⇒ Response
constructor
A new instance of Response.
- #metadata ⇒ Object
- #result ⇒ Object
- #stdout ⇒ Object
Constructor Details
#initialize(result) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/algorithmia/response.rb', line 7 def initialize(result) @json = result end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
5 6 7 |
# File 'lib/algorithmia/response.rb', line 5 def json @json end |
Instance Method Details
#alerts ⇒ Object
35 36 37 |
# File 'lib/algorithmia/response.rb', line 35 def alerts ["alerts"] end |
#content_type ⇒ Object
27 28 29 |
# File 'lib/algorithmia/response.rb', line 27 def content_type ["content_type"] end |
#duration ⇒ Object
23 24 25 |
# File 'lib/algorithmia/response.rb', line 23 def duration ["duration"] end |
#metadata ⇒ Object
19 20 21 |
# File 'lib/algorithmia/response.rb', line 19 def @json["metadata"] end |
#result ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/algorithmia/response.rb', line 11 def result if content_type == 'binary' Base64.decode64(@json["result"]) else @json["result"] end end |
#stdout ⇒ Object
31 32 33 |
# File 'lib/algorithmia/response.rb', line 31 def stdout ["stdout"] end |