Class: PackAPI::Mapping::AttributeHashTransformer

Inherits:
AbstractTransformer show all
Defined in:
lib/pack_api/mapping/attribute_hash_transformer.rb

Overview

Specialized attribute transformer converting attribute Hashes

Does not work with models (only Hashes) Does not convert values Converts model attributes to API attributes Converts API attributes to model attributes

Instance Attribute Summary

Attributes inherited from AbstractTransformer

#api_type, #data_source, #mappings, #model_type, #options

Instance Method Summary collapse

Methods inherited from AbstractTransformer

#initialize

Constructor Details

This class inherits a constructor from PackAPI::Mapping::AbstractTransformer

Instance Method Details

#executeObject



12
13
14
15
16
# File 'lib/pack_api/mapping/attribute_hash_transformer.rb', line 12

def execute
  options.fetch(:contains_model_attributes, true) ?
    model_attributes_to_api_attributes :
    api_attributes_to_model_attributes
end