Class: HTTParty::Response

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

Instance Method Summary collapse

Instance Method Details

#jsonObject



25
26
27
# File 'lib/client.rb', line 25

def json
  ::JSON.parse(self.body)
end

#structObject



29
30
31
32
33
34
35
36
# File 'lib/client.rb', line 29

def struct
  case json
    when ::Array
      json.map{|o| ::RecursiveOpenStruct.new o, recurse_over_arrays: true }
    when ::Hash
      ::RecursiveOpenStruct.new json, recurse_over_arrays: true
  end
end