Module: AboutYou::SDK::Model::AbstractBasketItem
- Included in:
- BasketItem, BasketSet
- Defined in:
- lib/AboutYou/Model/Basket/abstract_basket_item.rb
Overview
This class is an abstract model of a basket item
- author
-
Collins GmbH & Co KG
Constant Summary collapse
- IMAGE_URL_REQUIRED =
false
Instance Attribute Summary collapse
-
#additional_data ⇒ Object
Additional data are transmitted to the merchant untouched.
-
#is_changed ⇒ Object
Returns the value of attribute is_changed.
Instance Method Summary collapse
-
#addition_data=(additional_data) ⇒ Object
Additional data are transmitted to the merchant untouched.
- #check_additional_data(additional_data = nil) ⇒ Object
-
#description ⇒ Object
String|null.
Instance Attribute Details
#additional_data ⇒ Object
Additional data are transmitted to the merchant untouched. If set (array not empty), a key “description” must exist. This description must be a string that describes the variant. If you want to pass a different image URL, you can add a key “image_url” to the $additional_data that contains the URL to the image.
19 20 21 |
# File 'lib/AboutYou/Model/Basket/abstract_basket_item.rb', line 19 def additional_data @additional_data end |
#is_changed ⇒ Object
Returns the value of attribute is_changed.
20 21 22 |
# File 'lib/AboutYou/Model/Basket/abstract_basket_item.rb', line 20 def is_changed @is_changed end |
Instance Method Details
#addition_data=(additional_data) ⇒ Object
Additional data are transmitted to the merchant untouched. If set (array not empty), a key “description” must exist. This description must be a string that describes the variant. If you want to pass a different image URL, you can add a key “image_url” to the $additional_data that contains the URL to the image.
39 40 41 42 43 44 |
# File 'lib/AboutYou/Model/Basket/abstract_basket_item.rb', line 39 def addition_data=(additional_data) check_additional_data(additional_data) self.is_changed = true self.additional_data = additional_data end |
#check_additional_data(additional_data = nil) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/AboutYou/Model/Basket/abstract_basket_item.rb', line 46 def check_additional_data(additional_data = nil) return false if additional_data || IMAGE_URL_REQUIRED fail '\InvalidArgumentException! description is required in additional data' if additional_data.key?('description') fail '\InvalidArgumentException! image_url is required in additional data' if IMAGE_URL_REQUIRED && !additional_data.key?('image_url') end |
#description ⇒ Object
Returns string|null.
25 26 27 |
# File 'lib/AboutYou/Model/Basket/abstract_basket_item.rb', line 25 def description additional_data['description'] if additional_data end |