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.
27974 27975 27976 27977 27978 27979 27980 27981 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27974 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.
27972 27973 27974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27972 def item_number @item_number end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
27972 27973 27974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27972 def price @price end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
27972 27973 27974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27972 def price_book_key @price_book_key end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
27972 27973 27974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27972 def schedule @schedule end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27987 27988 27989 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27987 def copy(incoming={}) PriceBookItemForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27991 27992 27993 27994 27995 27996 27997 27998 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27991 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
27983 27984 27985 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27983 def to_json JSON.dump(to_hash) end |