Class: Io::Flow::V0::Models::CheckoutItemContent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CheckoutItemContent
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A Checkout Item Content provides information about an item to support rendering of that item in the context of checkout
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CheckoutItemContent
constructor
A new instance of CheckoutItemContent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CheckoutItemContent
Returns a new instance of CheckoutItemContent.
21212 21213 21214 21215 21216 21217 21218 21219 21220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21212 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item, :name, :attributes], 'CheckoutItemContent') @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::Item) ? x : ::Io::Flow::V0::Models::Item.new(x)) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CheckoutItemContentAttribute) ? x : ::Io::Flow::V0::Models::CheckoutItemContentAttribute.new(x)) } @image = (x = opts.delete(:image); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Image) ? x : ::Io::Flow::V0::Models::Image.new(x))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
21210 21211 21212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21210 def attributes @attributes end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
21210 21211 21212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21210 def description @description end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
21210 21211 21212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21210 def image @image end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
21210 21211 21212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21210 def item @item end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21210 21211 21212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21210 def name @name end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
21226 21227 21228 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21226 def copy(incoming={}) CheckoutItemContent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
21230 21231 21232 21233 21234 21235 21236 21237 21238 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21230 def to_hash { :item => item.to_hash, :name => name, :description => description, :attributes => attributes.map { |o| o.to_hash }, :image => image.nil? ? nil : image.to_hash } end |
#to_json ⇒ Object
21222 21223 21224 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21222 def to_json JSON.dump(to_hash) end |