Class: Kount::RIS::Product

Inherits:
Base
  • Object
show all
Defined in:
app/models/kount/ris/product.rb

Constant Summary

Constants inherited from Base

Base::COUNTRY_CODES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Product

Returns a new instance of Product.



12
13
14
15
16
# File 'app/models/kount/ris/product.rb', line 12

def initialize(attrs)
  attrs.symbolize_keys!
  attrs.reverse_merge!({ quantity: 1 })
  super(attrs)
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'app/models/kount/ris/product.rb', line 4

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'app/models/kount/ris/product.rb', line 4

def description
  @description
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'app/models/kount/ris/product.rb', line 4

def id
  @id
end

#priceObject

Returns the value of attribute price.



4
5
6
# File 'app/models/kount/ris/product.rb', line 4

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



4
5
6
# File 'app/models/kount/ris/product.rb', line 4

def quantity
  @quantity
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
26
# File 'app/models/kount/ris/product.rb', line 18

def to_h
  {
    description: description,
    id: id,
    price: price,
    quantity: quantity,
    category: category,
  }
end