rainbow-submarine-test-3356 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +150 -0
  4. data/Rakefile +8 -0
  5. data/docs/AppUser.md +14 -0
  6. data/docs/AppUserApi.md +616 -0
  7. data/docs/AppUserLink.md +9 -0
  8. data/docs/AppUserPreCreate.md +14 -0
  9. data/docs/AppUserResponse.md +8 -0
  10. data/docs/AppUserUpdate.md +12 -0
  11. data/docs/Client.md +12 -0
  12. data/docs/ClientInfo.md +15 -0
  13. data/docs/ClientResponse.md +8 -0
  14. data/docs/Conversation.md +9 -0
  15. data/docs/ConversationApi.md +192 -0
  16. data/docs/DeviceUpdate.md +10 -0
  17. data/docs/Event.md +8 -0
  18. data/docs/GetMessagesResponse.md +10 -0
  19. data/docs/Menu.md +9 -0
  20. data/docs/MenuApi.md +163 -0
  21. data/docs/MenuItem.md +13 -0
  22. data/docs/MenuResponse.md +8 -0
  23. data/docs/Message.md +17 -0
  24. data/docs/MessageResponse.md +9 -0
  25. data/docs/Postback.md +11 -0
  26. data/docs/TrackEventResponse.md +8 -0
  27. data/docs/TypingActivityTrigger.md +11 -0
  28. data/git_push.sh +55 -0
  29. data/lib/rainbow-submarine-test-3356.rb +61 -0
  30. data/lib/rainbow-submarine-test-3356/api/app_user_api.rb +585 -0
  31. data/lib/rainbow-submarine-test-3356/api/conversation_api.rb +189 -0
  32. data/lib/rainbow-submarine-test-3356/api/menu_api.rb +173 -0
  33. data/lib/rainbow-submarine-test-3356/api_client.rb +376 -0
  34. data/lib/rainbow-submarine-test-3356/api_error.rb +37 -0
  35. data/lib/rainbow-submarine-test-3356/configuration.rb +209 -0
  36. data/lib/rainbow-submarine-test-3356/models/app_user.rb +258 -0
  37. data/lib/rainbow-submarine-test-3356/models/app_user_link.rb +201 -0
  38. data/lib/rainbow-submarine-test-3356/models/app_user_pre_create.rb +246 -0
  39. data/lib/rainbow-submarine-test-3356/models/app_user_response.rb +192 -0
  40. data/lib/rainbow-submarine-test-3356/models/app_user_update.rb +223 -0
  41. data/lib/rainbow-submarine-test-3356/models/client.rb +248 -0
  42. data/lib/rainbow-submarine-test-3356/models/client_info.rb +250 -0
  43. data/lib/rainbow-submarine-test-3356/models/client_response.rb +187 -0
  44. data/lib/rainbow-submarine-test-3356/models/conversation.rb +206 -0
  45. data/lib/rainbow-submarine-test-3356/models/device_update.rb +205 -0
  46. data/lib/rainbow-submarine-test-3356/models/event.rb +192 -0
  47. data/lib/rainbow-submarine-test-3356/models/get_messages_response.rb +207 -0
  48. data/lib/rainbow-submarine-test-3356/models/menu.rb +203 -0
  49. data/lib/rainbow-submarine-test-3356/models/menu_item.rb +242 -0
  50. data/lib/rainbow-submarine-test-3356/models/menu_response.rb +192 -0
  51. data/lib/rainbow-submarine-test-3356/models/message.rb +303 -0
  52. data/lib/rainbow-submarine-test-3356/models/message_response.rb +206 -0
  53. data/lib/rainbow-submarine-test-3356/models/postback.rb +229 -0
  54. data/lib/rainbow-submarine-test-3356/models/track_event_response.rb +187 -0
  55. data/lib/rainbow-submarine-test-3356/models/typing_activity_trigger.rb +224 -0
  56. data/lib/rainbow-submarine-test-3356/version.rb +14 -0
  57. data/lib/swagger_client.rb +61 -0
  58. data/lib/swagger_client/api/app_user_api.rb +585 -0
  59. data/lib/swagger_client/api/conversation_api.rb +189 -0
  60. data/lib/swagger_client/api/menu_api.rb +173 -0
  61. data/lib/swagger_client/api_client.rb +376 -0
  62. data/lib/swagger_client/api_error.rb +37 -0
  63. data/lib/swagger_client/configuration.rb +209 -0
  64. data/lib/swagger_client/models/app_user.rb +258 -0
  65. data/lib/swagger_client/models/app_user_link.rb +201 -0
  66. data/lib/swagger_client/models/app_user_pre_create.rb +246 -0
  67. data/lib/swagger_client/models/app_user_response.rb +192 -0
  68. data/lib/swagger_client/models/app_user_update.rb +223 -0
  69. data/lib/swagger_client/models/client.rb +248 -0
  70. data/lib/swagger_client/models/client_info.rb +250 -0
  71. data/lib/swagger_client/models/client_response.rb +187 -0
  72. data/lib/swagger_client/models/conversation.rb +206 -0
  73. data/lib/swagger_client/models/device_update.rb +205 -0
  74. data/lib/swagger_client/models/event.rb +192 -0
  75. data/lib/swagger_client/models/get_messages_response.rb +207 -0
  76. data/lib/swagger_client/models/menu.rb +203 -0
  77. data/lib/swagger_client/models/menu_item.rb +242 -0
  78. data/lib/swagger_client/models/menu_response.rb +192 -0
  79. data/lib/swagger_client/models/message.rb +303 -0
  80. data/lib/swagger_client/models/message_response.rb +206 -0
  81. data/lib/swagger_client/models/postback.rb +229 -0
  82. data/lib/swagger_client/models/track_event_response.rb +187 -0
  83. data/lib/swagger_client/models/typing_activity_trigger.rb +224 -0
  84. data/lib/swagger_client/version.rb +14 -0
  85. data/rainbow-submarine-test-3356.gemspec +44 -0
  86. data/spec/api/app_user_api_spec.rb +162 -0
  87. data/spec/api/conversation_api_spec.rb +73 -0
  88. data/spec/api/menu_api_spec.rb +68 -0
  89. data/spec/api_client_spec.rb +225 -0
  90. data/spec/configuration_spec.rb +41 -0
  91. data/spec/models/app_user_link_spec.rb +47 -0
  92. data/spec/models/app_user_pre_create_spec.rb +77 -0
  93. data/spec/models/app_user_response_spec.rb +41 -0
  94. data/spec/models/app_user_spec.rb +77 -0
  95. data/spec/models/app_user_update_spec.rb +65 -0
  96. data/spec/models/client_info_spec.rb +83 -0
  97. data/spec/models/client_response_spec.rb +41 -0
  98. data/spec/models/client_spec.rb +65 -0
  99. data/spec/models/conversation_spec.rb +47 -0
  100. data/spec/models/device_update_spec.rb +53 -0
  101. data/spec/models/event_spec.rb +41 -0
  102. data/spec/models/get_messages_response_spec.rb +53 -0
  103. data/spec/models/menu_item_spec.rb +71 -0
  104. data/spec/models/menu_response_spec.rb +41 -0
  105. data/spec/models/menu_spec.rb +47 -0
  106. data/spec/models/message_response_spec.rb +47 -0
  107. data/spec/models/message_spec.rb +95 -0
  108. data/spec/models/postback_spec.rb +59 -0
  109. data/spec/models/track_event_response_spec.rb +41 -0
  110. data/spec/models/typing_activity_trigger_spec.rb +59 -0
  111. data/spec/spec_helper.rb +110 -0
  112. data/swagger_client.gemspec +45 -0
  113. metadata +361 -0
@@ -0,0 +1,14 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ module SwaggerClient
13
+ VERSION = "1.0.0"
14
+ end
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ =begin
4
+ #Smooch
5
+
6
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
7
+
8
+ OpenAPI spec version: 1.0.0
9
+
10
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
11
+
12
+ =end
13
+
14
+ $:.push File.expand_path("../lib", __FILE__)
15
+ require "rainbow-submarine-test-3356/version"
16
+
17
+ Gem::Specification.new do |s|
18
+ s.name = "rainbow-submarine-test-3356"
19
+ s.version = RainbowSubmarineTest3356::VERSION
20
+ s.platform = Gem::Platform::RUBY
21
+ s.authors = ["Smooch"]
22
+ s.email = [""]
23
+ s.homepage = "https://github.com/smooch/smooch-ruby"
24
+ s.summary = "Smooch Ruby Gem"
25
+ s.description = "No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)"
26
+ s.license = "https://smooch.io/terms/"
27
+ s.required_ruby_version = ">= 1.9"
28
+
29
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
30
+ s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
31
+
32
+ s.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
33
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
34
+ s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
35
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
36
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
37
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
38
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11'
39
+
40
+ s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
41
+ s.test_files = `find spec/*`.split("\n")
42
+ s.executables = []
43
+ s.require_paths = ["lib"]
44
+ end
@@ -0,0 +1,162 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+
15
+ # Unit tests for RainbowSubmarineTest3356::AppUserApi
16
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
17
+ # Please update as you see appropriate
18
+ describe 'AppUserApi' do
19
+ before do
20
+ # run before each test
21
+ @instance = RainbowSubmarineTest3356::AppUserApi.new
22
+ end
23
+
24
+ after do
25
+ # run after each test
26
+ end
27
+
28
+ describe 'test an instance of AppUserApi' do
29
+ it 'should create an instact of AppUserApi' do
30
+ expect(@instance).to be_instance_of(RainbowSubmarineTest3356::AppUserApi)
31
+ end
32
+ end
33
+
34
+ # unit tests for app_user_device_update
35
+ #
36
+ # Update specified device information.
37
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
38
+ # @param device_id Id of the device.
39
+ # @param app_user_device_update Supported properties for an updateAppUserDevice request.
40
+ # @param [Hash] opts the optional parameters
41
+ # @return [ClientResponse]
42
+ describe 'app_user_device_update 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 delete_app_user_profile
49
+ #
50
+ # Delete specified app users profile.
51
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
52
+ # @param [Hash] opts the optional parameters
53
+ # @return [AppUserResponse]
54
+ describe 'delete_app_user_profile test' do
55
+ it "should work" do
56
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
57
+ end
58
+ end
59
+
60
+ # unit tests for get_app_user
61
+ #
62
+ # Get the specified app user.
63
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
64
+ # @param [Hash] opts the optional parameters
65
+ # @return [AppUserResponse]
66
+ describe 'get_app_user test' do
67
+ it "should work" do
68
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
69
+ end
70
+ end
71
+
72
+ # unit tests for get_app_user_entity_ids
73
+ #
74
+ # Get specified app users channel entity IDs.
75
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
76
+ # @param [Hash] opts the optional parameters
77
+ # @return [AppUserResponse]
78
+ describe 'get_app_user_entity_ids 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
+ # unit tests for link_app_user
85
+ #
86
+ # Link specified app user to given channel.
87
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
88
+ # @param app_user_link Supported properties for a linkAppUser request.
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [AppUserResponse]
91
+ describe 'link_app_user test' do
92
+ it "should work" do
93
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
94
+ end
95
+ end
96
+
97
+ # unit tests for post_image_message
98
+ #
99
+ # Send an image message to the conversation
100
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
101
+ # @param source Image to be uploaded
102
+ # @param role Role of the sender
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [MessageResponse]
105
+ describe 'post_image_message test' do
106
+ it "should work" do
107
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
108
+ end
109
+ end
110
+
111
+ # unit tests for pre_create_app_user
112
+ #
113
+ # Pre-create an app user.
114
+ # @param app_user_pre_create Supported properties for a preCreateAppUser request.
115
+ # @param [Hash] opts the optional parameters
116
+ # @return [AppUserResponse]
117
+ describe 'pre_create_app_user test' do
118
+ it "should work" do
119
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
120
+ end
121
+ end
122
+
123
+ # unit tests for track_event
124
+ #
125
+ # Track an event for the given app user.
126
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
127
+ # @param event Supported properties for a trackEvent request.
128
+ # @param [Hash] opts the optional parameters
129
+ # @return [TrackEventResponse]
130
+ describe 'track_event test' do
131
+ it "should work" do
132
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
133
+ end
134
+ end
135
+
136
+ # unit tests for unlink_app_user
137
+ #
138
+ # Unlink specified app user from given channel.
139
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
140
+ # @param channel Name of the channel.
141
+ # @param [Hash] opts the optional parameters
142
+ # @return [nil]
143
+ describe 'unlink_app_user test' do
144
+ it "should work" do
145
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
146
+ end
147
+ end
148
+
149
+ # unit tests for update_app_user
150
+ #
151
+ # Update the specified app user.
152
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
153
+ # @param app_user_update Supported properties for an updateAppUser request.
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [AppUserResponse]
156
+ describe 'update_app_user test' do
157
+ it "should work" do
158
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
159
+ end
160
+ end
161
+
162
+ end
@@ -0,0 +1,73 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+
15
+ # Unit tests for RainbowSubmarineTest3356::ConversationApi
16
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
17
+ # Please update as you see appropriate
18
+ describe 'ConversationApi' do
19
+ before do
20
+ # run before each test
21
+ @instance = RainbowSubmarineTest3356::ConversationApi.new
22
+ end
23
+
24
+ after do
25
+ # run after each test
26
+ end
27
+
28
+ describe 'test an instance of ConversationApi' do
29
+ it 'should create an instact of ConversationApi' do
30
+ expect(@instance).to be_instance_of(RainbowSubmarineTest3356::ConversationApi)
31
+ end
32
+ end
33
+
34
+ # unit tests for get_messages
35
+ #
36
+ # Get the specified app users messages.
37
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [String] :before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp).
40
+ # @option opts [String] :after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp).
41
+ # @return [GetMessagesResponse]
42
+ describe 'get_messages 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 reset_unread_count
49
+ #
50
+ # Reset the unread count of the conversation to 0. If the conversation has not yet been created for the specified app user 404 will be returned.
51
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
52
+ # @param [Hash] opts the optional parameters
53
+ # @return [nil]
54
+ describe 'reset_unread_count test' do
55
+ it "should work" do
56
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
57
+ end
58
+ end
59
+
60
+ # unit tests for trigger_typing_activity
61
+ #
62
+ # Notify Smooch when an app maker starts or stops typing a response.
63
+ # @param user_id Identifies the user. Can be either the smoochId or the userId.
64
+ # @param typing_activity_trigger Supported properties for a triggerTypingActivity request.
65
+ # @param [Hash] opts the optional parameters
66
+ # @return [nil]
67
+ describe 'trigger_typing_activity test' do
68
+ it "should work" do
69
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
70
+ end
71
+ end
72
+
73
+ end
@@ -0,0 +1,68 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+
15
+ # Unit tests for RainbowSubmarineTest3356::MenuApi
16
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
17
+ # Please update as you see appropriate
18
+ describe 'MenuApi' do
19
+ before do
20
+ # run before each test
21
+ @instance = RainbowSubmarineTest3356::MenuApi.new
22
+ end
23
+
24
+ after do
25
+ # run after each test
26
+ end
27
+
28
+ describe 'test an instance of MenuApi' do
29
+ it 'should create an instact of MenuApi' do
30
+ expect(@instance).to be_instance_of(RainbowSubmarineTest3356::MenuApi)
31
+ end
32
+ end
33
+
34
+ # unit tests for delete_menu
35
+ #
36
+ # Remove the specified app’s menu.
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [MenuResponse]
39
+ describe 'delete_menu 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_menu
46
+ #
47
+ # Get the specified app’s menu.
48
+ # @param [Hash] opts the optional parameters
49
+ # @return [MenuResponse]
50
+ describe 'get_menu 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
+ # unit tests for update_menu
57
+ #
58
+ # Configure the specified app’s menu.
59
+ # @param menu_update Supported properties for a updateMenu request.
60
+ # @param [Hash] opts the optional parameters
61
+ # @return [MenuResponse]
62
+ describe 'update_menu 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
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+
14
+ describe RainbowSubmarineTest3356::ApiClient do
15
+ context 'initialization' do
16
+ context 'URL stuff' do
17
+ context 'host' do
18
+ it 'removes http from host' do
19
+ RainbowSubmarineTest3356.configure { |c| c.host = 'http://example.com' }
20
+ expect(RainbowSubmarineTest3356::Configuration.default.host).to eq('example.com')
21
+ end
22
+
23
+ it 'removes https from host' do
24
+ RainbowSubmarineTest3356.configure { |c| c.host = 'https://wookiee.com' }
25
+ expect(RainbowSubmarineTest3356::ApiClient.default.config.host).to eq('wookiee.com')
26
+ end
27
+
28
+ it 'removes trailing path from host' do
29
+ RainbowSubmarineTest3356.configure { |c| c.host = 'hobo.com/v4' }
30
+ expect(RainbowSubmarineTest3356::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
+ RainbowSubmarineTest3356.configure { |c| c.base_path = 'v4/dog' }
37
+ expect(RainbowSubmarineTest3356::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
+ RainbowSubmarineTest3356.configure { |c| c.base_path = '/v4/dog' }
42
+ expect(RainbowSubmarineTest3356::Configuration.default.base_path).to eq('/v4/dog')
43
+ end
44
+
45
+ it "ends up as a blank string if nil" do
46
+ RainbowSubmarineTest3356.configure { |c| c.base_path = nil }
47
+ expect(RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::Configuration.new }
55
+ let(:api_client) { RainbowSubmarineTest3356::ApiClient.new(config) }
56
+
57
+ it "defaults to nil" do
58
+ expect(RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::Configuration.new }
74
+ let(:api_client) { RainbowSubmarineTest3356::ApiClient.new(config) }
75
+
76
+ it "defaults to 0" do
77
+ expect(RainbowSubmarineTest3356::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 = RainbowSubmarineTest3356::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 = RainbowSubmarineTest3356::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 = RainbowSubmarineTest3356::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 = RainbowSubmarineTest3356::ApiClient.new
124
+ #_model = RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::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) { RainbowSubmarineTest3356::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