class ShipCompliant::ProductAttributes
ShipCompliant::ProductAttributes
¶ ↑
Acts as a hash for working with the AddUpdateProduct
API endpoint.
attributes = ShipCompliant::ProductAttributes({ bottle_size_ml: 750, gtin: 'value', product_description: 'It's great!' }) attributes.to_h #=> { 'BottleSizeML' => 750, 'GTIN' => 'value', 'ProductDescription' => 'It's great!' }
Constants
- KEYS
-
age
-
bottle_size_ml
-
brand_key
-
default_case
-
default_retail_unit_price
-
default_retail_case_price
-
description
-
flavor
-
gtin
-
label
-
percent_alcohol
-
product_key
-
product_type
-
product_description
-
nabca
-
scc
-
upc
-
unimerc
-
unit_price
-
varietal
-
vintage
-
volume_amount
-
volume_unit
-
- SPECIAL_CASES
Public Instance Methods
to_h()
click to toggle source
Converts hash keys to Pascal case and handles special cases.
:bottle_size_ml #=> 'BottleSizeML'
# File lib/ship_compliant/product_attributes.rb, line 86 def to_h details.deep_transform_keys do |key| # handle special cases pascal_key = key.to_s.camelize if SPECIAL_CASES.has_key?(key) pascal_key = SPECIAL_CASES[key] end pascal_key end end