Class: Io::Flow::V0::Models::PriceBookItemForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PriceBookItemForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the form to create an item in a pricebook.
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_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#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 = {}) ⇒ PriceBookItemForm
constructor
A new instance of PriceBookItemForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PriceBookItemForm
Returns a new instance of PriceBookItemForm.
39429 39430 39431 39432 39433 39434 39435 39436 39437 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39429 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price_book_key, :item_number, :amount], 'PriceBookItemForm') @price_book_key = HttpClient::Preconditions.assert_class('price_book_key', opts.delete(:price_book_key), String) @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), 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.
39427 39428 39429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39427 def amount @amount end |
#item_attributes ⇒ Object (readonly)
Returns the value of attribute item_attributes.
39427 39428 39429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39427 def item_attributes @item_attributes end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
39427 39428 39429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39427 def item_number @item_number end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
39427 39428 39429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39427 def price_book_key @price_book_key end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
39427 39428 39429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39427 def schedule @schedule end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39443 39444 39445 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39443 def copy(incoming={}) PriceBookItemForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39447 39448 39449 39450 39451 39452 39453 39454 39455 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39447 def to_hash { :price_book_key => price_book_key, :item_number => item_number, :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
39439 39440 39441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39439 def to_json JSON.dump(to_hash) end |