Class: Incognia::APIResource

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/incognia_api/resources/api_resource.rb

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/incognia_api/resources/api_resource.rb', line 5

def self.from_hash(hash)
  hash = hash.each_with_object({}) do |(k, v), h|
    h[k] = v.is_a?(Hash) ? from_hash(v) : v
  end

  new(hash)
end