Class: Io::Flow::V0::Models::CsvPriceBookItemExportRow
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CsvPriceBookItemExportRow
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the format used to export price book item documents
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#item_attributes ⇒ Object
readonly
Returns the value of attribute item_attributes.
-
#item_name ⇒ Object
readonly
Returns the value of attribute item_name.
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#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 = {}) ⇒ CsvPriceBookItemExportRow
constructor
A new instance of CsvPriceBookItemExportRow.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CsvPriceBookItemExportRow
Returns a new instance of CsvPriceBookItemExportRow.
27263 27264 27265 27266 27267 27268 27269 27270 27271 27272 27273 27274 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27263 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price_book_key, :price_book_item_key, :item_number, :item_name, :amount, :starts_at], 'CsvPriceBookItemExportRow') @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) @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @item_name = HttpClient::Preconditions.assert_class('item_name', opts.delete(:item_name), String) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @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 }) @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.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def amount @amount end |
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def ends_at @ends_at end |
#item_attributes ⇒ Object (readonly)
Returns the value of attribute item_attributes.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def item_attributes @item_attributes end |
#item_name ⇒ Object (readonly)
Returns the value of attribute item_name.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def item_name @item_name end |
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def item_number @item_number end |
#price_book_item_key ⇒ Object (readonly)
Returns the value of attribute price_book_item_key.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def price_book_item_key @price_book_item_key end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def price_book_key @price_book_key end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
27261 27262 27263 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27261 def starts_at @starts_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
27280 27281 27282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27280 def copy(incoming={}) CsvPriceBookItemExportRow.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
27284 27285 27286 27287 27288 27289 27290 27291 27292 27293 27294 27295 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27284 def to_hash { :price_book_key => price_book_key, :price_book_item_key => price_book_item_key, :item_number => item_number, :item_name => item_name, :amount => amount.to_f.to_s, :item_attributes => item_attributes.nil? ? nil : item_attributes, :starts_at => starts_at, :ends_at => ends_at } end |
#to_json ⇒ Object
27276 27277 27278 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27276 def to_json JSON.dump(to_hash) end |