Class: InventoryManagementAndItemManagementAndOrderManagementAndPriceManagement::Item2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb

Overview

Item2 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(item_id = nil, condition = nil, is_market_place_item = nil, images = nil, customer_rating = nil, price = nil, description = nil, title = nil, brand = nil, product_type = nil, properties = nil) ⇒ Item2

Returns a new instance of Item2.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 84

def initialize(item_id = nil, condition = nil, is_market_place_item = nil,
               images = nil, customer_rating = nil, price = nil,
               description = nil, title = nil, brand = nil,
               product_type = nil, properties = nil)
  @item_id = item_id
  @condition = condition
  @is_market_place_item = is_market_place_item
  @images = images
  @customer_rating = customer_rating
  @price = price
  @description = description
  @title = title
  @brand = brand
  @product_type = product_type
  @properties = properties
end

Instance Attribute Details

#brandString

TODO: Write general description for this method

Returns:

  • (String)


47
48
49
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 47

def brand
  @brand
end

#conditionString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 19

def condition
  @condition
end

#customer_ratingString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 31

def customer_rating
  @customer_rating
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 39

def description
  @description
end

#imagesArray[Image]

TODO: Write general description for this method

Returns:



27
28
29
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 27

def images
  @images
end

#is_market_place_itemString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 23

def is_market_place_item
  @is_market_place_item
end

#item_idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 15

def item_id
  @item_id
end

#pricePrice1

TODO: Write general description for this method

Returns:



35
36
37
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 35

def price
  @price
end

#product_typeString

TODO: Write general description for this method

Returns:

  • (String)


51
52
53
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 51

def product_type
  @product_type
end

#propertiesProperties1

TODO: Write general description for this method

Returns:



55
56
57
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 55

def properties
  @properties
end

#titleString

TODO: Write general description for this method

Returns:

  • (String)


43
44
45
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 43

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('itemId') ? hash['itemId'] : nil
  condition = hash.key?('condition') ? hash['condition'] : nil
  is_market_place_item =
    hash.key?('isMarketPlaceItem') ? hash['isMarketPlaceItem'] : nil
  # Parameter is an array, so we need to iterate through it
  images = nil
  unless hash['images'].nil?
    images = []
    hash['images'].each do |structure|
      images << (Image.from_hash(structure) if structure)
    end
  end

  images = nil unless hash.key?('images')
  customer_rating =
    hash.key?('customerRating') ? hash['customerRating'] : nil
  price = Price1.from_hash(hash['price']) if hash['price']
  description = hash.key?('description') ? hash['description'] : nil
  title = hash.key?('title') ? hash['title'] : nil
  brand = hash.key?('brand') ? hash['brand'] : nil
  product_type = hash.key?('productType') ? hash['productType'] : nil
  properties = Properties1.from_hash(hash['properties']) if hash['properties']

  # Create object from extracted values.
  Item2.new(item_id,
            condition,
            is_market_place_item,
            images,
            customer_rating,
            price,
            description,
            title,
            brand,
            product_type,
            properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_id'] = 'itemId'
  @_hash['condition'] = 'condition'
  @_hash['is_market_place_item'] = 'isMarketPlaceItem'
  @_hash['images'] = 'images'
  @_hash['customer_rating'] = 'customerRating'
  @_hash['price'] = 'price'
  @_hash['description'] = 'description'
  @_hash['title'] = 'title'
  @_hash['brand'] = 'brand'
  @_hash['product_type'] = 'productType'
  @_hash['properties'] = 'properties'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



75
76
77
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 75

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



153
154
155
156
157
158
159
160
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 153

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id.inspect}, condition: #{@condition.inspect},"\
  " is_market_place_item: #{@is_market_place_item.inspect}, images: #{@images.inspect},"\
  " customer_rating: #{@customer_rating.inspect}, price: #{@price.inspect}, description:"\
  " #{@description.inspect}, title: #{@title.inspect}, brand: #{@brand.inspect}, product_type:"\
  " #{@product_type.inspect}, properties: #{@properties.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
150
# File 'lib/inventory_management_and_item_management_and_order_management_and_price_management/models/item2.rb', line 144

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id}, condition: #{@condition}, is_market_place_item:"\
  " #{@is_market_place_item}, images: #{@images}, customer_rating: #{@customer_rating}, price:"\
  " #{@price}, description: #{@description}, title: #{@title}, brand: #{@brand}, product_type:"\
  " #{@product_type}, properties: #{@properties}>"
end