Class: Io::Flow::V0::Models::PriceBookItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PriceBookItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the price of a single item within a price book.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#price_book ⇒ Object
readonly
Returns the value of attribute price_book.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PriceBookItem
constructor
A new instance of PriceBookItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PriceBookItem
Returns a new instance of PriceBookItem.
31183 31184 31185 31186 31187 31188 31189 31190 31191 31192 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31183 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :price_book, :price, :item_number, :schedule], 'PriceBookItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @price_book = (x = opts.delete(:price_book); x.is_a?(::Io::Flow::V0::Models::PriceBookReference) ? x : ::Io::Flow::V0::Models::PriceBookReference.new(x)) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.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
#id ⇒ Object (readonly)
Returns the value of attribute id.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def id @id end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def item_number @item_number end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def key @key end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def price @price end |
#price_book ⇒ Object (readonly)
Returns the value of attribute price_book.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def price_book @price_book end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
31181 31182 31183 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31181 def schedule @schedule end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31198 31199 31200 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31198 def copy(incoming={}) PriceBookItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31202 31203 31204 31205 31206 31207 31208 31209 31210 31211 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31202 def to_hash { :id => id, :key => key, :price_book => price_book.to_hash, :price => price.to_hash, :item_number => item_number, :schedule => schedule.to_hash } end |
#to_json ⇒ Object
31194 31195 31196 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31194 def to_json JSON.dump(to_hash) end |