Class: ProcessingKz::GoodsItem

Inherits:
Object
  • Object
show all
Defined in:
lib/processing_kz/goods_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ GoodsItem

Returns a new instance of GoodsItem.



9
10
11
12
13
14
# File 'lib/processing_kz/goods_item.rb', line 9

def initialize(args = {})
  @currency_code = args[:currency_code] || Config.currency_code
  @title = args[:title]
  @good_id = args[:good_id]
  @amount = (args[:amount] * 100).to_i
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



4
5
6
# File 'lib/processing_kz/goods_item.rb', line 4

def amount
  @amount
end

#currency_codeObject (readonly)

Returns the value of attribute currency_code.



4
5
6
# File 'lib/processing_kz/goods_item.rb', line 4

def currency_code
  @currency_code
end

#good_idObject (readonly)

Returns the value of attribute good_id.



4
5
6
# File 'lib/processing_kz/goods_item.rb', line 4

def good_id
  @good_id
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/processing_kz/goods_item.rb', line 4

def title
  @title
end

Instance Method Details

#merchants_goods_idObject



16
17
18
# File 'lib/processing_kz/goods_item.rb', line 16

def merchants_goods_id
  @good_id
end

#name_of_goodsObject



20
21
22
# File 'lib/processing_kz/goods_item.rb', line 20

def name_of_goods
  @title
end

#to_hashObject



24
25
26
# File 'lib/processing_kz/goods_item.rb', line 24

def to_hash
  { currency_code: @currency_code, name_of_goods: name_of_goods, merchants_goods_id: merchants_goods_id, amount: @amount }
end