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
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#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.
27431 27432 27433 27434 27435 27436 27437 27438 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27431 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price_book_key, :price, :item_number, :schedule], 'PriceBookItemForm') @price_book_key = HttpClient::Preconditions.assert_class('price_book_key', opts.delete(:price_book_key), String) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x)) @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @schedule = (x = opts.delete(:schedule); x.is_a?(::Io::Flow::V0::Models::PriceBookItemSchedule) ? x : ::Io::Flow::V0::Models::PriceBookItemSchedule.new(x)) end |
Instance Attribute Details
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
27429 27430 27431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27429 def item_number @item_number end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
27429 27430 27431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27429 def price @price end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
27429 27430 27431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27429 def price_book_key @price_book_key end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
27429 27430 27431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27429 def schedule @schedule end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27444 27445 27446 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27444 def copy(incoming={}) PriceBookItemForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27448 27449 27450 27451 27452 27453 27454 27455 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27448 def to_hash { :price_book_key => price_book_key, :price => price.to_hash, :item_number => item_number, :schedule => schedule.to_hash } end |
#to_json ⇒ Object
27440 27441 27442 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27440 def to_json JSON.dump(to_hash) end |