class Io::Flow::V0::Models::PriceBookItem
Represents the price of a single item within a price book.
Attributes
id[R]
item_attributes[R]
item_number[R]
key[R]
price[R]
price_book[R]
schedule[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59951 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)) @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
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59967 def copy(incoming={}) PriceBookItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59971 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, :item_attributes => item_attributes.nil? ? nil : item_attributes } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 59963 def to_json JSON.dump(to_hash) end