class Io::Flow::V0::Models::CatalogPriceBookItemDocument
Represents the returned information for searching particular price book items
Attributes
amount[R]
catalog[R]
ends_at[R]
price[R]
price_book_item_key[R]
price_book_key[R]
starts_at[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34276 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price_book_key, :price_book_item_key, :catalog, :amount, :starts_at], 'CatalogPriceBookItemDocument') @price_book_key = HttpClient::Preconditions.assert_class('price_book_key', opts.delete(:price_book_key), String) @price_book_item_key = HttpClient::Preconditions.assert_class('price_book_item_key', opts.delete(:price_book_item_key), String) @catalog = (x = opts.delete(:catalog); x.is_a?(::Io::Flow::V0::Models::CatalogItemSummary) ? x : ::Io::Flow::V0::Models::CatalogItemSummary.new(x)) @price = (x = opts.delete(:price); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @starts_at = HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:starts_at)), DateTime) @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34292 def copy(incoming={}) CatalogPriceBookItemDocument.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 34296 def to_hash { :price_book_key => price_book_key, :price_book_item_key => price_book_item_key, :catalog => catalog.to_hash, :price => price.nil? ? nil : price.to_hash, :amount => amount.to_f.to_s, :starts_at => starts_at, :ends_at => ends_at } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34288 def to_json JSON.dump(to_hash) end