Class: Imis::Mapper
- Inherits:
-
Object
- Object
- Imis::Mapper
- Defined in:
- lib/imis/mapper.rb
Constant Summary collapse
- FIELD_MAPPING =
{ vessel_examiner: %w[ABC_ASC_Individual_Demog Vol_Vessel_Examiner], mm: %w[ABC_ASC_Individual_Demog TotMMS], mm_updated: %w[ABC_ASC_Individual_Demog MMS_Updated] }.freeze
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
-
#initialize(api) ⇒ Mapper
constructor
A new instance of Mapper.
-
#update(field_name, value) ⇒ Object
Update a member’s data by a single field name Does not require knowing which business object / iMIS-specific field name to use.
Constructor Details
#initialize(api) ⇒ Mapper
Returns a new instance of Mapper.
13 14 15 |
# File 'lib/imis/mapper.rb', line 13 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
11 12 13 |
# File 'lib/imis/mapper.rb', line 11 def api @api end |
Instance Method Details
#update(field_name, value) ⇒ Object
Update a member’s data by a single field name Does not require knowing which business object / iMIS-specific field name to use
Only available for previously-mapped fields
22 23 24 25 26 27 28 29 |
# File 'lib/imis/mapper.rb', line 22 def update(field_name, value) if FIELD_MAPPING.key?(field_name.to_sym) business_object_name, field = FIELD_MAPPING[field_name.to_sym] api.put(business_object_name, { field => value }) else missing_mapping(field_name) end end |