Module: Fortnox::API::Mapper::FromJSON

Included in:
Base
Defined in:
lib/fortnox/api/mappers/base/from_json.rb

Defined Under Namespace

Classes: MissingModelOrMapperException

Instance Method Summary collapse

Instance Method Details

#wrapped_json_collection_to_entities_hash(json_collection_hash) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fortnox/api/mappers/base/from_json.rb', line 10

def wrapped_json_collection_to_entities_hash(json_collection_hash)
  entities_hash = []
  json_collection_hash[self.class::JSON_COLLECTION_WRAPPER].each do |json_hash|
    entities_hash << json_hash_to_entity_hash(json_hash, self.class::KEY_MAP)
  end

  entities_hash
end

#wrapped_json_hash_to_entity_hash(json_entity_hash) ⇒ Object



19
20
21
22
# File 'lib/fortnox/api/mappers/base/from_json.rb', line 19

def wrapped_json_hash_to_entity_hash(json_entity_hash)
  json_hash_to_entity_hash(json_entity_hash[self.class::JSON_ENTITY_WRAPPER],
                           self.class::KEY_MAP)
end