aliseeks_api 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +171 -0
  5. data/Rakefile +10 -0
  6. data/aliseeks_api.gemspec +45 -0
  7. data/docs/Amount.md +9 -0
  8. data/docs/BestSellingSearchItem.md +15 -0
  9. data/docs/BestSellingSearchRequest.md +12 -0
  10. data/docs/BestSellingSearchResponse.md +8 -0
  11. data/docs/DoubleRange.md +9 -0
  12. data/docs/ImageSearchCategory.md +9 -0
  13. data/docs/ImageSearchItem.md +12 -0
  14. data/docs/ImageSearchRequest.md +12 -0
  15. data/docs/ImageSearchResponse.md +10 -0
  16. data/docs/IntegerRange.md +9 -0
  17. data/docs/NonRealtimeCurrency.md +7 -0
  18. data/docs/PriceRange.md +9 -0
  19. data/docs/PriceSummary.md +13 -0
  20. data/docs/Product.md +28 -0
  21. data/docs/ProductAttribute.md +11 -0
  22. data/docs/ProductBulkOption.md +10 -0
  23. data/docs/ProductDetail.md +24 -0
  24. data/docs/ProductDetailsRequest.md +12 -0
  25. data/docs/ProductHtmlDescription.md +8 -0
  26. data/docs/ProductHtmlDescriptionRequest.md +8 -0
  27. data/docs/ProductPriceOption.md +14 -0
  28. data/docs/ProductPromotion.md +9 -0
  29. data/docs/ProductPropertyVariationIdentifier.md +10 -0
  30. data/docs/ProductRequest.md +15 -0
  31. data/docs/ProductRequestComponent.md +7 -0
  32. data/docs/ProductReview.md +18 -0
  33. data/docs/ProductReviews.md +17 -0
  34. data/docs/ProductReviewsRequest.md +10 -0
  35. data/docs/ProductSeller.md +12 -0
  36. data/docs/ProductShipping.md +8 -0
  37. data/docs/ProductShippingOptions.md +15 -0
  38. data/docs/ProductShippingRequest.md +12 -0
  39. data/docs/ProductSku.md +16 -0
  40. data/docs/ProductSkus.md +8 -0
  41. data/docs/ProductSkusRequest.md +11 -0
  42. data/docs/ProductsApi.md +316 -0
  43. data/docs/PromotionOption.md +12 -0
  44. data/docs/RealtimeCurrency.md +7 -0
  45. data/docs/RealtimeSearchAggregation.md +9 -0
  46. data/docs/RealtimeSearchItem.md +14 -0
  47. data/docs/RealtimeSearchRequest.md +14 -0
  48. data/docs/RealtimeSearchResponse.md +9 -0
  49. data/docs/SearchAggregation.md +11 -0
  50. data/docs/SearchApi.md +263 -0
  51. data/docs/SearchItem.md +20 -0
  52. data/docs/SearchItemFreight.md +9 -0
  53. data/docs/SearchItemFreightType.md +8 -0
  54. data/docs/SearchItemSeller.md +13 -0
  55. data/docs/SearchPriceOption.md +10 -0
  56. data/docs/SearchRequest.md +24 -0
  57. data/docs/SearchResponse.md +9 -0
  58. data/docs/SkuPriceOption.md +16 -0
  59. data/docs/SkuPriceOptionProperty.md +13 -0
  60. data/docs/SkuProperty.md +10 -0
  61. data/docs/SkuPropertyValue.md +10 -0
  62. data/docs/StringRange.md +9 -0
  63. data/docs/TimeDuration.md +11 -0
  64. data/docs/TradeInformation.md +9 -0
  65. data/docs/UploadImageByUrlRequest.md +8 -0
  66. data/docs/UploadImageResponse.md +8 -0
  67. data/docs/WebError.md +11 -0
  68. data/git_push.sh +55 -0
  69. data/lib/aliseeks_api.rb +100 -0
  70. data/lib/aliseeks_api/api/products_api.rb +337 -0
  71. data/lib/aliseeks_api/api/search_api.rb +288 -0
  72. data/lib/aliseeks_api/api_client.rb +389 -0
  73. data/lib/aliseeks_api/api_error.rb +38 -0
  74. data/lib/aliseeks_api/configuration.rb +251 -0
  75. data/lib/aliseeks_api/models/amount.rb +195 -0
  76. data/lib/aliseeks_api/models/best_selling_search_item.rb +257 -0
  77. data/lib/aliseeks_api/models/best_selling_search_request.rb +278 -0
  78. data/lib/aliseeks_api/models/best_selling_search_response.rb +187 -0
  79. data/lib/aliseeks_api/models/double_range.rb +193 -0
  80. data/lib/aliseeks_api/models/image_search_category.rb +195 -0
  81. data/lib/aliseeks_api/models/image_search_item.rb +224 -0
  82. data/lib/aliseeks_api/models/image_search_request.rb +240 -0
  83. data/lib/aliseeks_api/models/image_search_response.rb +209 -0
  84. data/lib/aliseeks_api/models/integer_range.rb +193 -0
  85. data/lib/aliseeks_api/models/non_realtime_currency.rb +48 -0
  86. data/lib/aliseeks_api/models/price_range.rb +193 -0
  87. data/lib/aliseeks_api/models/price_summary.rb +229 -0
  88. data/lib/aliseeks_api/models/product.rb +422 -0
  89. data/lib/aliseeks_api/models/product_attribute.rb +215 -0
  90. data/lib/aliseeks_api/models/product_bulk_option.rb +204 -0
  91. data/lib/aliseeks_api/models/product_detail.rb +353 -0
  92. data/lib/aliseeks_api/models/product_details_request.rb +230 -0
  93. data/lib/aliseeks_api/models/product_html_description.rb +185 -0
  94. data/lib/aliseeks_api/models/product_html_description_request.rb +185 -0
  95. data/lib/aliseeks_api/models/product_price_option.rb +240 -0
  96. data/lib/aliseeks_api/models/product_promotion.rb +194 -0
  97. data/lib/aliseeks_api/models/product_property_variation_identifier.rb +205 -0
  98. data/lib/aliseeks_api/models/product_request.rb +288 -0
  99. data/lib/aliseeks_api/models/product_request_component.rb +31 -0
  100. data/lib/aliseeks_api/models/product_review.rb +287 -0
  101. data/lib/aliseeks_api/models/product_reviews.rb +270 -0
  102. data/lib/aliseeks_api/models/product_reviews_request.rb +235 -0
  103. data/lib/aliseeks_api/models/product_seller.rb +225 -0
  104. data/lib/aliseeks_api/models/product_shipping.rb +187 -0
  105. data/lib/aliseeks_api/models/product_shipping_options.rb +253 -0
  106. data/lib/aliseeks_api/models/product_shipping_request.rb +256 -0
  107. data/lib/aliseeks_api/models/product_sku.rb +266 -0
  108. data/lib/aliseeks_api/models/product_skus.rb +187 -0
  109. data/lib/aliseeks_api/models/product_skus_request.rb +218 -0
  110. data/lib/aliseeks_api/models/promotion_option.rb +222 -0
  111. data/lib/aliseeks_api/models/realtime_currency.rb +45 -0
  112. data/lib/aliseeks_api/models/realtime_search_aggregation.rb +197 -0
  113. data/lib/aliseeks_api/models/realtime_search_item.rb +246 -0
  114. data/lib/aliseeks_api/models/realtime_search_request.rb +304 -0
  115. data/lib/aliseeks_api/models/realtime_search_response.rb +196 -0
  116. data/lib/aliseeks_api/models/search_aggregation.rb +215 -0
  117. data/lib/aliseeks_api/models/search_item.rb +304 -0
  118. data/lib/aliseeks_api/models/search_item_freight.rb +194 -0
  119. data/lib/aliseeks_api/models/search_item_freight_type.rb +185 -0
  120. data/lib/aliseeks_api/models/search_item_seller.rb +235 -0
  121. data/lib/aliseeks_api/models/search_price_option.rb +203 -0
  122. data/lib/aliseeks_api/models/search_request.rb +441 -0
  123. data/lib/aliseeks_api/models/search_response.rb +196 -0
  124. data/lib/aliseeks_api/models/sku_price_option.rb +264 -0
  125. data/lib/aliseeks_api/models/sku_price_option_property.rb +235 -0
  126. data/lib/aliseeks_api/models/sku_property.rb +207 -0
  127. data/lib/aliseeks_api/models/sku_property_value.rb +205 -0
  128. data/lib/aliseeks_api/models/string_range.rb +193 -0
  129. data/lib/aliseeks_api/models/time_duration.rb +211 -0
  130. data/lib/aliseeks_api/models/trade_information.rb +195 -0
  131. data/lib/aliseeks_api/models/upload_image_by_url_request.rb +185 -0
  132. data/lib/aliseeks_api/models/upload_image_response.rb +185 -0
  133. data/lib/aliseeks_api/models/web_error.rb +211 -0
  134. data/lib/aliseeks_api/version.rb +15 -0
  135. data/spec/api/products_api_spec.rb +101 -0
  136. data/spec/api/search_api_spec.rb +90 -0
  137. data/spec/api_client_spec.rb +226 -0
  138. data/spec/configuration_spec.rb +42 -0
  139. data/spec/models/amount_spec.rb +47 -0
  140. data/spec/models/best_selling_search_item_spec.rb +83 -0
  141. data/spec/models/best_selling_search_request_spec.rb +73 -0
  142. data/spec/models/best_selling_search_response_spec.rb +41 -0
  143. data/spec/models/double_range_spec.rb +47 -0
  144. data/spec/models/image_search_category_spec.rb +47 -0
  145. data/spec/models/image_search_item_spec.rb +65 -0
  146. data/spec/models/image_search_request_spec.rb +65 -0
  147. data/spec/models/image_search_response_spec.rb +53 -0
  148. data/spec/models/integer_range_spec.rb +47 -0
  149. data/spec/models/non_realtime_currency_spec.rb +35 -0
  150. data/spec/models/price_range_spec.rb +47 -0
  151. data/spec/models/price_summary_spec.rb +71 -0
  152. data/spec/models/product_attribute_spec.rb +59 -0
  153. data/spec/models/product_bulk_option_spec.rb +53 -0
  154. data/spec/models/product_detail_spec.rb +137 -0
  155. data/spec/models/product_details_request_spec.rb +65 -0
  156. data/spec/models/product_html_description_request_spec.rb +41 -0
  157. data/spec/models/product_html_description_spec.rb +41 -0
  158. data/spec/models/product_price_option_spec.rb +77 -0
  159. data/spec/models/product_promotion_spec.rb +47 -0
  160. data/spec/models/product_property_variation_identifier_spec.rb +53 -0
  161. data/spec/models/product_request_component_spec.rb +35 -0
  162. data/spec/models/product_request_spec.rb +83 -0
  163. data/spec/models/product_review_spec.rb +101 -0
  164. data/spec/models/product_reviews_request_spec.rb +53 -0
  165. data/spec/models/product_reviews_spec.rb +95 -0
  166. data/spec/models/product_seller_spec.rb +65 -0
  167. data/spec/models/product_shipping_options_spec.rb +83 -0
  168. data/spec/models/product_shipping_request_spec.rb +65 -0
  169. data/spec/models/product_shipping_spec.rb +41 -0
  170. data/spec/models/product_sku_spec.rb +89 -0
  171. data/spec/models/product_skus_request_spec.rb +59 -0
  172. data/spec/models/product_skus_spec.rb +41 -0
  173. data/spec/models/product_spec.rb +165 -0
  174. data/spec/models/promotion_option_spec.rb +65 -0
  175. data/spec/models/realtime_currency_spec.rb +35 -0
  176. data/spec/models/realtime_search_aggregation_spec.rb +47 -0
  177. data/spec/models/realtime_search_item_spec.rb +77 -0
  178. data/spec/models/realtime_search_request_spec.rb +81 -0
  179. data/spec/models/realtime_search_response_spec.rb +47 -0
  180. data/spec/models/search_aggregation_spec.rb +59 -0
  181. data/spec/models/search_item_freight_spec.rb +47 -0
  182. data/spec/models/search_item_freight_type_spec.rb +41 -0
  183. data/spec/models/search_item_seller_spec.rb +71 -0
  184. data/spec/models/search_item_spec.rb +113 -0
  185. data/spec/models/search_price_option_spec.rb +53 -0
  186. data/spec/models/search_request_spec.rb +145 -0
  187. data/spec/models/search_response_spec.rb +47 -0
  188. data/spec/models/sku_price_option_property_spec.rb +71 -0
  189. data/spec/models/sku_price_option_spec.rb +89 -0
  190. data/spec/models/sku_property_spec.rb +53 -0
  191. data/spec/models/sku_property_value_spec.rb +53 -0
  192. data/spec/models/string_range_spec.rb +47 -0
  193. data/spec/models/time_duration_spec.rb +59 -0
  194. data/spec/models/trade_information_spec.rb +47 -0
  195. data/spec/models/upload_image_by_url_request_spec.rb +41 -0
  196. data/spec/models/upload_image_response_spec.rb +41 -0
  197. data/spec/models/web_error_spec.rb +59 -0
  198. data/spec/spec_helper.rb +111 -0
  199. metadata +485 -0
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Aliseeks API
3
+
4
+ #AliExpress product searching and product details retrieval API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AliseeksApi
16
+ # The search item in a realtime image search
17
+ class ImageSearchItem
18
+ # AliExpress product ID
19
+ attr_accessor :id
20
+
21
+ # The title / subject of the AliExpress product
22
+ attr_accessor :title
23
+
24
+ # The image of the item
25
+ attr_accessor :image_url
26
+
27
+ attr_accessor :price
28
+
29
+ # The orders of the item
30
+ attr_accessor :orders
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'id' => :'id',
36
+ :'title' => :'title',
37
+ :'image_url' => :'imageUrl',
38
+ :'price' => :'price',
39
+ :'orders' => :'orders'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'id' => :'String',
47
+ :'title' => :'String',
48
+ :'image_url' => :'String',
49
+ :'price' => :'Amount',
50
+ :'orders' => :'Integer'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'id')
63
+ self.id = attributes[:'id']
64
+ end
65
+
66
+ if attributes.has_key?(:'title')
67
+ self.title = attributes[:'title']
68
+ end
69
+
70
+ if attributes.has_key?(:'imageUrl')
71
+ self.image_url = attributes[:'imageUrl']
72
+ end
73
+
74
+ if attributes.has_key?(:'price')
75
+ self.price = attributes[:'price']
76
+ end
77
+
78
+ if attributes.has_key?(:'orders')
79
+ self.orders = attributes[:'orders']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ id == o.id &&
102
+ title == o.title &&
103
+ image_url == o.image_url &&
104
+ price == o.price &&
105
+ orders == o.orders
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [id, title, image_url, price, orders].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :BOOLEAN
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ temp_model = AliseeksApi.const_get(type).new
178
+ temp_model.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Aliseeks API
3
+
4
+ #AliExpress product searching and product details retrieval API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module AliseeksApi
16
+ # The search request body for searching AliExpress by image
17
+ class ImageSearchRequest
18
+ attr_accessor :upload_key
19
+
20
+ attr_accessor :currency
21
+
22
+ # AliExpress language to retrieve content in. Use locale.
23
+ attr_accessor :language
24
+
25
+ # Two character iso country code
26
+ attr_accessor :ship_to_country
27
+
28
+ # AliExpress category to search in
29
+ attr_accessor :category
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'upload_key' => :'uploadKey',
35
+ :'currency' => :'currency',
36
+ :'language' => :'language',
37
+ :'ship_to_country' => :'shipToCountry',
38
+ :'category' => :'category'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'upload_key' => :'String',
46
+ :'currency' => :'RealtimeCurrency',
47
+ :'language' => :'String',
48
+ :'ship_to_country' => :'String',
49
+ :'category' => :'Integer'
50
+ }
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ if attributes.has_key?(:'uploadKey')
62
+ self.upload_key = attributes[:'uploadKey']
63
+ end
64
+
65
+ if attributes.has_key?(:'currency')
66
+ self.currency = attributes[:'currency']
67
+ end
68
+
69
+ if attributes.has_key?(:'language')
70
+ self.language = attributes[:'language']
71
+ else
72
+ self.language = 'en_US'
73
+ end
74
+
75
+ if attributes.has_key?(:'shipToCountry')
76
+ self.ship_to_country = attributes[:'shipToCountry']
77
+ end
78
+
79
+ if attributes.has_key?(:'category')
80
+ self.category = attributes[:'category']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if !@ship_to_country.nil? && @ship_to_country.to_s.length > 2
89
+ invalid_properties.push('invalid value for "ship_to_country", the character length must be smaller than or equal to 2.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if !@ship_to_country.nil? && @ship_to_country.to_s.length > 2
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] ship_to_country Value to be assigned
104
+ def ship_to_country=(ship_to_country)
105
+ if !ship_to_country.nil? && ship_to_country.to_s.length > 2
106
+ fail ArgumentError, 'invalid value for "ship_to_country", the character length must be smaller than or equal to 2.'
107
+ end
108
+
109
+ @ship_to_country = ship_to_country
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ upload_key == o.upload_key &&
118
+ currency == o.currency &&
119
+ language == o.language &&
120
+ ship_to_country == o.ship_to_country &&
121
+ category == o.category
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Fixnum] Hash code
132
+ def hash
133
+ [upload_key, currency, language, ship_to_country, category].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.openapi_types.each_pair do |key, type|
142
+ if type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
146
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
147
+ end
148
+ elsif !attributes[self.class.attribute_map[key]].nil?
149
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
150
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
151
+ end
152
+
153
+ self
154
+ end
155
+
156
+ # Deserializes the data based on type
157
+ # @param string type Data type
158
+ # @param string value Value to be deserialized
159
+ # @return [Object] Deserialized data
160
+ def _deserialize(type, value)
161
+ case type.to_sym
162
+ when :DateTime
163
+ DateTime.parse(value)
164
+ when :Date
165
+ Date.parse(value)
166
+ when :String
167
+ value.to_s
168
+ when :Integer
169
+ value.to_i
170
+ when :Float
171
+ value.to_f
172
+ when :BOOLEAN
173
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
174
+ true
175
+ else
176
+ false
177
+ end
178
+ when :Object
179
+ # generic object (usually a Hash), return directly
180
+ value
181
+ when /\AArray<(?<inner_type>.+)>\z/
182
+ inner_type = Regexp.last_match[:inner_type]
183
+ value.map { |v| _deserialize(inner_type, v) }
184
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
185
+ k_type = Regexp.last_match[:k_type]
186
+ v_type = Regexp.last_match[:v_type]
187
+ {}.tap do |hash|
188
+ value.each do |k, v|
189
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
190
+ end
191
+ end
192
+ else # model
193
+ temp_model = AliseeksApi.const_get(type).new
194
+ temp_model.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ next if value.nil?
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+ end
240
+ end