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