Class: ClarifaiRuby::InfoResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/clarifai_ruby/info_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(json_response, recursion = 0) ⇒ InfoResponse

Returns a new instance of InfoResponse.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/clarifai_ruby/info_response.rb', line 4

def initialize(json_response, recursion=0)
  #parse the json response and make each key available
  json_response.each do |name, value|
    if value.is_a? Hash
      initialize(value, recursion+1)
    else
      self.class.send(:attr_reader, name)
      instance_variable_set("@#{name}", value)
    end
  end
end