Class: Algorithmia::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/algorithmia/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#jsonObject (readonly)

Returns the value of attribute json.



5
6
7
# File 'lib/algorithmia/response.rb', line 5

def json
  @json
end

Instance Method Details

#alertsObject



35
36
37
# File 'lib/algorithmia/response.rb', line 35

def alerts
  ["alerts"]
end

#content_typeObject



27
28
29
# File 'lib/algorithmia/response.rb', line 27

def content_type
  ["content_type"]
end

#durationObject



23
24
25
# File 'lib/algorithmia/response.rb', line 23

def duration
  ["duration"]
end

#metadataObject



19
20
21
# File 'lib/algorithmia/response.rb', line 19

def 
  @json["metadata"]
end

#resultObject



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

#stdoutObject



31
32
33
# File 'lib/algorithmia/response.rb', line 31

def stdout
  ["stdout"]
end