Class: Io::Flow::V0::Models::CsvPriceBookItemExportRowBySku

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#amountObject (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_attributesObject (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_nameObject (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_keyObject (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_keyObject (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

#scheduleObject (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

#skuObject (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_hashObject



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_jsonObject



37864
37865
37866
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37864

def to_json
  JSON.dump(to_hash)
end