Class: WalmartApIs::ItemSummaryByMarketplace

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/item_summary_by_marketplace.rb

Overview

ItemSummaryByMarketplace 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(marketplace_id: SKIP, walmart_item_id: SKIP, product_type: SKIP, condition_type: SKIP, status: SKIP, item_name: SKIP, created_date: SKIP, last_updated_date: SKIP, main_image: SKIP, additional_properties: nil) ⇒ ItemSummaryByMarketplace

Returns a new instance of ItemSummaryByMarketplace.



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

def initialize(marketplace_id: SKIP, walmart_item_id: SKIP,
               product_type: SKIP, condition_type: SKIP, status: SKIP,
               item_name: SKIP, created_date: SKIP, last_updated_date: SKIP,
               main_image: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @marketplace_id = marketplace_id unless marketplace_id == SKIP
  @walmart_item_id = walmart_item_id unless walmart_item_id == SKIP
  @product_type = product_type unless product_type == SKIP
  @condition_type = condition_type unless condition_type == SKIP
  @status = status unless status == SKIP
  @item_name = item_name unless item_name == SKIP
  @created_date = created_date unless created_date == SKIP
  @last_updated_date = last_updated_date unless last_updated_date == SKIP
  @main_image = main_image unless main_image == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#condition_typeConditionType

TODO: Write general description for this method

Returns:



27
28
29
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 27

def condition_type
  @condition_type
end

#created_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


39
40
41
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 39

def created_date
  @created_date
end

#item_nameString

TODO: Write general description for this method

Returns:

  • (String)


35
36
37
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 35

def item_name
  @item_name
end

#last_updated_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


43
44
45
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 43

def last_updated_date
  @last_updated_date
end

#main_imageItemImage1

TODO: Write general description for this method

Returns:



47
48
49
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 47

def main_image
  @main_image
end

#marketplace_idMarketplaceId

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 15

def marketplace_id
  @marketplace_id
end

#product_typeString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 23

def product_type
  @product_type
end

#statusStatus

TODO: Write general description for this method

Returns:



31
32
33
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 31

def status
  @status
end

#walmart_item_idString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 19

def walmart_item_id
  @walmart_item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
142
143
144
145
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  marketplace_id = hash.key?('marketplaceId') ? hash['marketplaceId'] : SKIP
  walmart_item_id =
    hash.key?('walmartItemId') ? hash['walmartItemId'] : SKIP
  product_type = hash.key?('productType') ? hash['productType'] : SKIP
  condition_type = hash.key?('conditionType') ? hash['conditionType'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  item_name = hash.key?('itemName') ? hash['itemName'] : SKIP
  created_date = if hash.key?('createdDate')
                   (DateTimeHelper.from_rfc3339(hash['createdDate']) if hash['createdDate'])
                 else
                   SKIP
                 end
  last_updated_date = if hash.key?('lastUpdatedDate')
                        (DateTimeHelper.from_rfc3339(hash['lastUpdatedDate']) if hash['lastUpdatedDate'])
                      else
                        SKIP
                      end
  main_image = ItemImage1.from_hash(hash['mainImage']) if hash['mainImage']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ItemSummaryByMarketplace.new(marketplace_id: marketplace_id,
                               walmart_item_id: walmart_item_id,
                               product_type: product_type,
                               condition_type: condition_type,
                               status: status,
                               item_name: item_name,
                               created_date: created_date,
                               last_updated_date: last_updated_date,
                               main_image: main_image,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['marketplace_id'] = 'marketplaceId'
  @_hash['walmart_item_id'] = 'walmartItemId'
  @_hash['product_type'] = 'productType'
  @_hash['condition_type'] = 'conditionType'
  @_hash['status'] = 'status'
  @_hash['item_name'] = 'itemName'
  @_hash['created_date'] = 'createdDate'
  @_hash['last_updated_date'] = 'lastUpdatedDate'
  @_hash['main_image'] = 'mainImage'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 65

def self.optionals
  %w[
    marketplace_id
    walmart_item_id
    product_type
    condition_type
    status
    item_name
    created_date
    last_updated_date
    main_image
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



166
167
168
169
170
171
172
173
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 166

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id.inspect}, walmart_item_id:"\
  " #{@walmart_item_id.inspect}, product_type: #{@product_type.inspect}, condition_type:"\
  " #{@condition_type.inspect}, status: #{@status.inspect}, item_name: #{@item_name.inspect},"\
  " created_date: #{@created_date.inspect}, last_updated_date: #{@last_updated_date.inspect},"\
  " main_image: #{@main_image.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_created_dateObject



147
148
149
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 147

def to_custom_created_date
  DateTimeHelper.to_rfc3339(created_date)
end

#to_custom_last_updated_dateObject



151
152
153
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 151

def to_custom_last_updated_date
  DateTimeHelper.to_rfc3339(last_updated_date)
end

#to_sObject

Provides a human-readable string representation of the object.



156
157
158
159
160
161
162
163
# File 'lib/walmart_ap_is/models/item_summary_by_marketplace.rb', line 156

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id}, walmart_item_id: #{@walmart_item_id},"\
  " product_type: #{@product_type}, condition_type: #{@condition_type}, status: #{@status},"\
  " item_name: #{@item_name}, created_date: #{@created_date}, last_updated_date:"\
  " #{@last_updated_date}, main_image: #{@main_image}, additional_properties:"\
  " #{@additional_properties}>"
end