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,187 @@
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
+ # Product pricing information with all variations
17
+ class ProductSkus
18
+ # List of product pricing information
19
+ attr_accessor :variations
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'variations' => :'variations'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'variations' => :'Array<ProductSku>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
42
+
43
+ if attributes.has_key?(:'variations')
44
+ if (value = attributes[:'variations']).is_a?(Array)
45
+ self.variations = value
46
+ end
47
+ end
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properties with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ true
61
+ end
62
+
63
+ # Checks equality by comparing each attribute.
64
+ # @param [Object] Object to be compared
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ variations == o.variations
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [variations].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.openapi_types.each_pair do |key, type|
89
+ if type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
93
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
98
+ end
99
+
100
+ self
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def _deserialize(type, value)
108
+ case type.to_sym
109
+ when :DateTime
110
+ DateTime.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :BOOLEAN
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ temp_model = AliseeksApi.const_get(type).new
141
+ temp_model.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,218 @@
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
+ # Get product variations request body
17
+ class ProductSkusRequest
18
+ # The Product ID
19
+ attr_accessor :product_id
20
+
21
+ attr_accessor :currency
22
+
23
+ # AliExpress language to retrieve content in. Use locale.
24
+ attr_accessor :language
25
+
26
+ # AliExpress locale to use.
27
+ attr_accessor :locale
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'product_id' => :'productId',
33
+ :'currency' => :'currency',
34
+ :'language' => :'language',
35
+ :'locale' => :'locale'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'product_id' => :'String',
43
+ :'currency' => :'RealtimeCurrency',
44
+ :'language' => :'String',
45
+ :'locale' => :'String'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'productId')
58
+ self.product_id = attributes[:'productId']
59
+ end
60
+
61
+ if attributes.has_key?(:'currency')
62
+ self.currency = attributes[:'currency']
63
+ end
64
+
65
+ if attributes.has_key?(:'language')
66
+ self.language = attributes[:'language']
67
+ else
68
+ self.language = 'en_US'
69
+ end
70
+
71
+ if attributes.has_key?(:'locale')
72
+ self.locale = attributes[:'locale']
73
+ else
74
+ self.locale = 'en_US'
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ product_id == o.product_id &&
97
+ currency == o.currency &&
98
+ language == o.language &&
99
+ locale == o.locale
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Fixnum] Hash code
110
+ def hash
111
+ [product_id, currency, language, locale].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ temp_model = AliseeksApi.const_get(type).new
172
+ temp_model.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ next if value.nil?
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,222 @@
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
+ # A promotion option
17
+ class PromotionOption
18
+ attr_accessor :max_amount
19
+
20
+ attr_accessor :min_amount
21
+
22
+ # The amount of the discount
23
+ attr_accessor :discount
24
+
25
+ attr_accessor :time_left
26
+
27
+ # The amount of stock left on an item
28
+ attr_accessor :stock
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'max_amount' => :'maxAmount',
34
+ :'min_amount' => :'minAmount',
35
+ :'discount' => :'discount',
36
+ :'time_left' => :'timeLeft',
37
+ :'stock' => :'stock'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'max_amount' => :'Amount',
45
+ :'min_amount' => :'Amount',
46
+ :'discount' => :'Float',
47
+ :'time_left' => :'TimeDuration',
48
+ :'stock' => :'Integer'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+
60
+ if attributes.has_key?(:'maxAmount')
61
+ self.max_amount = attributes[:'maxAmount']
62
+ end
63
+
64
+ if attributes.has_key?(:'minAmount')
65
+ self.min_amount = attributes[:'minAmount']
66
+ end
67
+
68
+ if attributes.has_key?(:'discount')
69
+ self.discount = attributes[:'discount']
70
+ end
71
+
72
+ if attributes.has_key?(:'timeLeft')
73
+ self.time_left = attributes[:'timeLeft']
74
+ end
75
+
76
+ if attributes.has_key?(:'stock')
77
+ self.stock = attributes[:'stock']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ max_amount == o.max_amount &&
100
+ min_amount == o.min_amount &&
101
+ discount == o.discount &&
102
+ time_left == o.time_left &&
103
+ stock == o.stock
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [max_amount, min_amount, discount, time_left, stock].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = AliseeksApi.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end