Class: Io::Flow::V0::Models::CheckoutAttribute
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CheckoutAttribute
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A Checkout Attribute defines an attribute that will be made available via the checkout item content. This is useful if you would like to surface a specific attribute (like ‘size’ or ‘color’) in checkout.
Instance Attribute Summary collapse
-
#attribute_keys ⇒ Object
readonly
Returns the value of attribute attribute_keys.
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CheckoutAttribute
constructor
A new instance of CheckoutAttribute.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CheckoutAttribute
Returns a new instance of CheckoutAttribute.
26890 26891 26892 26893 26894 26895 26896 26897 26898 26899 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26890 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :experience, :key, :name, :attribute_keys, :position], 'CheckoutAttribute') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x)) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @attribute_keys = HttpClient::Preconditions.assert_class('attribute_keys', opts.delete(:attribute_keys), Array).map { |v| HttpClient::Preconditions.assert_class('attribute_keys', v, String) } @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer) end |
Instance Attribute Details
#attribute_keys ⇒ Object (readonly)
Returns the value of attribute attribute_keys.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def attribute_keys @attribute_keys end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def experience @experience end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def name @name end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
26888 26889 26890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26888 def position @position end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
26905 26906 26907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26905 def copy(incoming={}) CheckoutAttribute.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
26909 26910 26911 26912 26913 26914 26915 26916 26917 26918 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26909 def to_hash { :id => id, :experience => experience.to_hash, :key => key, :name => name, :attribute_keys => attribute_keys, :position => position } end |
#to_json ⇒ Object
26901 26902 26903 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26901 def to_json JSON.dump(to_hash) end |