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,203 @@
|
|
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
|
+
# Price option for the search item
|
17
|
+
class SearchPriceOption
|
18
|
+
# The type of the price, either pc_price or app_price
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
attr_accessor :original_amount
|
22
|
+
|
23
|
+
attr_accessor :amount
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'type' => :'type',
|
29
|
+
:'original_amount' => :'originalAmount',
|
30
|
+
:'amount' => :'amount'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'type' => :'String',
|
38
|
+
:'original_amount' => :'Amount',
|
39
|
+
:'amount' => :'Amount'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
50
|
+
|
51
|
+
if attributes.has_key?(:'type')
|
52
|
+
self.type = attributes[:'type']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'originalAmount')
|
56
|
+
self.original_amount = attributes[:'originalAmount']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'amount')
|
60
|
+
self.amount = attributes[:'amount']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
+
# @return Array for valid properties with the reasons
|
66
|
+
def list_invalid_properties
|
67
|
+
invalid_properties = Array.new
|
68
|
+
invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(o)
|
80
|
+
return true if self.equal?(o)
|
81
|
+
self.class == o.class &&
|
82
|
+
type == o.type &&
|
83
|
+
original_amount == o.original_amount &&
|
84
|
+
amount == o.amount
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Fixnum] Hash code
|
95
|
+
def hash
|
96
|
+
[type, original_amount, amount].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.openapi_types.each_pair do |key, type|
|
105
|
+
if type =~ /\AArray<(.*)>/i
|
106
|
+
# check to ensure the input is an array given that the the attribute
|
107
|
+
# is documented as an array but the input is not
|
108
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
109
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
114
|
+
end
|
115
|
+
|
116
|
+
self
|
117
|
+
end
|
118
|
+
|
119
|
+
# Deserializes the data based on type
|
120
|
+
# @param string type Data type
|
121
|
+
# @param string value Value to be deserialized
|
122
|
+
# @return [Object] Deserialized data
|
123
|
+
def _deserialize(type, value)
|
124
|
+
case type.to_sym
|
125
|
+
when :DateTime
|
126
|
+
DateTime.parse(value)
|
127
|
+
when :Date
|
128
|
+
Date.parse(value)
|
129
|
+
when :String
|
130
|
+
value.to_s
|
131
|
+
when :Integer
|
132
|
+
value.to_i
|
133
|
+
when :Float
|
134
|
+
value.to_f
|
135
|
+
when :BOOLEAN
|
136
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
137
|
+
true
|
138
|
+
else
|
139
|
+
false
|
140
|
+
end
|
141
|
+
when :Object
|
142
|
+
# generic object (usually a Hash), return directly
|
143
|
+
value
|
144
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
145
|
+
inner_type = Regexp.last_match[:inner_type]
|
146
|
+
value.map { |v| _deserialize(inner_type, v) }
|
147
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
148
|
+
k_type = Regexp.last_match[:k_type]
|
149
|
+
v_type = Regexp.last_match[:v_type]
|
150
|
+
{}.tap do |hash|
|
151
|
+
value.each do |k, v|
|
152
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
else # model
|
156
|
+
temp_model = AliseeksApi.const_get(type).new
|
157
|
+
temp_model.build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
next if value.nil?
|
180
|
+
hash[param] = _to_hash(value)
|
181
|
+
end
|
182
|
+
hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Outputs non-array value in the form of hash
|
186
|
+
# For object, use to_hash. Otherwise, just return the value
|
187
|
+
# @param [Object] value Any valid value
|
188
|
+
# @return [Hash] Returns the value in the form of hash
|
189
|
+
def _to_hash(value)
|
190
|
+
if value.is_a?(Array)
|
191
|
+
value.compact.map { |v| _to_hash(v) }
|
192
|
+
elsif value.is_a?(Hash)
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
195
|
+
end
|
196
|
+
elsif value.respond_to? :to_hash
|
197
|
+
value.to_hash
|
198
|
+
else
|
199
|
+
value
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,441 @@
|
|
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
|
+
# Non realtime search request body
|
17
|
+
class SearchRequest
|
18
|
+
# The search query
|
19
|
+
attr_accessor :text
|
20
|
+
|
21
|
+
attr_accessor :sort
|
22
|
+
|
23
|
+
attr_accessor :currency
|
24
|
+
|
25
|
+
# The AliExpress category to search in
|
26
|
+
attr_accessor :category
|
27
|
+
|
28
|
+
# When this flag is set to `true` the `category` field will be expanded so that all items in sub-categories will be included
|
29
|
+
attr_accessor :include_subcategories
|
30
|
+
|
31
|
+
# The direction to sort the results by. Only valid for certain `sort` values
|
32
|
+
attr_accessor :sort_direction
|
33
|
+
|
34
|
+
attr_accessor :ratings_range
|
35
|
+
|
36
|
+
attr_accessor :quantity_range
|
37
|
+
|
38
|
+
attr_accessor :price_range
|
39
|
+
|
40
|
+
attr_accessor :unit_price_range
|
41
|
+
|
42
|
+
attr_accessor :order_range
|
43
|
+
|
44
|
+
attr_accessor :item_id_range
|
45
|
+
|
46
|
+
# Filter by freight types
|
47
|
+
attr_accessor :freight_types
|
48
|
+
|
49
|
+
# Skip a number of items, if you need to skip more than 10000 items then use the scroll feature
|
50
|
+
attr_accessor :skip
|
51
|
+
|
52
|
+
# Limit the request to a number of items
|
53
|
+
attr_accessor :limit
|
54
|
+
|
55
|
+
# When this value is `true` then you will receive a scroll identifier which you can use to request the next page of results. The scroll identifier is good for 60 seconds.
|
56
|
+
attr_accessor :scroll_pagination
|
57
|
+
|
58
|
+
# The scroll identifier which can be retrieved by sending an initial search request with `scrollPagination` set to `true`. Scroll identifiers are good for 60 seconds.
|
59
|
+
attr_accessor :scroll_identifier
|
60
|
+
|
61
|
+
class EnumAttributeValidator
|
62
|
+
attr_reader :datatype
|
63
|
+
attr_reader :allowable_values
|
64
|
+
|
65
|
+
def initialize(datatype, allowable_values)
|
66
|
+
@allowable_values = allowable_values.map do |value|
|
67
|
+
case datatype.to_s
|
68
|
+
when /Integer/i
|
69
|
+
value.to_i
|
70
|
+
when /Float/i
|
71
|
+
value.to_f
|
72
|
+
else
|
73
|
+
value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def valid?(value)
|
79
|
+
!value || allowable_values.include?(value)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
84
|
+
def self.attribute_map
|
85
|
+
{
|
86
|
+
:'text' => :'text',
|
87
|
+
:'sort' => :'sort',
|
88
|
+
:'currency' => :'currency',
|
89
|
+
:'category' => :'category',
|
90
|
+
:'include_subcategories' => :'includeSubcategories',
|
91
|
+
:'sort_direction' => :'sortDirection',
|
92
|
+
:'ratings_range' => :'ratingsRange',
|
93
|
+
:'quantity_range' => :'quantityRange',
|
94
|
+
:'price_range' => :'priceRange',
|
95
|
+
:'unit_price_range' => :'unitPriceRange',
|
96
|
+
:'order_range' => :'orderRange',
|
97
|
+
:'item_id_range' => :'itemIdRange',
|
98
|
+
:'freight_types' => :'freightTypes',
|
99
|
+
:'skip' => :'skip',
|
100
|
+
:'limit' => :'limit',
|
101
|
+
:'scroll_pagination' => :'scrollPagination',
|
102
|
+
:'scroll_identifier' => :'scrollIdentifier'
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
# Attribute type mapping.
|
107
|
+
def self.openapi_types
|
108
|
+
{
|
109
|
+
:'text' => :'String',
|
110
|
+
:'sort' => :'String',
|
111
|
+
:'currency' => :'NonRealtimeCurrency',
|
112
|
+
:'category' => :'Integer',
|
113
|
+
:'include_subcategories' => :'BOOLEAN',
|
114
|
+
:'sort_direction' => :'String',
|
115
|
+
:'ratings_range' => :'DoubleRange',
|
116
|
+
:'quantity_range' => :'IntegerRange',
|
117
|
+
:'price_range' => :'DoubleRange',
|
118
|
+
:'unit_price_range' => :'DoubleRange',
|
119
|
+
:'order_range' => :'IntegerRange',
|
120
|
+
:'item_id_range' => :'StringRange',
|
121
|
+
:'freight_types' => :'Array<String>',
|
122
|
+
:'skip' => :'Integer',
|
123
|
+
:'limit' => :'Integer',
|
124
|
+
:'scroll_pagination' => :'BOOLEAN',
|
125
|
+
:'scroll_identifier' => :'String'
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
# Initializes the object
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
def initialize(attributes = {})
|
132
|
+
return unless attributes.is_a?(Hash)
|
133
|
+
|
134
|
+
# convert string to symbol for hash key
|
135
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
136
|
+
|
137
|
+
if attributes.has_key?(:'text')
|
138
|
+
self.text = attributes[:'text']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'sort')
|
142
|
+
self.sort = attributes[:'sort']
|
143
|
+
else
|
144
|
+
self.sort = 'BEST_MATCH'
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'currency')
|
148
|
+
self.currency = attributes[:'currency']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.has_key?(:'category')
|
152
|
+
self.category = attributes[:'category']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.has_key?(:'includeSubcategories')
|
156
|
+
self.include_subcategories = attributes[:'includeSubcategories']
|
157
|
+
else
|
158
|
+
self.include_subcategories = false
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'sortDirection')
|
162
|
+
self.sort_direction = attributes[:'sortDirection']
|
163
|
+
else
|
164
|
+
self.sort_direction = 'ASC'
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.has_key?(:'ratingsRange')
|
168
|
+
self.ratings_range = attributes[:'ratingsRange']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'quantityRange')
|
172
|
+
self.quantity_range = attributes[:'quantityRange']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'priceRange')
|
176
|
+
self.price_range = attributes[:'priceRange']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.has_key?(:'unitPriceRange')
|
180
|
+
self.unit_price_range = attributes[:'unitPriceRange']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'orderRange')
|
184
|
+
self.order_range = attributes[:'orderRange']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.has_key?(:'itemIdRange')
|
188
|
+
self.item_id_range = attributes[:'itemIdRange']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.has_key?(:'freightTypes')
|
192
|
+
if (value = attributes[:'freightTypes']).is_a?(Array)
|
193
|
+
self.freight_types = value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'skip')
|
198
|
+
self.skip = attributes[:'skip']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'limit')
|
202
|
+
self.limit = attributes[:'limit']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'scrollPagination')
|
206
|
+
self.scroll_pagination = attributes[:'scrollPagination']
|
207
|
+
else
|
208
|
+
self.scroll_pagination = false
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.has_key?(:'scrollIdentifier')
|
212
|
+
self.scroll_identifier = attributes[:'scrollIdentifier']
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
217
|
+
# @return Array for valid properties with the reasons
|
218
|
+
def list_invalid_properties
|
219
|
+
invalid_properties = Array.new
|
220
|
+
if !@skip.nil? && @skip > 10000
|
221
|
+
invalid_properties.push('invalid value for "skip", must be smaller than or equal to 10000.')
|
222
|
+
end
|
223
|
+
|
224
|
+
if !@skip.nil? && @skip < 0
|
225
|
+
invalid_properties.push('invalid value for "skip", must be greater than or equal to 0.')
|
226
|
+
end
|
227
|
+
|
228
|
+
if !@limit.nil? && @limit > 50
|
229
|
+
invalid_properties.push('invalid value for "limit", must be smaller than or equal to 50.')
|
230
|
+
end
|
231
|
+
|
232
|
+
if !@limit.nil? && @limit < 5
|
233
|
+
invalid_properties.push('invalid value for "limit", must be greater than or equal to 5.')
|
234
|
+
end
|
235
|
+
|
236
|
+
invalid_properties
|
237
|
+
end
|
238
|
+
|
239
|
+
# Check to see if the all the properties in the model are valid
|
240
|
+
# @return true if the model is valid
|
241
|
+
def valid?
|
242
|
+
sort_validator = EnumAttributeValidator.new('String', ['PRODUCT_ID', 'UPDATE_TIME', 'WHOLESALE_PRICE', 'ITEM_RATING', 'ORDERS', 'BEST_MATCH'])
|
243
|
+
return false unless sort_validator.valid?(@sort)
|
244
|
+
sort_direction_validator = EnumAttributeValidator.new('String', ['ASC', 'DESC'])
|
245
|
+
return false unless sort_direction_validator.valid?(@sort_direction)
|
246
|
+
return false if !@skip.nil? && @skip > 10000
|
247
|
+
return false if !@skip.nil? && @skip < 0
|
248
|
+
return false if !@limit.nil? && @limit > 50
|
249
|
+
return false if !@limit.nil? && @limit < 5
|
250
|
+
true
|
251
|
+
end
|
252
|
+
|
253
|
+
# Custom attribute writer method checking allowed values (enum).
|
254
|
+
# @param [Object] sort Object to be assigned
|
255
|
+
def sort=(sort)
|
256
|
+
validator = EnumAttributeValidator.new('String', ['PRODUCT_ID', 'UPDATE_TIME', 'WHOLESALE_PRICE', 'ITEM_RATING', 'ORDERS', 'BEST_MATCH'])
|
257
|
+
unless validator.valid?(sort)
|
258
|
+
fail ArgumentError, 'invalid value for "sort", must be one of #{validator.allowable_values}.'
|
259
|
+
end
|
260
|
+
@sort = sort
|
261
|
+
end
|
262
|
+
|
263
|
+
# Custom attribute writer method checking allowed values (enum).
|
264
|
+
# @param [Object] sort_direction Object to be assigned
|
265
|
+
def sort_direction=(sort_direction)
|
266
|
+
validator = EnumAttributeValidator.new('String', ['ASC', 'DESC'])
|
267
|
+
unless validator.valid?(sort_direction)
|
268
|
+
fail ArgumentError, 'invalid value for "sort_direction", must be one of #{validator.allowable_values}.'
|
269
|
+
end
|
270
|
+
@sort_direction = sort_direction
|
271
|
+
end
|
272
|
+
|
273
|
+
# Custom attribute writer method with validation
|
274
|
+
# @param [Object] skip Value to be assigned
|
275
|
+
def skip=(skip)
|
276
|
+
if !skip.nil? && skip > 10000
|
277
|
+
fail ArgumentError, 'invalid value for "skip", must be smaller than or equal to 10000.'
|
278
|
+
end
|
279
|
+
|
280
|
+
if !skip.nil? && skip < 0
|
281
|
+
fail ArgumentError, 'invalid value for "skip", must be greater than or equal to 0.'
|
282
|
+
end
|
283
|
+
|
284
|
+
@skip = skip
|
285
|
+
end
|
286
|
+
|
287
|
+
# Custom attribute writer method with validation
|
288
|
+
# @param [Object] limit Value to be assigned
|
289
|
+
def limit=(limit)
|
290
|
+
if !limit.nil? && limit > 50
|
291
|
+
fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 50.'
|
292
|
+
end
|
293
|
+
|
294
|
+
if !limit.nil? && limit < 5
|
295
|
+
fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 5.'
|
296
|
+
end
|
297
|
+
|
298
|
+
@limit = limit
|
299
|
+
end
|
300
|
+
|
301
|
+
# Checks equality by comparing each attribute.
|
302
|
+
# @param [Object] Object to be compared
|
303
|
+
def ==(o)
|
304
|
+
return true if self.equal?(o)
|
305
|
+
self.class == o.class &&
|
306
|
+
text == o.text &&
|
307
|
+
sort == o.sort &&
|
308
|
+
currency == o.currency &&
|
309
|
+
category == o.category &&
|
310
|
+
include_subcategories == o.include_subcategories &&
|
311
|
+
sort_direction == o.sort_direction &&
|
312
|
+
ratings_range == o.ratings_range &&
|
313
|
+
quantity_range == o.quantity_range &&
|
314
|
+
price_range == o.price_range &&
|
315
|
+
unit_price_range == o.unit_price_range &&
|
316
|
+
order_range == o.order_range &&
|
317
|
+
item_id_range == o.item_id_range &&
|
318
|
+
freight_types == o.freight_types &&
|
319
|
+
skip == o.skip &&
|
320
|
+
limit == o.limit &&
|
321
|
+
scroll_pagination == o.scroll_pagination &&
|
322
|
+
scroll_identifier == o.scroll_identifier
|
323
|
+
end
|
324
|
+
|
325
|
+
# @see the `==` method
|
326
|
+
# @param [Object] Object to be compared
|
327
|
+
def eql?(o)
|
328
|
+
self == o
|
329
|
+
end
|
330
|
+
|
331
|
+
# Calculates hash code according to all attributes.
|
332
|
+
# @return [Fixnum] Hash code
|
333
|
+
def hash
|
334
|
+
[text, sort, currency, category, include_subcategories, sort_direction, ratings_range, quantity_range, price_range, unit_price_range, order_range, item_id_range, freight_types, skip, limit, scroll_pagination, scroll_identifier].hash
|
335
|
+
end
|
336
|
+
|
337
|
+
# Builds the object from hash
|
338
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
339
|
+
# @return [Object] Returns the model itself
|
340
|
+
def build_from_hash(attributes)
|
341
|
+
return nil unless attributes.is_a?(Hash)
|
342
|
+
self.class.openapi_types.each_pair do |key, type|
|
343
|
+
if type =~ /\AArray<(.*)>/i
|
344
|
+
# check to ensure the input is an array given that the the attribute
|
345
|
+
# is documented as an array but the input is not
|
346
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
347
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
348
|
+
end
|
349
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
350
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
351
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
352
|
+
end
|
353
|
+
|
354
|
+
self
|
355
|
+
end
|
356
|
+
|
357
|
+
# Deserializes the data based on type
|
358
|
+
# @param string type Data type
|
359
|
+
# @param string value Value to be deserialized
|
360
|
+
# @return [Object] Deserialized data
|
361
|
+
def _deserialize(type, value)
|
362
|
+
case type.to_sym
|
363
|
+
when :DateTime
|
364
|
+
DateTime.parse(value)
|
365
|
+
when :Date
|
366
|
+
Date.parse(value)
|
367
|
+
when :String
|
368
|
+
value.to_s
|
369
|
+
when :Integer
|
370
|
+
value.to_i
|
371
|
+
when :Float
|
372
|
+
value.to_f
|
373
|
+
when :BOOLEAN
|
374
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
375
|
+
true
|
376
|
+
else
|
377
|
+
false
|
378
|
+
end
|
379
|
+
when :Object
|
380
|
+
# generic object (usually a Hash), return directly
|
381
|
+
value
|
382
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
383
|
+
inner_type = Regexp.last_match[:inner_type]
|
384
|
+
value.map { |v| _deserialize(inner_type, v) }
|
385
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
386
|
+
k_type = Regexp.last_match[:k_type]
|
387
|
+
v_type = Regexp.last_match[:v_type]
|
388
|
+
{}.tap do |hash|
|
389
|
+
value.each do |k, v|
|
390
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
391
|
+
end
|
392
|
+
end
|
393
|
+
else # model
|
394
|
+
temp_model = AliseeksApi.const_get(type).new
|
395
|
+
temp_model.build_from_hash(value)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
# Returns the string representation of the object
|
400
|
+
# @return [String] String presentation of the object
|
401
|
+
def to_s
|
402
|
+
to_hash.to_s
|
403
|
+
end
|
404
|
+
|
405
|
+
# to_body is an alias to to_hash (backward compatibility)
|
406
|
+
# @return [Hash] Returns the object in the form of hash
|
407
|
+
def to_body
|
408
|
+
to_hash
|
409
|
+
end
|
410
|
+
|
411
|
+
# Returns the object in the form of hash
|
412
|
+
# @return [Hash] Returns the object in the form of hash
|
413
|
+
def to_hash
|
414
|
+
hash = {}
|
415
|
+
self.class.attribute_map.each_pair do |attr, param|
|
416
|
+
value = self.send(attr)
|
417
|
+
next if value.nil?
|
418
|
+
hash[param] = _to_hash(value)
|
419
|
+
end
|
420
|
+
hash
|
421
|
+
end
|
422
|
+
|
423
|
+
# Outputs non-array value in the form of hash
|
424
|
+
# For object, use to_hash. Otherwise, just return the value
|
425
|
+
# @param [Object] value Any valid value
|
426
|
+
# @return [Hash] Returns the value in the form of hash
|
427
|
+
def _to_hash(value)
|
428
|
+
if value.is_a?(Array)
|
429
|
+
value.compact.map { |v| _to_hash(v) }
|
430
|
+
elsif value.is_a?(Hash)
|
431
|
+
{}.tap do |hash|
|
432
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
433
|
+
end
|
434
|
+
elsif value.respond_to? :to_hash
|
435
|
+
value.to_hash
|
436
|
+
else
|
437
|
+
value
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|