Class: Libring::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/libring/product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sku) ⇒ Product

Returns a new instance of Product.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/libring/product.rb', line 5

def initialize(sku)

  @sku         = sku
  @name        = sku
  @quantity    = 1
  @unit_amount = -1
  @category    = ""

  true

end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



3
4
5
# File 'lib/libring/product.rb', line 3

def category
  @category
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/libring/product.rb', line 3

def name
  @name
end

#quantityObject (readonly)

Returns the value of attribute quantity.



3
4
5
# File 'lib/libring/product.rb', line 3

def quantity
  @quantity
end

#skuObject (readonly)

Returns the value of attribute sku.



3
4
5
# File 'lib/libring/product.rb', line 3

def sku
  @sku
end

#unit_amountObject (readonly)

Returns the value of attribute unit_amount.



3
4
5
# File 'lib/libring/product.rb', line 3

def unit_amount
  @unit_amount
end

Instance Method Details

#set_category(data) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/libring/product.rb', line 25

def set_category(data)

  @category = data

  true

end

#set_name(data) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/libring/product.rb', line 17

def set_name(data)

  @name = data

  true

end

#set_quantity(data) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/libring/product.rb', line 41

def set_quantity(data)

  @quantity = data

  true

end

#set_unit_amount(data) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/libring/product.rb', line 33

def set_unit_amount(data)

  @unit_amount = data

  true

end