bombbomb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +201 -0
- data/README.md +139 -0
- data/Rakefile +3 -0
- data/bombbomb.gemspec +55 -0
- data/docs/BBWebHook.md +11 -0
- data/docs/InlineResponse200.md +9 -0
- data/docs/InlineResponse200Items.md +11 -0
- data/docs/JerichoConfiguration.md +18 -0
- data/docs/JerichoPerformance.md +18 -0
- data/docs/OAuthClient.md +13 -0
- data/docs/PromptsApi.md +169 -0
- data/docs/String.md +7 -0
- data/docs/TeamsApi.md +290 -0
- data/docs/UtilitiesApi.md +204 -0
- data/docs/VideoEmailPrompt.md +25 -0
- data/docs/WebhooksApi.md +207 -0
- data/git_push.sh +67 -0
- data/lib/bombbomb.rb +62 -0
- data/lib/bombbomb/api/prompts_api.rb +217 -0
- data/lib/bombbomb/api/teams_api.rb +346 -0
- data/lib/bombbomb/api/utilities_api.rb +258 -0
- data/lib/bombbomb/api/webhooks_api.rb +254 -0
- data/lib/bombbomb/api_client.rb +379 -0
- data/lib/bombbomb/api_error.rb +47 -0
- data/lib/bombbomb/configuration.rb +214 -0
- data/lib/bombbomb/models/bb_web_hook.rb +230 -0
- data/lib/bombbomb/models/inline_response_200.rb +210 -0
- data/lib/bombbomb/models/inline_response_200_items.rb +226 -0
- data/lib/bombbomb/models/jericho_configuration.rb +299 -0
- data/lib/bombbomb/models/jericho_performance.rb +300 -0
- data/lib/bombbomb/models/o_auth_client.rb +250 -0
- data/lib/bombbomb/models/string.rb +190 -0
- data/lib/bombbomb/models/video_email_prompt.rb +379 -0
- data/lib/bombbomb/version.rb +26 -0
- data/spec/api/prompts_api_spec.rb +84 -0
- data/spec/api/teams_api_spec.rb +113 -0
- data/spec/api/utilities_api_spec.rb +93 -0
- data/spec/api/webhooks_api_spec.rb +92 -0
- data/spec/api_client_spec.rb +237 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/models/bb_web_hook_spec.rb +71 -0
- data/spec/models/inline_response_200_items_spec.rb +71 -0
- data/spec/models/inline_response_200_spec.rb +59 -0
- data/spec/models/jericho_configuration_spec.rb +113 -0
- data/spec/models/jericho_performance_spec.rb +113 -0
- data/spec/models/o_auth_client_spec.rb +83 -0
- data/spec/models/string_spec.rb +47 -0
- data/spec/models/video_email_prompt_spec.rb +155 -0
- data/spec/spec_helper.rb +122 -0
- metadata +288 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
module BombBomb
|
25
|
+
VERSION = "1.0.0"
|
26
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'spec_helper'
|
25
|
+
require 'json'
|
26
|
+
|
27
|
+
# Unit tests for BombBomb::PromptsApi
|
28
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
29
|
+
# Please update as you see appropriate
|
30
|
+
describe 'PromptsApi' do
|
31
|
+
before do
|
32
|
+
# run before each test
|
33
|
+
@instance = BombBomb::PromptsApi.new
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
# run after each test
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test an instance of PromptsApi' do
|
41
|
+
it 'should create an instact of PromptsApi' do
|
42
|
+
expect(@instance).to be_instance_of(BombBomb::PromptsApi)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for create_video_email_prompt
|
47
|
+
# Prompts user to send a video
|
48
|
+
# Sends the account holder an email prompting them to add a video to a scheduled outgoing message. Recipients, content and timing is all preset for the user.
|
49
|
+
# @param prompt The Video Email Prompt to be created
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [VideoEmailPrompt]
|
52
|
+
describe 'create_video_email_prompt test' do
|
53
|
+
it "should work" do
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for get_video_email_prompt
|
59
|
+
# Gets a prompt
|
60
|
+
# Gets a prompt
|
61
|
+
# @param id The Id of the prompt
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [VideoEmailPrompt]
|
64
|
+
describe 'get_video_email_prompt 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 respond_to_video_email_prompt
|
71
|
+
# Respond to a prompt
|
72
|
+
# Respond to a prompt by either adding a video, sending without a video or cancelling the prompt.
|
73
|
+
# @param id The id of the prompt.
|
74
|
+
# @param choice The users' selection. Can be: WithVideo, WithoutVideo, Cancel
|
75
|
+
# @param [Hash] opts the optional parameters
|
76
|
+
# @option opts [String] :video_id The id of the video.
|
77
|
+
# @return [VideoEmailPrompt]
|
78
|
+
describe 'respond_to_video_email_prompt 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,113 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'spec_helper'
|
25
|
+
require 'json'
|
26
|
+
|
27
|
+
# Unit tests for BombBomb::TeamsApi
|
28
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
29
|
+
# Please update as you see appropriate
|
30
|
+
describe 'TeamsApi' do
|
31
|
+
before do
|
32
|
+
# run before each test
|
33
|
+
@instance = BombBomb::TeamsApi.new
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
# run after each test
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test an instance of TeamsApi' do
|
41
|
+
it 'should create an instact of TeamsApi' do
|
42
|
+
expect(@instance).to be_instance_of(BombBomb::TeamsApi)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for cancel_jericho_send
|
47
|
+
# Cancel a Jericho Send
|
48
|
+
# Cancels a scheduled Jericho send from being sent.
|
49
|
+
# @param jericho_id ID of the Jericho Job to cancel
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [nil]
|
52
|
+
describe 'cancel_jericho_send test' do
|
53
|
+
it "should work" do
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for get_client_group_assets
|
59
|
+
# Lists team assets
|
60
|
+
# Returns a collection of assets
|
61
|
+
# @param asset_type The type of assets.
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @option opts [String] :team_id The team containing the assets.
|
64
|
+
# @option opts [String] :auto_tag_name The auto tag name containing the assets.
|
65
|
+
# @option opts [String] :page_size The number of items to retrieve in a single db query.
|
66
|
+
# @option opts [String] :page Zero-based index of the page of data to retrieve from the db.
|
67
|
+
# @option opts [String] :search Search words.
|
68
|
+
# @return [InlineResponse200]
|
69
|
+
describe 'get_client_group_assets test' do
|
70
|
+
it "should work" do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# unit tests for get_jericho_sends
|
76
|
+
# List Jericho Sends
|
77
|
+
# Lists Jericho sends, both pending and sent.
|
78
|
+
# @param team_id The team whose Jericho sends you wish to see.
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [Array<JerichoConfiguration>]
|
81
|
+
describe 'get_jericho_sends test' do
|
82
|
+
it "should work" do
|
83
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# unit tests for get_jericho_stats
|
88
|
+
# Gets Jericho performance statistics
|
89
|
+
# Returns an aggregate view of the performance of a Jericho send
|
90
|
+
# @param jericho_id ID of the Jericho job
|
91
|
+
# @param team_id ID of team through which Jericho was sent
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @return [JerichoPerformance]
|
94
|
+
describe 'get_jericho_stats test' do
|
95
|
+
it "should work" do
|
96
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# unit tests for queue_jericho_send
|
101
|
+
# Creates a Jericho send.
|
102
|
+
# Sends email content on behalf of members of a client group. There are two forms this send can take: Static Email, and Video Prompt. Static emails require only an emailId. Video Prompts build emails dynamically and require most of the other fields. You must be an administrator of a Team Account to use this method.
|
103
|
+
# @param config JSON representing a Jericho configuration
|
104
|
+
# @param team_id The ID of the team.
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @return [JerichoConfiguration]
|
107
|
+
describe 'queue_jericho_send test' do
|
108
|
+
it "should work" do
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'spec_helper'
|
25
|
+
require 'json'
|
26
|
+
|
27
|
+
# Unit tests for BombBomb::UtilitiesApi
|
28
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
29
|
+
# Please update as you see appropriate
|
30
|
+
describe 'UtilitiesApi' do
|
31
|
+
before do
|
32
|
+
# run before each test
|
33
|
+
@instance = BombBomb::UtilitiesApi.new
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
# run after each test
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test an instance of UtilitiesApi' do
|
41
|
+
it 'should create an instact of UtilitiesApi' do
|
42
|
+
expect(@instance).to be_instance_of(BombBomb::UtilitiesApi)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for create_o_auth_client
|
47
|
+
# Create an OAuth Client
|
48
|
+
# Creates an OAuth Client managed by the user
|
49
|
+
# @param name The name of the OAuth client. e.g. MyCrm DEV, or MyCrm PROD
|
50
|
+
# @param redirect_uri The URI to direct the client to after logging in.
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [OAuthClient]
|
53
|
+
describe 'create_o_auth_client 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 delete_o_auth_client
|
60
|
+
# Delete an OAuth Client
|
61
|
+
# Deletes an OAuth Client managed by the user
|
62
|
+
# @param id The id of the OAuth Client
|
63
|
+
# @param [Hash] opts the optional parameters
|
64
|
+
# @return [nil]
|
65
|
+
describe 'delete_o_auth_client test' do
|
66
|
+
it "should work" do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# unit tests for get_o_auth_clients
|
72
|
+
# Lists OAuth Clients
|
73
|
+
# Enumerates OAuth Clients managed by the user
|
74
|
+
# @param [Hash] opts the optional parameters
|
75
|
+
# @return [Array<OAuthClient>]
|
76
|
+
describe 'get_o_auth_clients test' do
|
77
|
+
it "should work" do
|
78
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# unit tests for get_spec
|
83
|
+
# Describes this api
|
84
|
+
# Describes methods available through the API.
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @return [nil]
|
87
|
+
describe 'get_spec test' do
|
88
|
+
it "should work" do
|
89
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'spec_helper'
|
25
|
+
require 'json'
|
26
|
+
|
27
|
+
# Unit tests for BombBomb::WebhooksApi
|
28
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
29
|
+
# Please update as you see appropriate
|
30
|
+
describe 'WebhooksApi' do
|
31
|
+
before do
|
32
|
+
# run before each test
|
33
|
+
@instance = BombBomb::WebhooksApi.new
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
# run after each test
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test an instance of WebhooksApi' do
|
41
|
+
it 'should create an instact of WebhooksApi' do
|
42
|
+
expect(@instance).to be_instance_of(BombBomb::WebhooksApi)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for add_web_hook
|
47
|
+
# Add Webhook
|
48
|
+
# Idempotently adds a Webhook url
|
49
|
+
# @param hook_url The Url of your listener
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [BBWebHook]
|
52
|
+
describe 'add_web_hook test' do
|
53
|
+
it "should work" do
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for delete_web_hook
|
59
|
+
# Deletes Webhook
|
60
|
+
# Deletes a Webhook
|
61
|
+
# @param hook_id The id of the webhook to delete
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [String]
|
64
|
+
describe 'delete_web_hook 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_web_hooks
|
71
|
+
# Lists Webhooks
|
72
|
+
# Lists all registered Webhooks
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @return [Array<BBWebHook>]
|
75
|
+
describe 'get_web_hooks test' do
|
76
|
+
it "should work" do
|
77
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# unit tests for send_webhook_example
|
82
|
+
# Sends test Webhook
|
83
|
+
# Triggers a test webhook to be sent to your endpoints.
|
84
|
+
# @param [Hash] opts the optional parameters
|
85
|
+
# @return [nil]
|
86
|
+
describe 'send_webhook_example test' do
|
87
|
+
it "should work" do
|
88
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
=begin
|
2
|
+
#BombBomb
|
3
|
+
|
4
|
+
#We make it easy to build relationships using simple videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'spec_helper'
|
25
|
+
|
26
|
+
describe BombBomb::ApiClient do
|
27
|
+
context 'initialization' do
|
28
|
+
context 'URL stuff' do
|
29
|
+
context 'host' do
|
30
|
+
it 'removes http from host' do
|
31
|
+
BombBomb.configure { |c| c.host = 'http://example.com' }
|
32
|
+
expect(BombBomb::Configuration.default.host).to eq('example.com')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'removes https from host' do
|
36
|
+
BombBomb.configure { |c| c.host = 'https://wookiee.com' }
|
37
|
+
expect(BombBomb::ApiClient.default.config.host).to eq('wookiee.com')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'removes trailing path from host' do
|
41
|
+
BombBomb.configure { |c| c.host = 'hobo.com/v4' }
|
42
|
+
expect(BombBomb::Configuration.default.host).to eq('hobo.com')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'base_path' do
|
47
|
+
it "prepends a slash to base_path" do
|
48
|
+
BombBomb.configure { |c| c.base_path = 'v4/dog' }
|
49
|
+
expect(BombBomb::Configuration.default.base_path).to eq('/v4/dog')
|
50
|
+
end
|
51
|
+
|
52
|
+
it "doesn't prepend a slash if one is already there" do
|
53
|
+
BombBomb.configure { |c| c.base_path = '/v4/dog' }
|
54
|
+
expect(BombBomb::Configuration.default.base_path).to eq('/v4/dog')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "ends up as a blank string if nil" do
|
58
|
+
BombBomb.configure { |c| c.base_path = nil }
|
59
|
+
expect(BombBomb::Configuration.default.base_path).to eq('')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "params_encoding in #build_request" do
|
66
|
+
let(:config) { BombBomb::Configuration.new }
|
67
|
+
let(:api_client) { BombBomb::ApiClient.new(config) }
|
68
|
+
|
69
|
+
it "defaults to nil" do
|
70
|
+
expect(BombBomb::Configuration.default.params_encoding).to eq(nil)
|
71
|
+
expect(config.params_encoding).to eq(nil)
|
72
|
+
|
73
|
+
request = api_client.build_request(:get, '/test')
|
74
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "can be customized" do
|
78
|
+
config.params_encoding = :multi
|
79
|
+
request = api_client.build_request(:get, '/test')
|
80
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "timeout in #build_request" do
|
85
|
+
let(:config) { BombBomb::Configuration.new }
|
86
|
+
let(:api_client) { BombBomb::ApiClient.new(config) }
|
87
|
+
|
88
|
+
it "defaults to 0" do
|
89
|
+
expect(BombBomb::Configuration.default.timeout).to eq(0)
|
90
|
+
expect(config.timeout).to eq(0)
|
91
|
+
|
92
|
+
request = api_client.build_request(:get, '/test')
|
93
|
+
expect(request.options[:timeout]).to eq(0)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can be customized" do
|
97
|
+
config.timeout = 100
|
98
|
+
request = api_client.build_request(:get, '/test')
|
99
|
+
expect(request.options[:timeout]).to eq(100)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#deserialize" do
|
104
|
+
it "handles Array<Integer>" do
|
105
|
+
api_client = BombBomb::ApiClient.new
|
106
|
+
headers = {'Content-Type' => 'application/json'}
|
107
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
108
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
109
|
+
expect(data).to be_instance_of(Array)
|
110
|
+
expect(data).to eq([12, 34])
|
111
|
+
end
|
112
|
+
|
113
|
+
it "handles Array<Array<Integer>>" do
|
114
|
+
api_client = BombBomb::ApiClient.new
|
115
|
+
headers = {'Content-Type' => 'application/json'}
|
116
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
117
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
118
|
+
expect(data).to be_instance_of(Array)
|
119
|
+
expect(data).to eq([[12, 34], [56]])
|
120
|
+
end
|
121
|
+
|
122
|
+
it "handles Hash<String, String>" do
|
123
|
+
api_client = BombBomb::ApiClient.new
|
124
|
+
headers = {'Content-Type' => 'application/json'}
|
125
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
126
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
127
|
+
expect(data).to be_instance_of(Hash)
|
128
|
+
expect(data).to eq({:message => 'Hello'})
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "#object_to_hash" do
|
133
|
+
it "ignores nils and includes empty arrays" do
|
134
|
+
# uncomment below to test object_to_hash for model
|
135
|
+
#api_client = BombBomb::ApiClient.new
|
136
|
+
#_model = BombBomb::ModelName.new
|
137
|
+
# update the model attribute below
|
138
|
+
#_model.id = 1
|
139
|
+
# update the expected value (hash) below
|
140
|
+
#expected = {id: 1, name: '', tags: []}
|
141
|
+
#expect(api_client.object_to_hash(_model)).to eq(expected)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "#build_collection_param" do
|
146
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
147
|
+
let(:api_client) { BombBomb::ApiClient.new }
|
148
|
+
|
149
|
+
it "works for csv" do
|
150
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
151
|
+
end
|
152
|
+
|
153
|
+
it "works for ssv" do
|
154
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
155
|
+
end
|
156
|
+
|
157
|
+
it "works for tsv" do
|
158
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
159
|
+
end
|
160
|
+
|
161
|
+
it "works for pipes" do
|
162
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
163
|
+
end
|
164
|
+
|
165
|
+
it "works for multi" do
|
166
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
167
|
+
end
|
168
|
+
|
169
|
+
it "fails for invalid collection format" do
|
170
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe "#json_mime?" do
|
175
|
+
let(:api_client) { BombBomb::ApiClient.new }
|
176
|
+
|
177
|
+
it "works" do
|
178
|
+
expect(api_client.json_mime?(nil)).to eq false
|
179
|
+
expect(api_client.json_mime?('')).to eq false
|
180
|
+
|
181
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
182
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
183
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
184
|
+
|
185
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
186
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
187
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe "#select_header_accept" do
|
192
|
+
let(:api_client) { BombBomb::ApiClient.new }
|
193
|
+
|
194
|
+
it "works" do
|
195
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
196
|
+
expect(api_client.select_header_accept([])).to be_nil
|
197
|
+
|
198
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
199
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
200
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
201
|
+
|
202
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
203
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
describe "#select_header_content_type" do
|
208
|
+
let(:api_client) { BombBomb::ApiClient.new }
|
209
|
+
|
210
|
+
it "works" do
|
211
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
212
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
213
|
+
|
214
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
215
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
216
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
217
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
218
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe "#sanitize_filename" do
|
223
|
+
let(:api_client) { BombBomb::ApiClient.new }
|
224
|
+
|
225
|
+
it "works" do
|
226
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
227
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
228
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
229
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
230
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
231
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
232
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
233
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
234
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|