Class: Io::Flow::V0::Models::CsvPriceBookItemExportRowBySku
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CsvPriceBookItemExportRowBySku
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#item_attributes ⇒ Object
readonly
Returns the value of attribute item_attributes.
-
#item_name ⇒ Object
readonly
Returns the value of attribute item_name.
-
#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.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CsvPriceBookItemExportRowBySku
constructor
A new instance of CsvPriceBookItemExportRowBySku.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CsvPriceBookItemExportRowBySku
Returns a new instance of CsvPriceBookItemExportRowBySku.
37852 37853 37854 37855 37856 37857 37858 37859 37860 37861 37862 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37852 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:sku, :price_book_key, :price_book_item_key, :item_name, :amount, :schedule], 'CsvPriceBookItemExportRowBySku') @sku = HttpClient::Preconditions.assert_class('sku', opts.delete(:sku), String) @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_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 }) @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
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def amount @amount end |
#item_attributes ⇒ Object (readonly)
Returns the value of attribute item_attributes.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def item_attributes @item_attributes end |
#item_name ⇒ Object (readonly)
Returns the value of attribute item_name.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def item_name @item_name end |
#price_book_item_key ⇒ Object (readonly)
Returns the value of attribute price_book_item_key.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def price_book_item_key @price_book_item_key end |
#price_book_key ⇒ Object (readonly)
Returns the value of attribute price_book_key.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def price_book_key @price_book_key end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def schedule @schedule end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
37850 37851 37852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37850 def sku @sku end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
37868 37869 37870 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37868 def copy(incoming={}) CsvPriceBookItemExportRowBySku.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
37872 37873 37874 37875 37876 37877 37878 37879 37880 37881 37882 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37872 def to_hash { :sku => sku, :price_book_key => price_book_key, :price_book_item_key => price_book_item_key, :item_name => item_name, :amount => amount.to_f.to_s, :item_attributes => item_attributes.nil? ? nil : item_attributes, :schedule => schedule.to_hash } end |
#to_json ⇒ Object
37864 37865 37866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37864 def to_json JSON.dump(to_hash) end |