Class: Io::Flow::V0::Models::CatalogPriceBookItemDocument
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CatalogPriceBookItemDocument
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the returned information for searching particular price book items
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#price_book_item_key ⇒ Object
readonly
Returns the value of attribute price_book_item_key.
-
#price_book_key ⇒ Object
readonly
Returns the value of attribute price_book_key.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CatalogPriceBookItemDocument
constructor
A new instance of CatalogPriceBookItemDocument.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CatalogPriceBookItemDocument
Returns a new instance of CatalogPriceBookItemDocument.
25736 25737 25738 25739 25740 25741 25742 25743 25744 25745 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25736 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)) @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 |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def amount @amount end |
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def catalog @catalog end |
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def ends_at @ends_at end |
#price_book_item_key ⇒ Object (readonly)
Returns the value of attribute price_book_item_key.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def price_book_item_key @price_book_item_key end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def price_book_key @price_book_key end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
25734 25735 25736 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25734 def starts_at @starts_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25751 25752 25753 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25751 def copy(incoming={}) CatalogPriceBookItemDocument.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25755 25756 25757 25758 25759 25760 25761 25762 25763 25764 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25755 def to_hash { :price_book_key => price_book_key, :price_book_item_key => price_book_item_key, :catalog => catalog.to_hash, :amount => amount.to_f.to_s, :starts_at => starts_at, :ends_at => ends_at } end |
#to_json ⇒ Object
25747 25748 25749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25747 def to_json JSON.dump(to_hash) end |