Class: Epages::CustomAttribute
- Inherits:
-
Object
- Object
- Epages::CustomAttribute
- Includes:
- Utils
- Defined in:
- lib/epages/custom_attribute.rb
Constant Summary collapse
- KEYS =
%w(key display_key single_value type values).collect(&:to_sym).freeze
Instance Method Summary collapse
-
#formatted_attributes ⇒ Object
return a Hash with the display value as key and an array with all the displayValue as value.
-
#initialize(data) ⇒ CustomAttribute
constructor
A new instance of CustomAttribute.
Methods included from Utils
build_shop_from, camelize_keys, camelize_words, options_to_multipart_request, options_to_patch_request, parse_attribute_as, parse_attribute_as_array_of, parse_attributes, symbolize_keys!, to_query_options, underscorize_keys
Constructor Details
#initialize(data) ⇒ CustomAttribute
Returns a new instance of CustomAttribute.
11 12 13 |
# File 'lib/epages/custom_attribute.rb', line 11 def initialize(data) parse_attributes(data) end |
Instance Method Details
#formatted_attributes ⇒ Object
return a Hash with the display value as key and an array with all the displayValue as value
16 17 18 |
# File 'lib/epages/custom_attribute.rb', line 16 def formatted_attributes Hash[display_key.downcase.to_sym, values.collect { |el| el[:displayValue] }] end |