Class: Io::Flow::V0::Models::ShopifyPrice
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyPrice
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#cents ⇒ Object
readonly
Returns the value of attribute cents.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShopifyPrice
constructor
A new instance of ShopifyPrice.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyPrice
Returns a new instance of ShopifyPrice.
46094 46095 46096 46097 46098 46099 46100 46101 46102 46103 46104 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46094 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :amount, :cents, :currency, :label], 'ShopifyPrice') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric) @cents = HttpClient::Preconditions.assert_class('cents', opts.delete(:cents), Numeric) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String) @includes = (x = opts.delete(:includes); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::IncludedLevies) ? x : ::Io::Flow::V0::Models::IncludedLevies.new(x))) @local = (x = opts.delete(:local); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyLocalPriceMetadata) ? x : ::Io::Flow::V0::Models::ShopifyLocalPriceMetadata.new(x))) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def amount @amount end |
#cents ⇒ Object (readonly)
Returns the value of attribute cents.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def cents @cents end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def currency @currency end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def includes @includes end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def label @label end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def local @local end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
46092 46093 46094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46092 def name @name end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46110 46111 46112 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46110 def copy(incoming={}) ShopifyPrice.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
46114 46115 46116 46117 46118 46119 46120 46121 46122 46123 46124 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46114 def to_hash { :name => name, :amount => amount, :cents => cents, :currency => currency, :label => label, :includes => includes.nil? ? nil : includes.to_hash, :local => local.nil? ? nil : local.to_hash } end |
#to_json ⇒ Object
46106 46107 46108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46106 def to_json JSON.dump(to_hash) end |