Class: Io::Flow::V0::Models::PriceBookItemQueryForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PriceBookItemQueryForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Used to create price book items for multiple items matching a query
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#item_attributes ⇒ Object
readonly
Returns the value of attribute item_attributes.
-
#item_query ⇒ Object
readonly
Returns the value of attribute item_query.
-
#price_book_key ⇒ Object
readonly
Returns the value of attribute price_book_key.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PriceBookItemQueryForm
constructor
A new instance of PriceBookItemQueryForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PriceBookItemQueryForm
Returns a new instance of PriceBookItemQueryForm.
60120 60121 60122 60123 60124 60125 60126 60127 60128 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60120 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price_book_key, :item_query, :amount], 'PriceBookItemQueryForm') @price_book_key = HttpClient::Preconditions.assert_class('price_book_key', opts.delete(:price_book_key), String) @item_query = HttpClient::Preconditions.assert_class('item_query', opts.delete(:item_query), String) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @schedule = (x = opts.delete(:schedule); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceBookItemSchedule) ? x : ::Io::Flow::V0::Models::PriceBookItemSchedule.new(x))) @item_attributes = (x = opts.delete(:item_attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('item_attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('item_attributes', d[1], String); h }) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
60118 60119 60120 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60118 def amount @amount end |
#item_attributes ⇒ Object (readonly)
Returns the value of attribute item_attributes.
60118 60119 60120 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60118 def item_attributes @item_attributes end |
#item_query ⇒ Object (readonly)
Returns the value of attribute item_query.
60118 60119 60120 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60118 def item_query @item_query end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
60118 60119 60120 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60118 def price_book_key @price_book_key end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
60118 60119 60120 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60118 def schedule @schedule end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
60134 60135 60136 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60134 def copy(incoming={}) PriceBookItemQueryForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
60138 60139 60140 60141 60142 60143 60144 60145 60146 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60138 def to_hash { :price_book_key => price_book_key, :item_query => item_query, :amount => amount.to_f.to_s, :schedule => schedule.nil? ? nil : schedule.to_hash, :item_attributes => item_attributes.nil? ? nil : item_attributes } end |
#to_json ⇒ Object
60130 60131 60132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60130 def to_json JSON.dump(to_hash) end |