Class: App42::Shopping::Item
- Inherits:
-
Object
- Object
- App42::Shopping::Item
- Defined in:
- lib/shopping/Cart.rb,
lib/shopping/Catalogue.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#image ⇒ Object
Returns the value of attribute image.
-
#itemId ⇒ Object
Returns the value of attribute itemId.
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#tinyUrl ⇒ Object
Returns the value of attribute tinyUrl.
-
#totalAmount ⇒ Object
Returns the value of attribute totalAmount.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(category) ⇒ Item
constructor
This is a constructor that takes no parameter.
-
#to_s ⇒ Object
Returns the Cart Response in JSON format.
-
#toString ⇒ Object
Returns the Cart Response in JSON format.
Constructor Details
#initialize(category) ⇒ Item
This is a constructor that takes no parameter
45 46 47 |
# File 'lib/shopping/Cart.rb', line 45 def initialize(cart) cart.itemList.push(self) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
51 52 53 |
# File 'lib/shopping/Catalogue.rb', line 51 def description @description end |
#image ⇒ Object
Returns the value of attribute image.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def image @image end |
#itemId ⇒ Object
Returns the value of attribute itemId.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def itemId @itemId end |
#name ⇒ Object
Returns the value of attribute name.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def quantity @quantity end |
#tinyUrl ⇒ Object
Returns the value of attribute tinyUrl.
51 52 53 |
# File 'lib/shopping/Catalogue.rb', line 51 def tinyUrl @tinyUrl end |
#totalAmount ⇒ Object
Returns the value of attribute totalAmount.
32 33 34 |
# File 'lib/shopping/Cart.rb', line 32 def totalAmount @totalAmount end |
#url ⇒ Object
Returns the value of attribute url.
51 52 53 |
# File 'lib/shopping/Catalogue.rb', line 51 def url @url end |
Instance Method Details
#to_s ⇒ Object
Returns the Cart Response in JSON format.
55 56 57 |
# File 'lib/shopping/Cart.rb', line 55 def to_s return "name : #{@name}" + "itemId : #{@itemId}" + "price : #{@price}" + "quantity : #{@quantity}"; end |
#toString ⇒ Object
Returns the Cart Response in JSON format.
74 75 76 |
# File 'lib/shopping/Catalogue.rb', line 74 def toString return "itemId : #{@itemId}" + "name : #{@name}" + "description : #{@description}" + "url : #{@url}" + "price : #{@price}"; end |