Class: Io::Flow::V0::Models::PriceBookForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PriceBookForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a price book for a specific currency that can override any subset of item prices within an experience.
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PriceBookForm
constructor
A new instance of PriceBookForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PriceBookForm
Returns a new instance of PriceBookForm.
28338 28339 28340 28341 28342 28343 28344 28345 28346 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28338 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:currency, :name, :includes], 'PriceBookForm') @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) @includes = (x = opts.delete(:includes); x.is_a?(::Io::Flow::V0::Models::IncludedLevies) ? x : ::Io::Flow::V0::Models::IncludedLevies.new(x)) @status = (x = (x = opts.delete(:status); x.nil? ? "draft" : x); x.is_a?(::Io::Flow::V0::Models::PriceBookStatus) ? x : ::Io::Flow::V0::Models::PriceBookStatus.apply(x)) end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
28336 28337 28338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28336 def currency @currency end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
28336 28337 28338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28336 def includes @includes end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
28336 28337 28338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28336 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28336 28337 28338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28336 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
28336 28337 28338 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28336 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28352 28353 28354 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28352 def copy(incoming={}) PriceBookForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28356 28357 28358 28359 28360 28361 28362 28363 28364 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28356 def to_hash { :currency => currency, :name => name, :key => key, :includes => includes.to_hash, :status => status.value } end |
#to_json ⇒ Object
28348 28349 28350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28348 def to_json JSON.dump(to_hash) end |