Sha256: 209b87c13173340227cd8a25a122039e2146a94a7174e36625e2d45b09f8592c

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

# -----------------------------------------------------------------------
#  Copyright © 2012 ShepHertz Technologies Pvt Ltd. All rights reserved.
# -----------------------------------------------------------------------

require 'App42Response.rb'

#
#
# This Catalogue object is the value object which contains the properties of
# Catalogue.
#
#

module App42
  module Shopping
    class Catalogue < App42Response
      attr_accessor :name, :description, :categoryList

      @name
      @description
      @categoryList = Array.new
    end

    class Category
      attr_accessor :name, :description, :itemList

      @name
      @description
      @itemList = Array.new

      #
      # This is a constructor that takes no parameter
      #
      #
      def initialize(catalogue)
        catalogue.categoryList.push(self)
      end

      #
      # Returns the Cart Response in JSON format.
      #
      # @return the response in JSON format.
      #

      def to_s
        return "name : #{@name}" + "description : #{@description}";
      end
    end

    class Item
      attr_accessor :itemId, :name, :description, :url, :price, :tinyUrl

      @itemId
      @name
      @description
      @url
      @price
      @tinyUrl

      #
      #  This is a constructor that takes no parameter
      #
      def initialize(category)
        category.itemList.push(self)
      end

      #
      # Returns the Cart Response in JSON format.
      #
      # @return the response in JSON format.
      #
      #

      def toString
        return "itemId : #{@itemId}" + "name : #{@name}" + "description : #{@description}" + "url : #{@url}" + "price : #{@price}";
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
App42_RUBY_SDK-0.8.3 lib/shopping/Catalogue.rb