aliseeks_api 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +171 -0
  5. data/Rakefile +10 -0
  6. data/aliseeks_api.gemspec +45 -0
  7. data/docs/Amount.md +9 -0
  8. data/docs/BestSellingSearchItem.md +15 -0
  9. data/docs/BestSellingSearchRequest.md +12 -0
  10. data/docs/BestSellingSearchResponse.md +8 -0
  11. data/docs/DoubleRange.md +9 -0
  12. data/docs/ImageSearchCategory.md +9 -0
  13. data/docs/ImageSearchItem.md +12 -0
  14. data/docs/ImageSearchRequest.md +12 -0
  15. data/docs/ImageSearchResponse.md +10 -0
  16. data/docs/IntegerRange.md +9 -0
  17. data/docs/NonRealtimeCurrency.md +7 -0
  18. data/docs/PriceRange.md +9 -0
  19. data/docs/PriceSummary.md +13 -0
  20. data/docs/Product.md +28 -0
  21. data/docs/ProductAttribute.md +11 -0
  22. data/docs/ProductBulkOption.md +10 -0
  23. data/docs/ProductDetail.md +24 -0
  24. data/docs/ProductDetailsRequest.md +12 -0
  25. data/docs/ProductHtmlDescription.md +8 -0
  26. data/docs/ProductHtmlDescriptionRequest.md +8 -0
  27. data/docs/ProductPriceOption.md +14 -0
  28. data/docs/ProductPromotion.md +9 -0
  29. data/docs/ProductPropertyVariationIdentifier.md +10 -0
  30. data/docs/ProductRequest.md +15 -0
  31. data/docs/ProductRequestComponent.md +7 -0
  32. data/docs/ProductReview.md +18 -0
  33. data/docs/ProductReviews.md +17 -0
  34. data/docs/ProductReviewsRequest.md +10 -0
  35. data/docs/ProductSeller.md +12 -0
  36. data/docs/ProductShipping.md +8 -0
  37. data/docs/ProductShippingOptions.md +15 -0
  38. data/docs/ProductShippingRequest.md +12 -0
  39. data/docs/ProductSku.md +16 -0
  40. data/docs/ProductSkus.md +8 -0
  41. data/docs/ProductSkusRequest.md +11 -0
  42. data/docs/ProductsApi.md +316 -0
  43. data/docs/PromotionOption.md +12 -0
  44. data/docs/RealtimeCurrency.md +7 -0
  45. data/docs/RealtimeSearchAggregation.md +9 -0
  46. data/docs/RealtimeSearchItem.md +14 -0
  47. data/docs/RealtimeSearchRequest.md +14 -0
  48. data/docs/RealtimeSearchResponse.md +9 -0
  49. data/docs/SearchAggregation.md +11 -0
  50. data/docs/SearchApi.md +263 -0
  51. data/docs/SearchItem.md +20 -0
  52. data/docs/SearchItemFreight.md +9 -0
  53. data/docs/SearchItemFreightType.md +8 -0
  54. data/docs/SearchItemSeller.md +13 -0
  55. data/docs/SearchPriceOption.md +10 -0
  56. data/docs/SearchRequest.md +24 -0
  57. data/docs/SearchResponse.md +9 -0
  58. data/docs/SkuPriceOption.md +16 -0
  59. data/docs/SkuPriceOptionProperty.md +13 -0
  60. data/docs/SkuProperty.md +10 -0
  61. data/docs/SkuPropertyValue.md +10 -0
  62. data/docs/StringRange.md +9 -0
  63. data/docs/TimeDuration.md +11 -0
  64. data/docs/TradeInformation.md +9 -0
  65. data/docs/UploadImageByUrlRequest.md +8 -0
  66. data/docs/UploadImageResponse.md +8 -0
  67. data/docs/WebError.md +11 -0
  68. data/git_push.sh +55 -0
  69. data/lib/aliseeks_api.rb +100 -0
  70. data/lib/aliseeks_api/api/products_api.rb +337 -0
  71. data/lib/aliseeks_api/api/search_api.rb +288 -0
  72. data/lib/aliseeks_api/api_client.rb +389 -0
  73. data/lib/aliseeks_api/api_error.rb +38 -0
  74. data/lib/aliseeks_api/configuration.rb +251 -0
  75. data/lib/aliseeks_api/models/amount.rb +195 -0
  76. data/lib/aliseeks_api/models/best_selling_search_item.rb +257 -0
  77. data/lib/aliseeks_api/models/best_selling_search_request.rb +278 -0
  78. data/lib/aliseeks_api/models/best_selling_search_response.rb +187 -0
  79. data/lib/aliseeks_api/models/double_range.rb +193 -0
  80. data/lib/aliseeks_api/models/image_search_category.rb +195 -0
  81. data/lib/aliseeks_api/models/image_search_item.rb +224 -0
  82. data/lib/aliseeks_api/models/image_search_request.rb +240 -0
  83. data/lib/aliseeks_api/models/image_search_response.rb +209 -0
  84. data/lib/aliseeks_api/models/integer_range.rb +193 -0
  85. data/lib/aliseeks_api/models/non_realtime_currency.rb +48 -0
  86. data/lib/aliseeks_api/models/price_range.rb +193 -0
  87. data/lib/aliseeks_api/models/price_summary.rb +229 -0
  88. data/lib/aliseeks_api/models/product.rb +422 -0
  89. data/lib/aliseeks_api/models/product_attribute.rb +215 -0
  90. data/lib/aliseeks_api/models/product_bulk_option.rb +204 -0
  91. data/lib/aliseeks_api/models/product_detail.rb +353 -0
  92. data/lib/aliseeks_api/models/product_details_request.rb +230 -0
  93. data/lib/aliseeks_api/models/product_html_description.rb +185 -0
  94. data/lib/aliseeks_api/models/product_html_description_request.rb +185 -0
  95. data/lib/aliseeks_api/models/product_price_option.rb +240 -0
  96. data/lib/aliseeks_api/models/product_promotion.rb +194 -0
  97. data/lib/aliseeks_api/models/product_property_variation_identifier.rb +205 -0
  98. data/lib/aliseeks_api/models/product_request.rb +288 -0
  99. data/lib/aliseeks_api/models/product_request_component.rb +31 -0
  100. data/lib/aliseeks_api/models/product_review.rb +287 -0
  101. data/lib/aliseeks_api/models/product_reviews.rb +270 -0
  102. data/lib/aliseeks_api/models/product_reviews_request.rb +235 -0
  103. data/lib/aliseeks_api/models/product_seller.rb +225 -0
  104. data/lib/aliseeks_api/models/product_shipping.rb +187 -0
  105. data/lib/aliseeks_api/models/product_shipping_options.rb +253 -0
  106. data/lib/aliseeks_api/models/product_shipping_request.rb +256 -0
  107. data/lib/aliseeks_api/models/product_sku.rb +266 -0
  108. data/lib/aliseeks_api/models/product_skus.rb +187 -0
  109. data/lib/aliseeks_api/models/product_skus_request.rb +218 -0
  110. data/lib/aliseeks_api/models/promotion_option.rb +222 -0
  111. data/lib/aliseeks_api/models/realtime_currency.rb +45 -0
  112. data/lib/aliseeks_api/models/realtime_search_aggregation.rb +197 -0
  113. data/lib/aliseeks_api/models/realtime_search_item.rb +246 -0
  114. data/lib/aliseeks_api/models/realtime_search_request.rb +304 -0
  115. data/lib/aliseeks_api/models/realtime_search_response.rb +196 -0
  116. data/lib/aliseeks_api/models/search_aggregation.rb +215 -0
  117. data/lib/aliseeks_api/models/search_item.rb +304 -0
  118. data/lib/aliseeks_api/models/search_item_freight.rb +194 -0
  119. data/lib/aliseeks_api/models/search_item_freight_type.rb +185 -0
  120. data/lib/aliseeks_api/models/search_item_seller.rb +235 -0
  121. data/lib/aliseeks_api/models/search_price_option.rb +203 -0
  122. data/lib/aliseeks_api/models/search_request.rb +441 -0
  123. data/lib/aliseeks_api/models/search_response.rb +196 -0
  124. data/lib/aliseeks_api/models/sku_price_option.rb +264 -0
  125. data/lib/aliseeks_api/models/sku_price_option_property.rb +235 -0
  126. data/lib/aliseeks_api/models/sku_property.rb +207 -0
  127. data/lib/aliseeks_api/models/sku_property_value.rb +205 -0
  128. data/lib/aliseeks_api/models/string_range.rb +193 -0
  129. data/lib/aliseeks_api/models/time_duration.rb +211 -0
  130. data/lib/aliseeks_api/models/trade_information.rb +195 -0
  131. data/lib/aliseeks_api/models/upload_image_by_url_request.rb +185 -0
  132. data/lib/aliseeks_api/models/upload_image_response.rb +185 -0
  133. data/lib/aliseeks_api/models/web_error.rb +211 -0
  134. data/lib/aliseeks_api/version.rb +15 -0
  135. data/spec/api/products_api_spec.rb +101 -0
  136. data/spec/api/search_api_spec.rb +90 -0
  137. data/spec/api_client_spec.rb +226 -0
  138. data/spec/configuration_spec.rb +42 -0
  139. data/spec/models/amount_spec.rb +47 -0
  140. data/spec/models/best_selling_search_item_spec.rb +83 -0
  141. data/spec/models/best_selling_search_request_spec.rb +73 -0
  142. data/spec/models/best_selling_search_response_spec.rb +41 -0
  143. data/spec/models/double_range_spec.rb +47 -0
  144. data/spec/models/image_search_category_spec.rb +47 -0
  145. data/spec/models/image_search_item_spec.rb +65 -0
  146. data/spec/models/image_search_request_spec.rb +65 -0
  147. data/spec/models/image_search_response_spec.rb +53 -0
  148. data/spec/models/integer_range_spec.rb +47 -0
  149. data/spec/models/non_realtime_currency_spec.rb +35 -0
  150. data/spec/models/price_range_spec.rb +47 -0
  151. data/spec/models/price_summary_spec.rb +71 -0
  152. data/spec/models/product_attribute_spec.rb +59 -0
  153. data/spec/models/product_bulk_option_spec.rb +53 -0
  154. data/spec/models/product_detail_spec.rb +137 -0
  155. data/spec/models/product_details_request_spec.rb +65 -0
  156. data/spec/models/product_html_description_request_spec.rb +41 -0
  157. data/spec/models/product_html_description_spec.rb +41 -0
  158. data/spec/models/product_price_option_spec.rb +77 -0
  159. data/spec/models/product_promotion_spec.rb +47 -0
  160. data/spec/models/product_property_variation_identifier_spec.rb +53 -0
  161. data/spec/models/product_request_component_spec.rb +35 -0
  162. data/spec/models/product_request_spec.rb +83 -0
  163. data/spec/models/product_review_spec.rb +101 -0
  164. data/spec/models/product_reviews_request_spec.rb +53 -0
  165. data/spec/models/product_reviews_spec.rb +95 -0
  166. data/spec/models/product_seller_spec.rb +65 -0
  167. data/spec/models/product_shipping_options_spec.rb +83 -0
  168. data/spec/models/product_shipping_request_spec.rb +65 -0
  169. data/spec/models/product_shipping_spec.rb +41 -0
  170. data/spec/models/product_sku_spec.rb +89 -0
  171. data/spec/models/product_skus_request_spec.rb +59 -0
  172. data/spec/models/product_skus_spec.rb +41 -0
  173. data/spec/models/product_spec.rb +165 -0
  174. data/spec/models/promotion_option_spec.rb +65 -0
  175. data/spec/models/realtime_currency_spec.rb +35 -0
  176. data/spec/models/realtime_search_aggregation_spec.rb +47 -0
  177. data/spec/models/realtime_search_item_spec.rb +77 -0
  178. data/spec/models/realtime_search_request_spec.rb +81 -0
  179. data/spec/models/realtime_search_response_spec.rb +47 -0
  180. data/spec/models/search_aggregation_spec.rb +59 -0
  181. data/spec/models/search_item_freight_spec.rb +47 -0
  182. data/spec/models/search_item_freight_type_spec.rb +41 -0
  183. data/spec/models/search_item_seller_spec.rb +71 -0
  184. data/spec/models/search_item_spec.rb +113 -0
  185. data/spec/models/search_price_option_spec.rb +53 -0
  186. data/spec/models/search_request_spec.rb +145 -0
  187. data/spec/models/search_response_spec.rb +47 -0
  188. data/spec/models/sku_price_option_property_spec.rb +71 -0
  189. data/spec/models/sku_price_option_spec.rb +89 -0
  190. data/spec/models/sku_property_spec.rb +53 -0
  191. data/spec/models/sku_property_value_spec.rb +53 -0
  192. data/spec/models/string_range_spec.rb +47 -0
  193. data/spec/models/time_duration_spec.rb +59 -0
  194. data/spec/models/trade_information_spec.rb +47 -0
  195. data/spec/models/upload_image_by_url_request_spec.rb +41 -0
  196. data/spec/models/upload_image_response_spec.rb +41 -0
  197. data/spec/models/web_error_spec.rb +59 -0
  198. data/spec/spec_helper.rb +111 -0
  199. metadata +485 -0
@@ -0,0 +1,15 @@
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
+ module AliseeksApi
14
+ VERSION = '1.0.4'
15
+ end
@@ -0,0 +1,101 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for AliseeksApi::ProductsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'ProductsApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = AliseeksApi::ProductsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ProductsApi' do
30
+ it 'should create an instance of ProductsApi' do
31
+ expect(@instance).to be_instance_of(AliseeksApi::ProductsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_product
36
+ # Get products details as an aggregated request from AliExpress in realtime.
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [ProductRequest] :product_request The request body of get product
39
+ # @return [Product]
40
+ describe 'get_product test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for get_product_details
47
+ # Gets product details from AliExpress in realtime.
48
+ # @param product_details_request The request body to get product details
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [ProductDetail]
51
+ describe 'get_product_details test' do
52
+ it 'should work' do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ # unit tests for get_product_html_description
58
+ # Get product HTML description from AliExpress in realtime.
59
+ # @param product_html_description_request The request body to get product html description
60
+ # @param [Hash] opts the optional parameters
61
+ # @return [ProductHtmlDescription]
62
+ describe 'get_product_html_description test' do
63
+ it 'should work' do
64
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
65
+ end
66
+ end
67
+
68
+ # unit tests for get_product_reviews
69
+ # Get product reviews from AliExpress in realtime
70
+ # @param product_reviews_request The request body to get product reviews
71
+ # @param [Hash] opts the optional parameters
72
+ # @return [ProductReviews]
73
+ describe 'get_product_reviews test' do
74
+ it 'should work' do
75
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
76
+ end
77
+ end
78
+
79
+ # unit tests for get_product_shipping
80
+ # Gets product shipping information AliExpress in realtime.
81
+ # @param product_shipping_request The request body to get product shipping
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [ProductShipping]
84
+ describe 'get_product_shipping test' do
85
+ it 'should work' do
86
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
87
+ end
88
+ end
89
+
90
+ # unit tests for get_product_skus
91
+ # Gets product skus / variation information from AliExpress in realtime.
92
+ # @param product_skus_request The request body to get product skus / variations
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [ProductSkus]
95
+ describe 'get_product_skus test' do
96
+ it 'should work' do
97
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
98
+ end
99
+ end
100
+
101
+ end
@@ -0,0 +1,90 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for AliseeksApi::SearchApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'SearchApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = AliseeksApi::SearchApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of SearchApi' do
30
+ it 'should create an instance of SearchApi' do
31
+ expect(@instance).to be_instance_of(AliseeksApi::SearchApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for realtime_search
36
+ # Searches AliExpress in realtime
37
+ # @param realtime_search_request Realtime search request body
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [RealtimeSearchResponse]
40
+ describe 'realtime_search test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for search
47
+ # Searches AliExpress in non-realtime. Uses the Aliseeks.com datasource which is continually updated from AliExpress.
48
+ # @param search_request Search request body
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [SearchResponse]
51
+ describe 'search test' do
52
+ it 'should work' do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ # unit tests for search_best_selling
58
+ # Retrieves best selling products from AliExpress in realtime.
59
+ # @param best_selling_search_request Search best selling request body
60
+ # @param [Hash] opts the optional parameters
61
+ # @return [BestSellingSearchResponse]
62
+ describe 'search_best_selling test' do
63
+ it 'should work' do
64
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
65
+ end
66
+ end
67
+
68
+ # unit tests for search_by_image
69
+ # Searches AliExpress by image in realtime.
70
+ # @param image_search_request The image search request body
71
+ # @param [Hash] opts the optional parameters
72
+ # @return [ImageSearchResponse]
73
+ describe 'search_by_image test' do
74
+ it 'should work' do
75
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
76
+ end
77
+ end
78
+
79
+ # unit tests for upload_image_by_url
80
+ # Uploads an image to AliExpress to allow it to be used in the image search endpoint
81
+ # @param upload_image_by_url_request The upload image by url request body
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [UploadImageResponse]
84
+ describe 'upload_image_by_url test' do
85
+ it 'should work' do
86
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
87
+ end
88
+ end
89
+
90
+ end
@@ -0,0 +1,226 @@
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 'spec_helper'
14
+
15
+ describe AliseeksApi::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ AliseeksApi.configure { |c| c.host = 'http://example.com' }
21
+ expect(AliseeksApi::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ AliseeksApi.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(AliseeksApi::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ AliseeksApi.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(AliseeksApi::Configuration.default.host).to eq('hobo.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ AliseeksApi.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(AliseeksApi::Configuration.default.base_path).to eq('/v4/dog')
39
+ end
40
+
41
+ it "doesn't prepend a slash if one is already there" do
42
+ AliseeksApi.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(AliseeksApi::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ AliseeksApi.configure { |c| c.base_path = nil }
48
+ expect(AliseeksApi::Configuration.default.base_path).to eq('')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ describe 'params_encoding in #build_request' do
55
+ let(:config) { AliseeksApi::Configuration.new }
56
+ let(:api_client) { AliseeksApi::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(AliseeksApi::Configuration.default.params_encoding).to eq(nil)
60
+ expect(config.params_encoding).to eq(nil)
61
+
62
+ request = api_client.build_request(:get, '/test')
63
+ expect(request.options[:params_encoding]).to eq(nil)
64
+ end
65
+
66
+ it 'can be customized' do
67
+ config.params_encoding = :multi
68
+ request = api_client.build_request(:get, '/test')
69
+ expect(request.options[:params_encoding]).to eq(:multi)
70
+ end
71
+ end
72
+
73
+ describe 'timeout in #build_request' do
74
+ let(:config) { AliseeksApi::Configuration.new }
75
+ let(:api_client) { AliseeksApi::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(AliseeksApi::Configuration.default.timeout).to eq(0)
79
+ expect(config.timeout).to eq(0)
80
+
81
+ request = api_client.build_request(:get, '/test')
82
+ expect(request.options[:timeout]).to eq(0)
83
+ end
84
+
85
+ it 'can be customized' do
86
+ config.timeout = 100
87
+ request = api_client.build_request(:get, '/test')
88
+ expect(request.options[:timeout]).to eq(100)
89
+ end
90
+ end
91
+
92
+ describe '#deserialize' do
93
+ it "handles Array<Integer>" do
94
+ api_client = AliseeksApi::ApiClient.new
95
+ headers = { 'Content-Type' => 'application/json' }
96
+ response = double('response', headers: headers, body: '[12, 34]')
97
+ data = api_client.deserialize(response, 'Array<Integer>')
98
+ expect(data).to be_instance_of(Array)
99
+ expect(data).to eq([12, 34])
100
+ end
101
+
102
+ it 'handles Array<Array<Integer>>' do
103
+ api_client = AliseeksApi::ApiClient.new
104
+ headers = { 'Content-Type' => 'application/json' }
105
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
+ expect(data).to be_instance_of(Array)
108
+ expect(data).to eq([[12, 34], [56]])
109
+ end
110
+
111
+ it 'handles Hash<String, String>' do
112
+ api_client = AliseeksApi::ApiClient.new
113
+ headers = { 'Content-Type' => 'application/json' }
114
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
115
+ data = api_client.deserialize(response, 'Hash<String, String>')
116
+ expect(data).to be_instance_of(Hash)
117
+ expect(data).to eq(:message => 'Hello')
118
+ end
119
+ end
120
+
121
+ describe "#object_to_hash" do
122
+ it 'ignores nils and includes empty arrays' do
123
+ # uncomment below to test object_to_hash for model
124
+ # api_client = AliseeksApi::ApiClient.new
125
+ # _model = AliseeksApi::ModelName.new
126
+ # update the model attribute below
127
+ # _model.id = 1
128
+ # update the expected value (hash) below
129
+ # expected = {id: 1, name: '', tags: []}
130
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
131
+ end
132
+ end
133
+
134
+ describe '#build_collection_param' do
135
+ let(:param) { ['aa', 'bb', 'cc'] }
136
+ let(:api_client) { AliseeksApi::ApiClient.new }
137
+
138
+ it 'works for csv' do
139
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
+ end
141
+
142
+ it 'works for ssv' do
143
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
+ end
145
+
146
+ it 'works for tsv' do
147
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
+ end
149
+
150
+ it 'works for pipes' do
151
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
+ end
153
+
154
+ it 'works for multi' do
155
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
+ end
157
+
158
+ it 'fails for invalid collection format' do
159
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
+ end
161
+ end
162
+
163
+ describe '#json_mime?' do
164
+ let(:api_client) { AliseeksApi::ApiClient.new }
165
+
166
+ it 'works' do
167
+ expect(api_client.json_mime?(nil)).to eq false
168
+ expect(api_client.json_mime?('')).to eq false
169
+
170
+ expect(api_client.json_mime?('application/json')).to eq true
171
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
+
174
+ expect(api_client.json_mime?('application/xml')).to eq false
175
+ expect(api_client.json_mime?('text/plain')).to eq false
176
+ expect(api_client.json_mime?('application/jsonp')).to eq false
177
+ end
178
+ end
179
+
180
+ describe '#select_header_accept' do
181
+ let(:api_client) { AliseeksApi::ApiClient.new }
182
+
183
+ it 'works' do
184
+ expect(api_client.select_header_accept(nil)).to be_nil
185
+ expect(api_client.select_header_accept([])).to be_nil
186
+
187
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
+
191
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
+ end
194
+ end
195
+
196
+ describe '#select_header_content_type' do
197
+ let(:api_client) { AliseeksApi::ApiClient.new }
198
+
199
+ it 'works' do
200
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
+ expect(api_client.select_header_content_type([])).to eq('application/json')
202
+
203
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
+ end
209
+ end
210
+
211
+ describe '#sanitize_filename' do
212
+ let(:api_client) { AliseeksApi::ApiClient.new }
213
+
214
+ it 'works' do
215
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
216
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,42 @@
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 'spec_helper'
14
+
15
+ describe AliseeksApi::Configuration do
16
+ let(:config) { AliseeksApi::Configuration.default }
17
+
18
+ before(:each) do
19
+ # uncomment below to setup host and base_path
20
+ # require 'URI'
21
+ # uri = URI.parse("https://api.aliseeks.com/v1")
22
+ # AliseeksApi.configure do |c|
23
+ # c.host = uri.host
24
+ # c.base_path = uri.path
25
+ # end
26
+ end
27
+
28
+ describe '#base_url' do
29
+ it 'should have the default value' do
30
+ # uncomment below to test default value of the base path
31
+ # expect(config.base_url).to eq("https://api.aliseeks.com/v1")
32
+ end
33
+
34
+ it 'should remove trailing slashes' do
35
+ [nil, '', '/', '//'].each do |base_path|
36
+ config.base_path = base_path
37
+ # uncomment below to test trailing slashes
38
+ # expect(config.base_url).to eq("https://api.aliseeks.com/v1")
39
+ end
40
+ end
41
+ end
42
+ end