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,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 price
|
17
|
+
class PriceRange
|
18
|
+
attr_accessor :min
|
19
|
+
|
20
|
+
attr_accessor :max
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'min' => :'min',
|
26
|
+
:'max' => :'max'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'min' => :'Amount',
|
34
|
+
:'max' => :'Amount'
|
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?(:'min')
|
47
|
+
self.min = attributes[:'min']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'max')
|
51
|
+
self.max = attributes[:'max']
|
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
|
+
min == o.min &&
|
74
|
+
max == o.max
|
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
|
+
[min, max].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,229 @@
|
|
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 summary of prices for a product
|
17
|
+
class PriceSummary
|
18
|
+
attr_accessor :original_amount
|
19
|
+
|
20
|
+
attr_accessor :unit_original_amount
|
21
|
+
|
22
|
+
attr_accessor :discounted_amount
|
23
|
+
|
24
|
+
attr_accessor :unit_discounted_amount
|
25
|
+
|
26
|
+
attr_accessor :bulk_amount
|
27
|
+
|
28
|
+
attr_accessor :unit_bulk_amount
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'original_amount' => :'originalAmount',
|
34
|
+
:'unit_original_amount' => :'unitOriginalAmount',
|
35
|
+
:'discounted_amount' => :'discountedAmount',
|
36
|
+
:'unit_discounted_amount' => :'unitDiscountedAmount',
|
37
|
+
:'bulk_amount' => :'bulkAmount',
|
38
|
+
:'unit_bulk_amount' => :'unitBulkAmount'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'original_amount' => :'PriceRange',
|
46
|
+
:'unit_original_amount' => :'PriceRange',
|
47
|
+
:'discounted_amount' => :'PriceRange',
|
48
|
+
:'unit_discounted_amount' => :'PriceRange',
|
49
|
+
:'bulk_amount' => :'PriceRange',
|
50
|
+
:'unit_bulk_amount' => :'PriceRange'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
return unless attributes.is_a?(Hash)
|
58
|
+
|
59
|
+
# convert string to symbol for hash key
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
61
|
+
|
62
|
+
if attributes.has_key?(:'originalAmount')
|
63
|
+
self.original_amount = attributes[:'originalAmount']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'unitOriginalAmount')
|
67
|
+
self.unit_original_amount = attributes[:'unitOriginalAmount']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'discountedAmount')
|
71
|
+
self.discounted_amount = attributes[:'discountedAmount']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'unitDiscountedAmount')
|
75
|
+
self.unit_discounted_amount = attributes[:'unitDiscountedAmount']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'bulkAmount')
|
79
|
+
self.bulk_amount = attributes[:'bulkAmount']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'unitBulkAmount')
|
83
|
+
self.unit_bulk_amount = attributes[:'unitBulkAmount']
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
88
|
+
# @return Array for valid properties with the reasons
|
89
|
+
def list_invalid_properties
|
90
|
+
invalid_properties = Array.new
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
# Checks equality by comparing each attribute.
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def ==(o)
|
103
|
+
return true if self.equal?(o)
|
104
|
+
self.class == o.class &&
|
105
|
+
original_amount == o.original_amount &&
|
106
|
+
unit_original_amount == o.unit_original_amount &&
|
107
|
+
discounted_amount == o.discounted_amount &&
|
108
|
+
unit_discounted_amount == o.unit_discounted_amount &&
|
109
|
+
bulk_amount == o.bulk_amount &&
|
110
|
+
unit_bulk_amount == o.unit_bulk_amount
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Fixnum] Hash code
|
121
|
+
def hash
|
122
|
+
[original_amount, unit_original_amount, discounted_amount, unit_discounted_amount, bulk_amount, unit_bulk_amount].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def build_from_hash(attributes)
|
129
|
+
return nil unless attributes.is_a?(Hash)
|
130
|
+
self.class.openapi_types.each_pair do |key, type|
|
131
|
+
if type =~ /\AArray<(.*)>/i
|
132
|
+
# check to ensure the input is an array given that the the attribute
|
133
|
+
# is documented as an array but the input is not
|
134
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
135
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
136
|
+
end
|
137
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
138
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
139
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
140
|
+
end
|
141
|
+
|
142
|
+
self
|
143
|
+
end
|
144
|
+
|
145
|
+
# Deserializes the data based on type
|
146
|
+
# @param string type Data type
|
147
|
+
# @param string value Value to be deserialized
|
148
|
+
# @return [Object] Deserialized data
|
149
|
+
def _deserialize(type, value)
|
150
|
+
case type.to_sym
|
151
|
+
when :DateTime
|
152
|
+
DateTime.parse(value)
|
153
|
+
when :Date
|
154
|
+
Date.parse(value)
|
155
|
+
when :String
|
156
|
+
value.to_s
|
157
|
+
when :Integer
|
158
|
+
value.to_i
|
159
|
+
when :Float
|
160
|
+
value.to_f
|
161
|
+
when :BOOLEAN
|
162
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
163
|
+
true
|
164
|
+
else
|
165
|
+
false
|
166
|
+
end
|
167
|
+
when :Object
|
168
|
+
# generic object (usually a Hash), return directly
|
169
|
+
value
|
170
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
+
inner_type = Regexp.last_match[:inner_type]
|
172
|
+
value.map { |v| _deserialize(inner_type, v) }
|
173
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
+
k_type = Regexp.last_match[:k_type]
|
175
|
+
v_type = Regexp.last_match[:v_type]
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each do |k, v|
|
178
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
else # model
|
182
|
+
temp_model = AliseeksApi.const_get(type).new
|
183
|
+
temp_model.build_from_hash(value)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the string representation of the object
|
188
|
+
# @return [String] String presentation of the object
|
189
|
+
def to_s
|
190
|
+
to_hash.to_s
|
191
|
+
end
|
192
|
+
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_body
|
196
|
+
to_hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the object in the form of hash
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_hash
|
202
|
+
hash = {}
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
204
|
+
value = self.send(attr)
|
205
|
+
next if value.nil?
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -0,0 +1,422 @@
|
|
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
|
+
# AliExpress product
|
17
|
+
class Product
|
18
|
+
# The AliExpress item ID
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# The item category
|
22
|
+
attr_accessor :category_id
|
23
|
+
|
24
|
+
# The company ID
|
25
|
+
attr_accessor :company_id
|
26
|
+
|
27
|
+
# The seller ID
|
28
|
+
attr_accessor :seller_id
|
29
|
+
|
30
|
+
# The subject / title of the item
|
31
|
+
attr_accessor :title
|
32
|
+
|
33
|
+
# The AliExpress status ID
|
34
|
+
attr_accessor :status_id
|
35
|
+
|
36
|
+
# The AliExpress status
|
37
|
+
attr_accessor :status
|
38
|
+
|
39
|
+
# The number of items per lot
|
40
|
+
attr_accessor :count_per_lot
|
41
|
+
|
42
|
+
# Number of times the item has been added to a wishlist
|
43
|
+
attr_accessor :wish_list_count
|
44
|
+
|
45
|
+
# The unit of the item
|
46
|
+
attr_accessor :unit
|
47
|
+
|
48
|
+
# The unit for multiple items
|
49
|
+
attr_accessor :multi_unit
|
50
|
+
|
51
|
+
attr_accessor :seller
|
52
|
+
|
53
|
+
attr_accessor :reviews
|
54
|
+
|
55
|
+
attr_accessor :trade
|
56
|
+
|
57
|
+
attr_accessor :promotion
|
58
|
+
|
59
|
+
# The item images
|
60
|
+
attr_accessor :product_images
|
61
|
+
|
62
|
+
# Attributes associated with the AliExpress product
|
63
|
+
attr_accessor :attributes
|
64
|
+
|
65
|
+
# The product HTML description
|
66
|
+
attr_accessor :html_description
|
67
|
+
|
68
|
+
attr_accessor :price_summary
|
69
|
+
|
70
|
+
# All the variations of an AliExpress item and prices associated with each variation
|
71
|
+
attr_accessor :prices
|
72
|
+
|
73
|
+
# The shipping options of an AliExpress item
|
74
|
+
attr_accessor :shipping
|
75
|
+
|
76
|
+
class EnumAttributeValidator
|
77
|
+
attr_reader :datatype
|
78
|
+
attr_reader :allowable_values
|
79
|
+
|
80
|
+
def initialize(datatype, allowable_values)
|
81
|
+
@allowable_values = allowable_values.map do |value|
|
82
|
+
case datatype.to_s
|
83
|
+
when /Integer/i
|
84
|
+
value.to_i
|
85
|
+
when /Float/i
|
86
|
+
value.to_f
|
87
|
+
else
|
88
|
+
value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def valid?(value)
|
94
|
+
!value || allowable_values.include?(value)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
99
|
+
def self.attribute_map
|
100
|
+
{
|
101
|
+
:'id' => :'id',
|
102
|
+
:'category_id' => :'categoryId',
|
103
|
+
:'company_id' => :'companyId',
|
104
|
+
:'seller_id' => :'sellerId',
|
105
|
+
:'title' => :'title',
|
106
|
+
:'status_id' => :'statusId',
|
107
|
+
:'status' => :'status',
|
108
|
+
:'count_per_lot' => :'countPerLot',
|
109
|
+
:'wish_list_count' => :'wishListCount',
|
110
|
+
:'unit' => :'unit',
|
111
|
+
:'multi_unit' => :'multiUnit',
|
112
|
+
:'seller' => :'seller',
|
113
|
+
:'reviews' => :'reviews',
|
114
|
+
:'trade' => :'trade',
|
115
|
+
:'promotion' => :'promotion',
|
116
|
+
:'product_images' => :'productImages',
|
117
|
+
:'attributes' => :'attributes',
|
118
|
+
:'html_description' => :'htmlDescription',
|
119
|
+
:'price_summary' => :'priceSummary',
|
120
|
+
:'prices' => :'prices',
|
121
|
+
:'shipping' => :'shipping'
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
# Attribute type mapping.
|
126
|
+
def self.openapi_types
|
127
|
+
{
|
128
|
+
:'id' => :'String',
|
129
|
+
:'category_id' => :'String',
|
130
|
+
:'company_id' => :'String',
|
131
|
+
:'seller_id' => :'String',
|
132
|
+
:'title' => :'String',
|
133
|
+
:'status_id' => :'Integer',
|
134
|
+
:'status' => :'String',
|
135
|
+
:'count_per_lot' => :'Integer',
|
136
|
+
:'wish_list_count' => :'Integer',
|
137
|
+
:'unit' => :'String',
|
138
|
+
:'multi_unit' => :'String',
|
139
|
+
:'seller' => :'ProductSeller',
|
140
|
+
:'reviews' => :'ProductReviews',
|
141
|
+
:'trade' => :'TradeInformation',
|
142
|
+
:'promotion' => :'ProductPromotion',
|
143
|
+
:'product_images' => :'Array<String>',
|
144
|
+
:'attributes' => :'Array<ProductAttribute>',
|
145
|
+
:'html_description' => :'String',
|
146
|
+
:'price_summary' => :'PriceSummary',
|
147
|
+
:'prices' => :'Array<SkuPriceOption>',
|
148
|
+
:'shipping' => :'Array<ProductShippingOptions>'
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
# Initializes the object
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
def initialize(attributes = {})
|
155
|
+
return unless attributes.is_a?(Hash)
|
156
|
+
|
157
|
+
# convert string to symbol for hash key
|
158
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
159
|
+
|
160
|
+
if attributes.has_key?(:'id')
|
161
|
+
self.id = attributes[:'id']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.has_key?(:'categoryId')
|
165
|
+
self.category_id = attributes[:'categoryId']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.has_key?(:'companyId')
|
169
|
+
self.company_id = attributes[:'companyId']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.has_key?(:'sellerId')
|
173
|
+
self.seller_id = attributes[:'sellerId']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.has_key?(:'title')
|
177
|
+
self.title = attributes[:'title']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.has_key?(:'statusId')
|
181
|
+
self.status_id = attributes[:'statusId']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.has_key?(:'status')
|
185
|
+
self.status = attributes[:'status']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.has_key?(:'countPerLot')
|
189
|
+
self.count_per_lot = attributes[:'countPerLot']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.has_key?(:'wishListCount')
|
193
|
+
self.wish_list_count = attributes[:'wishListCount']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.has_key?(:'unit')
|
197
|
+
self.unit = attributes[:'unit']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.has_key?(:'multiUnit')
|
201
|
+
self.multi_unit = attributes[:'multiUnit']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.has_key?(:'seller')
|
205
|
+
self.seller = attributes[:'seller']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.has_key?(:'reviews')
|
209
|
+
self.reviews = attributes[:'reviews']
|
210
|
+
end
|
211
|
+
|
212
|
+
if attributes.has_key?(:'trade')
|
213
|
+
self.trade = attributes[:'trade']
|
214
|
+
end
|
215
|
+
|
216
|
+
if attributes.has_key?(:'promotion')
|
217
|
+
self.promotion = attributes[:'promotion']
|
218
|
+
end
|
219
|
+
|
220
|
+
if attributes.has_key?(:'productImages')
|
221
|
+
if (value = attributes[:'productImages']).is_a?(Array)
|
222
|
+
self.product_images = value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
if attributes.has_key?(:'attributes')
|
227
|
+
if (value = attributes[:'attributes']).is_a?(Array)
|
228
|
+
self.attributes = value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.has_key?(:'htmlDescription')
|
233
|
+
self.html_description = attributes[:'htmlDescription']
|
234
|
+
end
|
235
|
+
|
236
|
+
if attributes.has_key?(:'priceSummary')
|
237
|
+
self.price_summary = attributes[:'priceSummary']
|
238
|
+
end
|
239
|
+
|
240
|
+
if attributes.has_key?(:'prices')
|
241
|
+
if (value = attributes[:'prices']).is_a?(Array)
|
242
|
+
self.prices = value
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
if attributes.has_key?(:'shipping')
|
247
|
+
if (value = attributes[:'shipping']).is_a?(Array)
|
248
|
+
self.shipping = value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
254
|
+
# @return Array for valid properties with the reasons
|
255
|
+
def list_invalid_properties
|
256
|
+
invalid_properties = Array.new
|
257
|
+
invalid_properties
|
258
|
+
end
|
259
|
+
|
260
|
+
# Check to see if the all the properties in the model are valid
|
261
|
+
# @return true if the model is valid
|
262
|
+
def valid?
|
263
|
+
status_validator = EnumAttributeValidator.new('String', ['active', 'inactive'])
|
264
|
+
return false unless status_validator.valid?(@status)
|
265
|
+
true
|
266
|
+
end
|
267
|
+
|
268
|
+
# Custom attribute writer method checking allowed values (enum).
|
269
|
+
# @param [Object] status Object to be assigned
|
270
|
+
def status=(status)
|
271
|
+
validator = EnumAttributeValidator.new('String', ['active', 'inactive'])
|
272
|
+
unless validator.valid?(status)
|
273
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
274
|
+
end
|
275
|
+
@status = status
|
276
|
+
end
|
277
|
+
|
278
|
+
# Checks equality by comparing each attribute.
|
279
|
+
# @param [Object] Object to be compared
|
280
|
+
def ==(o)
|
281
|
+
return true if self.equal?(o)
|
282
|
+
self.class == o.class &&
|
283
|
+
id == o.id &&
|
284
|
+
category_id == o.category_id &&
|
285
|
+
company_id == o.company_id &&
|
286
|
+
seller_id == o.seller_id &&
|
287
|
+
title == o.title &&
|
288
|
+
status_id == o.status_id &&
|
289
|
+
status == o.status &&
|
290
|
+
count_per_lot == o.count_per_lot &&
|
291
|
+
wish_list_count == o.wish_list_count &&
|
292
|
+
unit == o.unit &&
|
293
|
+
multi_unit == o.multi_unit &&
|
294
|
+
seller == o.seller &&
|
295
|
+
reviews == o.reviews &&
|
296
|
+
trade == o.trade &&
|
297
|
+
promotion == o.promotion &&
|
298
|
+
product_images == o.product_images &&
|
299
|
+
attributes == o.attributes &&
|
300
|
+
html_description == o.html_description &&
|
301
|
+
price_summary == o.price_summary &&
|
302
|
+
prices == o.prices &&
|
303
|
+
shipping == o.shipping
|
304
|
+
end
|
305
|
+
|
306
|
+
# @see the `==` method
|
307
|
+
# @param [Object] Object to be compared
|
308
|
+
def eql?(o)
|
309
|
+
self == o
|
310
|
+
end
|
311
|
+
|
312
|
+
# Calculates hash code according to all attributes.
|
313
|
+
# @return [Fixnum] Hash code
|
314
|
+
def hash
|
315
|
+
[id, category_id, company_id, seller_id, title, status_id, status, count_per_lot, wish_list_count, unit, multi_unit, seller, reviews, trade, promotion, product_images, attributes, html_description, price_summary, prices, shipping].hash
|
316
|
+
end
|
317
|
+
|
318
|
+
# Builds the object from hash
|
319
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
320
|
+
# @return [Object] Returns the model itself
|
321
|
+
def build_from_hash(attributes)
|
322
|
+
return nil unless attributes.is_a?(Hash)
|
323
|
+
self.class.openapi_types.each_pair do |key, type|
|
324
|
+
if type =~ /\AArray<(.*)>/i
|
325
|
+
# check to ensure the input is an array given that the the attribute
|
326
|
+
# is documented as an array but the input is not
|
327
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
328
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
329
|
+
end
|
330
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
331
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
332
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
333
|
+
end
|
334
|
+
|
335
|
+
self
|
336
|
+
end
|
337
|
+
|
338
|
+
# Deserializes the data based on type
|
339
|
+
# @param string type Data type
|
340
|
+
# @param string value Value to be deserialized
|
341
|
+
# @return [Object] Deserialized data
|
342
|
+
def _deserialize(type, value)
|
343
|
+
case type.to_sym
|
344
|
+
when :DateTime
|
345
|
+
DateTime.parse(value)
|
346
|
+
when :Date
|
347
|
+
Date.parse(value)
|
348
|
+
when :String
|
349
|
+
value.to_s
|
350
|
+
when :Integer
|
351
|
+
value.to_i
|
352
|
+
when :Float
|
353
|
+
value.to_f
|
354
|
+
when :BOOLEAN
|
355
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
356
|
+
true
|
357
|
+
else
|
358
|
+
false
|
359
|
+
end
|
360
|
+
when :Object
|
361
|
+
# generic object (usually a Hash), return directly
|
362
|
+
value
|
363
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
364
|
+
inner_type = Regexp.last_match[:inner_type]
|
365
|
+
value.map { |v| _deserialize(inner_type, v) }
|
366
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
367
|
+
k_type = Regexp.last_match[:k_type]
|
368
|
+
v_type = Regexp.last_match[:v_type]
|
369
|
+
{}.tap do |hash|
|
370
|
+
value.each do |k, v|
|
371
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
else # model
|
375
|
+
temp_model = AliseeksApi.const_get(type).new
|
376
|
+
temp_model.build_from_hash(value)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
# Returns the string representation of the object
|
381
|
+
# @return [String] String presentation of the object
|
382
|
+
def to_s
|
383
|
+
to_hash.to_s
|
384
|
+
end
|
385
|
+
|
386
|
+
# to_body is an alias to to_hash (backward compatibility)
|
387
|
+
# @return [Hash] Returns the object in the form of hash
|
388
|
+
def to_body
|
389
|
+
to_hash
|
390
|
+
end
|
391
|
+
|
392
|
+
# Returns the object in the form of hash
|
393
|
+
# @return [Hash] Returns the object in the form of hash
|
394
|
+
def to_hash
|
395
|
+
hash = {}
|
396
|
+
self.class.attribute_map.each_pair do |attr, param|
|
397
|
+
value = self.send(attr)
|
398
|
+
next if value.nil?
|
399
|
+
hash[param] = _to_hash(value)
|
400
|
+
end
|
401
|
+
hash
|
402
|
+
end
|
403
|
+
|
404
|
+
# Outputs non-array value in the form of hash
|
405
|
+
# For object, use to_hash. Otherwise, just return the value
|
406
|
+
# @param [Object] value Any valid value
|
407
|
+
# @return [Hash] Returns the value in the form of hash
|
408
|
+
def _to_hash(value)
|
409
|
+
if value.is_a?(Array)
|
410
|
+
value.compact.map { |v| _to_hash(v) }
|
411
|
+
elsif value.is_a?(Hash)
|
412
|
+
{}.tap do |hash|
|
413
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
414
|
+
end
|
415
|
+
elsif value.respond_to? :to_hash
|
416
|
+
value.to_hash
|
417
|
+
else
|
418
|
+
value
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|