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.



34710
34711
34712
34713
34714
34715
34716
34717
34718
34719
34720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34710

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.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def amount
  @amount
end

#item_attributesObject (readonly)

Returns the value of attribute item_attributes.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def item_attributes
  @item_attributes
end

#item_nameObject (readonly)

Returns the value of attribute item_name.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def item_name
  @item_name
end

#price_book_item_keyObject (readonly)

Returns the value of attribute price_book_item_key.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def price_book_item_key
  @price_book_item_key
end

#price_book_keyObject (readonly)

Returns the value of attribute price_book_key.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def price_book_key
  @price_book_key
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def schedule
  @schedule
end

#skuObject (readonly)

Returns the value of attribute sku.



34708
34709
34710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34708

def sku
  @sku
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34726
34727
34728
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34726

def copy(incoming={})
  CsvPriceBookItemExportRowBySku.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



34730
34731
34732
34733
34734
34735
34736
34737
34738
34739
34740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34730

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



34722
34723
34724
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34722

def to_json
  JSON.dump(to_hash)
end