class Orchestrate::API::ResponseBody

Decodes body from json into a hash; provides the original body content via the 'content' method.

Attributes

code[R]

Error code from the orchestrate.io api.

content[R]

Original response body from HTTParty.

count[R]

Set for list, search, get_events, and get_graph results.

message[R]

Error message from the orchestrate.io api.

next[R]

Set for list results.

results[R]

Set for all results.

to_hash[R]

The json response body converted to a hash.

total_count[R]

Set for search results.

Public Class Methods

new(body) click to toggle source

Initialize instance variables, based on response body contents.

# File api/lib/orchestrate_api/response.rb, line 90
def initialize(body)
  @content = body
  @to_hash = body.blank? ? {} : ActiveSupport::JSON.decode(body)
  to_hash.each { |k,v| instance_variable_set "@#{k}", v }
end

Public Instance Methods

result_keys() click to toggle source
# File api/lib/orchestrate_api/response.rb, line 96
def result_keys
  results.map { |result| result['path']['key'] } if results
end