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