Class: Io::Flow::V0::Models::CsvPriceBookItemExportRowByItemNumber

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 = {}) ⇒ CsvPriceBookItemExportRowByItemNumber

Returns a new instance of CsvPriceBookItemExportRowByItemNumber.



37814
37815
37816
37817
37818
37819
37820
37821
37822
37823
37824
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37814

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item_number, :price_book_key, :price_book_item_key, :item_name, :amount, :schedule], 'CsvPriceBookItemExportRowByItemNumber')
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), 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.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def amount
  @amount
end

#item_attributesObject (readonly)

Returns the value of attribute item_attributes.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def item_attributes
  @item_attributes
end

#item_nameObject (readonly)

Returns the value of attribute item_name.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def item_name
  @item_name
end

#item_numberObject (readonly)

Returns the value of attribute item_number.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def item_number
  @item_number
end

#price_book_item_keyObject (readonly)

Returns the value of attribute price_book_item_key.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def price_book_item_key
  @price_book_item_key
end

#price_book_keyObject (readonly)

Returns the value of attribute price_book_key.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def price_book_key
  @price_book_key
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



37812
37813
37814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37812

def schedule
  @schedule
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37830
37831
37832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37830

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

#to_hashObject



37834
37835
37836
37837
37838
37839
37840
37841
37842
37843
37844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37834

def to_hash
  {
    :item_number => item_number,
    :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



37826
37827
37828
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37826

def to_json
  JSON.dump(to_hash)
end