class App42::Shopping::Item

Attributes

description[RW]
image[RW]
itemId[RW]
name[RW]
price[RW]
quantity[RW]
tinyUrl[RW]
totalAmount[RW]
url[RW]

Public Class Methods

new(cart) click to toggle source

This is a constructor that takes no parameter

# File lib/shopping/Cart.rb, line 45
def initialize(cart)
  cart.itemList.push(self)
end

Public Instance Methods

toString() click to toggle source

Returns the Cart Response in JSON format.

@return the response in JSON format.

# File lib/shopping/Catalogue.rb, line 74
def toString
  return "itemId : #{@itemId}" + "name : #{@name}" + "description : #{@description}" + "url : #{@url}" + "price : #{@price}";
end
to_s() click to toggle source

Returns the Cart Response in JSON format.

@return the response in JSON format.

# File lib/shopping/Cart.rb, line 55
def to_s
  return "name : #{@name}" + "itemId : #{@itemId}" + "price : #{@price}" + "quantity : #{@quantity}";
end