sezzle_client 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +611 -0
- data/Rakefile +8 -0
- data/docs/Address.md +14 -0
- data/docs/AllOfSessionCustomer.md +13 -0
- data/docs/AllOfSessionOrder.md +18 -0
- data/docs/Authorization.md +14 -0
- data/docs/BearerAuthenticationApi.md +52 -0
- data/docs/Body.md +8 -0
- data/docs/Body1.md +7 -0
- data/docs/Body2.md +6 -0
- data/docs/Body3.md +8 -0
- data/docs/Body4.md +8 -0
- data/docs/Capture.md +8 -0
- data/docs/Customer.md +13 -0
- data/docs/CustomerApi.md +269 -0
- data/docs/Discount.md +8 -0
- data/docs/Error.md +6 -0
- data/docs/ErrorInner.md +10 -0
- data/docs/InlineResponse200.md +10 -0
- data/docs/InlineResponse2001.md +15 -0
- data/docs/InlineResponse2002.md +9 -0
- data/docs/InlineResponse2003.md +15 -0
- data/docs/InlineResponse2004.md +8 -0
- data/docs/InlineResponse2005.md +12 -0
- data/docs/InlineResponse2006.md +7 -0
- data/docs/InlineResponse2007.md +14 -0
- data/docs/InlineResponse2008.md +8 -0
- data/docs/InlineResponse2009.md +7 -0
- data/docs/InlineResponse200Order.md +10 -0
- data/docs/InlineResponse201.md +9 -0
- data/docs/InlineResponse2011.md +10 -0
- data/docs/InlineResponse2011Order.md +9 -0
- data/docs/InlineResponse2011Tokenize.md +10 -0
- data/docs/InstallmentPlan.md +6 -0
- data/docs/Intent.md +6 -0
- data/docs/LineItem.md +10 -0
- data/docs/Link.md +9 -0
- data/docs/Notification.md +9 -0
- data/docs/Order.md +15 -0
- data/docs/OrderApi.md +391 -0
- data/docs/OrderAuthorization.md +12 -0
- data/docs/Payout.md +6 -0
- data/docs/PayoutInner.md +12 -0
- data/docs/Price.md +8 -0
- data/docs/Refund.md +8 -0
- data/docs/ReportsApi.md +230 -0
- data/docs/Session.md +10 -0
- data/docs/SessionApi.md +113 -0
- data/docs/SessionCancelUrl.md +8 -0
- data/docs/SessionStatus.md +8 -0
- data/docs/Token.md +10 -0
- data/docs/TokenApi.md +110 -0
- data/docs/Webhook.md +8 -0
- data/docs/WebhooksApi.md +157 -0
- data/git_push.sh +55 -0
- data/lib/sezzle_client.rb +90 -0
- data/lib/sezzle_client/api/bearer_authentication_api.rb +76 -0
- data/lib/sezzle_client/api/customer_api.rb +295 -0
- data/lib/sezzle_client/api/order_api.rb +430 -0
- data/lib/sezzle_client/api/reports_api.rb +253 -0
- data/lib/sezzle_client/api/session_api.rb +132 -0
- data/lib/sezzle_client/api/token_api.rb +126 -0
- data/lib/sezzle_client/api/webhooks_api.rb +178 -0
- data/lib/sezzle_client/api_client.rb +388 -0
- data/lib/sezzle_client/api_error.rb +57 -0
- data/lib/sezzle_client/configuration.rb +205 -0
- data/lib/sezzle_client/models/address.rb +297 -0
- data/lib/sezzle_client/models/all_of_session_customer.rb +260 -0
- data/lib/sezzle_client/models/all_of_session_order.rb +314 -0
- data/lib/sezzle_client/models/authorization.rb +281 -0
- data/lib/sezzle_client/models/body.rb +215 -0
- data/lib/sezzle_client/models/body_1.rb +206 -0
- data/lib/sezzle_client/models/body_2.rb +197 -0
- data/lib/sezzle_client/models/body_3.rb +215 -0
- data/lib/sezzle_client/models/body_4.rb +215 -0
- data/lib/sezzle_client/models/capture.rb +215 -0
- data/lib/sezzle_client/models/customer.rb +260 -0
- data/lib/sezzle_client/models/discount.rb +225 -0
- data/lib/sezzle_client/models/error.rb +201 -0
- data/lib/sezzle_client/models/error_inner.rb +233 -0
- data/lib/sezzle_client/models/inline_response_200.rb +239 -0
- data/lib/sezzle_client/models/inline_response_200_1.rb +286 -0
- data/lib/sezzle_client/models/inline_response_200_2.rb +226 -0
- data/lib/sezzle_client/models/inline_response_200_3.rb +284 -0
- data/lib/sezzle_client/models/inline_response_200_4.rb +215 -0
- data/lib/sezzle_client/models/inline_response_200_5.rb +257 -0
- data/lib/sezzle_client/models/inline_response_200_6.rb +206 -0
- data/lib/sezzle_client/models/inline_response_200_7.rb +277 -0
- data/lib/sezzle_client/models/inline_response_200_8.rb +217 -0
- data/lib/sezzle_client/models/inline_response_200_9.rb +206 -0
- data/lib/sezzle_client/models/inline_response_200_order.rb +235 -0
- data/lib/sezzle_client/models/inline_response_201.rb +224 -0
- data/lib/sezzle_client/models/inline_response_201_1.rb +235 -0
- data/lib/sezzle_client/models/inline_response_201_1_order.rb +226 -0
- data/lib/sezzle_client/models/inline_response_201_1_tokenize.rb +235 -0
- data/lib/sezzle_client/models/installment_plan.rb +28 -0
- data/lib/sezzle_client/models/intent.rb +28 -0
- data/lib/sezzle_client/models/line_item.rb +253 -0
- data/lib/sezzle_client/models/link.rb +224 -0
- data/lib/sezzle_client/models/notification.rb +224 -0
- data/lib/sezzle_client/models/order.rb +284 -0
- data/lib/sezzle_client/models/order_authorization.rb +257 -0
- data/lib/sezzle_client/models/payout.rb +201 -0
- data/lib/sezzle_client/models/payout_inner.rb +251 -0
- data/lib/sezzle_client/models/price.rb +225 -0
- data/lib/sezzle_client/models/refund.rb +215 -0
- data/lib/sezzle_client/models/session.rb +243 -0
- data/lib/sezzle_client/models/session_cancel_url.rb +215 -0
- data/lib/sezzle_client/models/session_status.rb +217 -0
- data/lib/sezzle_client/models/token.rb +235 -0
- data/lib/sezzle_client/models/webhook.rb +222 -0
- data/lib/sezzle_client/version.rb +14 -0
- data/sezzle_client.gemspec +38 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/bearer_authentication_api_spec.rb +45 -0
- data/spec/api/customer_api_spec.rb +91 -0
- data/spec/api/order_api_spec.rb +119 -0
- data/spec/api/reports_api_spec.rb +84 -0
- data/spec/api/session_api_spec.rb +57 -0
- data/spec/api/token_api_spec.rb +56 -0
- data/spec/api/webhooks_api_spec.rb +66 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/address_spec.rb +82 -0
- data/spec/models/all_of_session_customer_spec.rb +76 -0
- data/spec/models/all_of_session_order_spec.rb +106 -0
- data/spec/models/authorization_spec.rb +82 -0
- data/spec/models/body_1_spec.rb +40 -0
- data/spec/models/body_2_spec.rb +34 -0
- data/spec/models/body_3_spec.rb +46 -0
- data/spec/models/body_4_spec.rb +46 -0
- data/spec/models/body_spec.rb +46 -0
- data/spec/models/capture_spec.rb +46 -0
- data/spec/models/customer_spec.rb +76 -0
- data/spec/models/discount_spec.rb +46 -0
- data/spec/models/error_inner_spec.rb +58 -0
- data/spec/models/error_spec.rb +34 -0
- data/spec/models/inline_response_200_1_spec.rb +88 -0
- data/spec/models/inline_response_200_2_spec.rb +52 -0
- data/spec/models/inline_response_200_3_spec.rb +88 -0
- data/spec/models/inline_response_200_4_spec.rb +46 -0
- data/spec/models/inline_response_200_5_spec.rb +70 -0
- data/spec/models/inline_response_200_6_spec.rb +40 -0
- data/spec/models/inline_response_200_7_spec.rb +82 -0
- data/spec/models/inline_response_200_8_spec.rb +46 -0
- data/spec/models/inline_response_200_9_spec.rb +40 -0
- data/spec/models/inline_response_200_order_spec.rb +58 -0
- data/spec/models/inline_response_200_spec.rb +58 -0
- data/spec/models/inline_response_201_1_order_spec.rb +52 -0
- data/spec/models/inline_response_201_1_spec.rb +58 -0
- data/spec/models/inline_response_201_1_tokenize_spec.rb +58 -0
- data/spec/models/inline_response_201_spec.rb +52 -0
- data/spec/models/installment_plan_spec.rb +34 -0
- data/spec/models/intent_spec.rb +34 -0
- data/spec/models/line_item_spec.rb +58 -0
- data/spec/models/link_spec.rb +52 -0
- data/spec/models/notification_spec.rb +52 -0
- data/spec/models/order_authorization_spec.rb +70 -0
- data/spec/models/order_spec.rb +88 -0
- data/spec/models/payout_inner_spec.rb +70 -0
- data/spec/models/payout_spec.rb +34 -0
- data/spec/models/price_spec.rb +46 -0
- data/spec/models/refund_spec.rb +46 -0
- data/spec/models/session_cancel_url_spec.rb +46 -0
- data/spec/models/session_spec.rb +58 -0
- data/spec/models/session_status_spec.rb +46 -0
- data/spec/models/token_spec.rb +58 -0
- data/spec/models/webhook_spec.rb +46 -0
- data/spec/spec_helper.rb +110 -0
- metadata +331 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
=begin
|
2
|
+
#Sezzle API
|
3
|
+
|
4
|
+
#The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.25
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for SezzleClient::ReportsApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'ReportsApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = SezzleClient::ReportsApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of ReportsApi' do
|
29
|
+
it 'should create an instance of ReportsApi' do
|
30
|
+
expect(@instance).to be_instance_of(SezzleClient::ReportsApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for get_interest_account_activity
|
35
|
+
# Interest Account Activity
|
36
|
+
# @param start_date Start Date
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :end_date End Date
|
39
|
+
# @option opts [String] :offset Pagination Offset (Limit 20)
|
40
|
+
# @option opts [String] :currency_code ISO-4217 Currency Code
|
41
|
+
# @return [String]
|
42
|
+
describe 'get_interest_account_activity test' do
|
43
|
+
it 'should work' do
|
44
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# unit tests for get_interest_account_balance
|
49
|
+
# Interest Account Balance
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @option opts [String] :currency_code ISO-4217 Currency Code
|
52
|
+
# @return [InlineResponse2009]
|
53
|
+
describe 'get_interest_account_balance test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for get_settlement_details
|
60
|
+
# Settlement Details
|
61
|
+
# @param payout_uuid Payout UUID
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [String]
|
64
|
+
describe 'get_settlement_details test' do
|
65
|
+
it 'should work' do
|
66
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# unit tests for get_settlement_summaries
|
71
|
+
# Settlement Summaries
|
72
|
+
# @param start_date Start Date
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @option opts [String] :end_date End Date
|
75
|
+
# @option opts [String] :offset Pagination Offset (Limit 20)
|
76
|
+
# @option opts [String] :currency_code ISO-4217 Currency Code
|
77
|
+
# @return [Payout]
|
78
|
+
describe 'get_settlement_summaries test' do
|
79
|
+
it 'should work' do
|
80
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
=begin
|
2
|
+
#Sezzle API
|
3
|
+
|
4
|
+
#The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.25
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for SezzleClient::SessionApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'SessionApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = SezzleClient::SessionApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of SessionApi' do
|
29
|
+
it 'should create an instance of SessionApi' do
|
30
|
+
expect(@instance).to be_instance_of(SezzleClient::SessionApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for get_v2_session
|
35
|
+
# Get session status
|
36
|
+
# @param session_uuid Session UUID
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [InlineResponse200]
|
39
|
+
describe 'get_v2_session test' do
|
40
|
+
it 'should work' do
|
41
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# unit tests for post_v2_session
|
46
|
+
# Create a new session
|
47
|
+
# Create new customer checkout and/or tokenize customer
|
48
|
+
# @param body Session request
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @return [InlineResponse2011]
|
51
|
+
describe 'post_v2_session 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
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
=begin
|
2
|
+
#Sezzle API
|
3
|
+
|
4
|
+
#The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.25
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for SezzleClient::TokenApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'TokenApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = SezzleClient::TokenApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of TokenApi' do
|
29
|
+
it 'should create an instance of TokenApi' do
|
30
|
+
expect(@instance).to be_instance_of(SezzleClient::TokenApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for get_v2_customer_token
|
35
|
+
# Get customer token
|
36
|
+
# @param token Customer initiated token, e.g. generated in mobile app
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [nil]
|
39
|
+
describe 'get_v2_customer_token test' do
|
40
|
+
it 'should work' do
|
41
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# unit tests for get_v2_session_token
|
46
|
+
# Get session token
|
47
|
+
# @param token Merchant initiated token
|
48
|
+
# @param [Hash] opts the optional parameters
|
49
|
+
# @return [Token]
|
50
|
+
describe 'get_v2_session_token test' do
|
51
|
+
it 'should work' do
|
52
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
=begin
|
2
|
+
#Sezzle API
|
3
|
+
|
4
|
+
#The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.25
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for SezzleClient::WebhooksApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'WebhooksApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = SezzleClient::WebhooksApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of WebhooksApi' do
|
29
|
+
it 'should create an instance of WebhooksApi' do
|
30
|
+
expect(@instance).to be_instance_of(SezzleClient::WebhooksApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for delete_v2_webhooks
|
35
|
+
# Delete webhooks
|
36
|
+
# @param webhooks_uuid Webhooks UUID
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [nil]
|
39
|
+
describe 'delete_v2_webhooks test' do
|
40
|
+
it 'should work' do
|
41
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# unit tests for get_v2_webhooks
|
46
|
+
# List webhooks
|
47
|
+
# @param [Hash] opts the optional parameters
|
48
|
+
# @return [Array<null>]
|
49
|
+
describe 'get_v2_webhooks test' do
|
50
|
+
it 'should work' do
|
51
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# unit tests for post_v2_webhooks
|
56
|
+
# Create webhooks
|
57
|
+
# @param body Webhooks request
|
58
|
+
# @param [Hash] opts the optional parameters
|
59
|
+
# @return [InlineResponse2008]
|
60
|
+
describe 'post_v2_webhooks test' do
|
61
|
+
it 'should work' do
|
62
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
#Sezzle API
|
3
|
+
|
4
|
+
#The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.25
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe SezzleClient::ApiClient do
|
15
|
+
context 'initialization' do
|
16
|
+
context 'URL stuff' do
|
17
|
+
context 'host' do
|
18
|
+
it 'removes http from host' do
|
19
|
+
SezzleClient.configure { |c| c.host = 'http://example.com' }
|
20
|
+
expect(SezzleClient::Configuration.default.host).to eq('example.com')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'removes https from host' do
|
24
|
+
SezzleClient.configure { |c| c.host = 'https://wookiee.com' }
|
25
|
+
expect(SezzleClient::ApiClient.default.config.host).to eq('wookiee.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'removes trailing path from host' do
|
29
|
+
SezzleClient.configure { |c| c.host = 'hobo.com/v4' }
|
30
|
+
expect(SezzleClient::Configuration.default.host).to eq('hobo.com')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'base_path' do
|
35
|
+
it "prepends a slash to base_path" do
|
36
|
+
SezzleClient.configure { |c| c.base_path = 'v4/dog' }
|
37
|
+
expect(SezzleClient::Configuration.default.base_path).to eq('/v4/dog')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "doesn't prepend a slash if one is already there" do
|
41
|
+
SezzleClient.configure { |c| c.base_path = '/v4/dog' }
|
42
|
+
expect(SezzleClient::Configuration.default.base_path).to eq('/v4/dog')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "ends up as a blank string if nil" do
|
46
|
+
SezzleClient.configure { |c| c.base_path = nil }
|
47
|
+
expect(SezzleClient::Configuration.default.base_path).to eq('')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'params_encoding in #build_request' do
|
54
|
+
let(:config) { SezzleClient::Configuration.new }
|
55
|
+
let(:api_client) { SezzleClient::ApiClient.new(config) }
|
56
|
+
|
57
|
+
it 'defaults to nil' do
|
58
|
+
expect(SezzleClient::Configuration.default.params_encoding).to eq(nil)
|
59
|
+
expect(config.params_encoding).to eq(nil)
|
60
|
+
|
61
|
+
request = api_client.build_request(:get, '/test')
|
62
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'can be customized' do
|
66
|
+
config.params_encoding = :multi
|
67
|
+
request = api_client.build_request(:get, '/test')
|
68
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'timeout in #build_request' do
|
73
|
+
let(:config) { SezzleClient::Configuration.new }
|
74
|
+
let(:api_client) { SezzleClient::ApiClient.new(config) }
|
75
|
+
|
76
|
+
it 'defaults to 0' do
|
77
|
+
expect(SezzleClient::Configuration.default.timeout).to eq(0)
|
78
|
+
expect(config.timeout).to eq(0)
|
79
|
+
|
80
|
+
request = api_client.build_request(:get, '/test')
|
81
|
+
expect(request.options[:timeout]).to eq(0)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can be customized' do
|
85
|
+
config.timeout = 100
|
86
|
+
request = api_client.build_request(:get, '/test')
|
87
|
+
expect(request.options[:timeout]).to eq(100)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#deserialize' do
|
92
|
+
it "handles Array<Integer>" do
|
93
|
+
api_client = SezzleClient::ApiClient.new
|
94
|
+
headers = { 'Content-Type' => 'application/json' }
|
95
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
96
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
97
|
+
expect(data).to be_instance_of(Array)
|
98
|
+
expect(data).to eq([12, 34])
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'handles Array<Array<Integer>>' do
|
102
|
+
api_client = SezzleClient::ApiClient.new
|
103
|
+
headers = { 'Content-Type' => 'application/json' }
|
104
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
105
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
106
|
+
expect(data).to be_instance_of(Array)
|
107
|
+
expect(data).to eq([[12, 34], [56]])
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'handles Hash<String, String>' do
|
111
|
+
api_client = SezzleClient::ApiClient.new
|
112
|
+
headers = { 'Content-Type' => 'application/json' }
|
113
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
114
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
115
|
+
expect(data).to be_instance_of(Hash)
|
116
|
+
expect(data).to eq(:message => 'Hello')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#object_to_hash" do
|
121
|
+
it 'ignores nils and includes empty arrays' do
|
122
|
+
# uncomment below to test object_to_hash for model
|
123
|
+
# api_client = SezzleClient::ApiClient.new
|
124
|
+
# _model = SezzleClient::ModelName.new
|
125
|
+
# update the model attribute below
|
126
|
+
# _model.id = 1
|
127
|
+
# update the expected value (hash) below
|
128
|
+
# expected = {id: 1, name: '', tags: []}
|
129
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe '#build_collection_param' do
|
134
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
135
|
+
let(:api_client) { SezzleClient::ApiClient.new }
|
136
|
+
|
137
|
+
it 'works for csv' do
|
138
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'works for ssv' do
|
142
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'works for tsv' do
|
146
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'works for pipes' do
|
150
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'works for multi' do
|
154
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'fails for invalid collection format' do
|
158
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#json_mime?' do
|
163
|
+
let(:api_client) { SezzleClient::ApiClient.new }
|
164
|
+
|
165
|
+
it 'works' do
|
166
|
+
expect(api_client.json_mime?(nil)).to eq false
|
167
|
+
expect(api_client.json_mime?('')).to eq false
|
168
|
+
|
169
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
170
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
171
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
172
|
+
|
173
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
174
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
175
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '#select_header_accept' do
|
180
|
+
let(:api_client) { SezzleClient::ApiClient.new }
|
181
|
+
|
182
|
+
it 'works' do
|
183
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
184
|
+
expect(api_client.select_header_accept([])).to be_nil
|
185
|
+
|
186
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
187
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
188
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
189
|
+
|
190
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
191
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe '#select_header_content_type' do
|
196
|
+
let(:api_client) { SezzleClient::ApiClient.new }
|
197
|
+
|
198
|
+
it 'works' do
|
199
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
200
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
201
|
+
|
202
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
203
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
204
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
205
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
206
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe '#sanitize_filename' do
|
211
|
+
let(:api_client) { SezzleClient::ApiClient.new }
|
212
|
+
|
213
|
+
it 'works' do
|
214
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
215
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
216
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|