mailslurp_client 5.0.0 → 7.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client.rb +72 -7
  3. metadata +14 -271
  4. data/Gemfile +0 -8
  5. data/Gemfile.lock +0 -79
  6. data/LICENSE +0 -22
  7. data/README.md +0 -139
  8. data/Rakefile +0 -10
  9. data/docs/BasicAuthOptions.md +0 -9
  10. data/docs/BulkSendEmailOptions.md +0 -9
  11. data/docs/CommonOperationsApi.md +0 -499
  12. data/docs/CreateWebhookOptions.md +0 -10
  13. data/docs/Email.md +0 -24
  14. data/docs/EmailAnalysis.md +0 -12
  15. data/docs/EmailPreview.md +0 -13
  16. data/docs/ExtraOperationsApi.md +0 -1021
  17. data/docs/ForwardEmailOptions.md +0 -11
  18. data/docs/Inbox.md +0 -11
  19. data/docs/MatchOption.md +0 -10
  20. data/docs/MatchOptions.md +0 -8
  21. data/docs/SendEmailOptions.md +0 -18
  22. data/docs/UploadAttachmentOptions.md +0 -10
  23. data/docs/Webhook.md +0 -13
  24. data/git_push.sh +0 -55
  25. data/lib/mailslurp_client/api/common_operations_api.rb +0 -502
  26. data/lib/mailslurp_client/api/extra_operations_api.rb +0 -1054
  27. data/lib/mailslurp_client/api_client.rb +0 -389
  28. data/lib/mailslurp_client/api_error.rb +0 -38
  29. data/lib/mailslurp_client/configuration.rb +0 -251
  30. data/lib/mailslurp_client/models/basic_auth_options.rb +0 -202
  31. data/lib/mailslurp_client/models/bulk_send_email_options.rb +0 -201
  32. data/lib/mailslurp_client/models/create_webhook_options.rb +0 -202
  33. data/lib/mailslurp_client/models/email.rb +0 -368
  34. data/lib/mailslurp_client/models/email_analysis.rb +0 -245
  35. data/lib/mailslurp_client/models/email_preview.rb +0 -250
  36. data/lib/mailslurp_client/models/forward_email_options.rb +0 -222
  37. data/lib/mailslurp_client/models/inbox.rb +0 -212
  38. data/lib/mailslurp_client/models/match_option.rb +0 -250
  39. data/lib/mailslurp_client/models/match_options.rb +0 -187
  40. data/lib/mailslurp_client/models/send_email_options.rb +0 -297
  41. data/lib/mailslurp_client/models/upload_attachment_options.rb +0 -205
  42. data/lib/mailslurp_client/models/webhook.rb +0 -242
  43. data/lib/mailslurp_client/version.rb +0 -15
  44. data/mailslurp_client.gemspec +0 -45
  45. data/spec/api/common_operations_api_spec.rb +0 -95
  46. data/spec/api/extra_operations_api_spec.rb +0 -231
  47. data/spec/api_client_spec.rb +0 -226
  48. data/spec/configuration_spec.rb +0 -42
  49. data/spec/models/basic_auth_options_spec.rb +0 -47
  50. data/spec/models/bulk_send_email_options_spec.rb +0 -47
  51. data/spec/models/create_webhook_options_spec.rb +0 -53
  52. data/spec/models/email_analysis_spec.rb +0 -65
  53. data/spec/models/email_preview_spec.rb +0 -47
  54. data/spec/models/email_spec.rb +0 -125
  55. data/spec/models/forward_email_options_spec.rb +0 -59
  56. data/spec/models/inbox_spec.rb +0 -59
  57. data/spec/models/match_option_spec.rb +0 -61
  58. data/spec/models/match_options_spec.rb +0 -41
  59. data/spec/models/send_email_options_spec.rb +0 -89
  60. data/spec/models/upload_attachment_options_spec.rb +0 -53
  61. data/spec/models/webhook_spec.rb +0 -71
  62. data/spec/spec_helper.rb +0 -111
@@ -1,45 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- =begin
4
- #MailSlurp API
5
-
6
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
7
-
8
- OpenAPI spec version: 0.0.1-alpha
9
- Contact: contact@mailslurp.dev
10
- Generated by: https://openapi-generator.tech
11
- OpenAPI Generator version: 3.3.4
12
-
13
- =end
14
-
15
- $:.push File.expand_path("../lib", __FILE__)
16
- require "mailslurp_client/version"
17
-
18
- Gem::Specification.new do |s|
19
- s.name = "mailslurp_client"
20
- s.version = MailSlurpClient::VERSION
21
- s.platform = Gem::Platform::RUBY
22
- s.authors = ["MailSlurp"]
23
- s.email = ["contact@mailslurp.dev"]
24
- s.homepage = "https://github.com/mailslurp/mailslurp-client-ruby"
25
- s.summary = "Official MailSlurp API Client"
26
- s.description = "Send and receive real emails in Ruby. See https://www.mailslurp.com/developers/ for full Ruby documentation."
27
- s.license = 'MIT'
28
- s.required_ruby_version = ">= 1.9"
29
-
30
- s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
- s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
-
33
- s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
- s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
35
- s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
36
- s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
37
- s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
38
- s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
39
- s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
40
-
41
- s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
42
- s.test_files = `find spec/*`.split("\n")
43
- s.executables = []
44
- s.require_paths = ["lib"]
45
- end
@@ -1,95 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
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 MailSlurpClient::CommonOperationsApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'CommonOperationsApi' do
20
- before do
21
- # run before each test
22
- @instance = MailSlurpClient::CommonOperationsApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of CommonOperationsApi' do
30
- it 'should create an instance of CommonOperationsApi' do
31
- expect(@instance).to be_instance_of(MailSlurpClient::CommonOperationsApi)
32
- end
33
- end
34
-
35
- # unit tests for create_new_email_address
36
- # Create new email address
37
- # Returns an Inbox with an `id` and an `emailAddress`
38
- # @param [Hash] opts the optional parameters
39
- # @return [Inbox]
40
- describe 'create_new_email_address 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 delete_email_address
47
- # Delete email address and its emails
48
- # Deletes an inbox
49
- # @param inbox_id inboxId
50
- # @param [Hash] opts the optional parameters
51
- # @return [nil]
52
- describe 'delete_email_address 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 send_email_simple
59
- # Send an email from a random email address
60
- # To specify an email address first create an inbox and use that with the other send email methods
61
- # @param send_email_options sendEmailOptions
62
- # @param [Hash] opts the optional parameters
63
- # @return [nil]
64
- describe 'send_email_simple 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 wait_for_latest_email
71
- # Fetch inbox's latest email or if empty wait for email to arrive
72
- # Will return either the last received email or wait for an email to arrive and return that. If you need to wait for an email for a non-empty inbox see the other receive methods.
73
- # @param [Hash] opts the optional parameters
74
- # @option opts [String] :inbox_email_address Email address of the inbox we are fetching emails from
75
- # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
76
- # @return [Email]
77
- describe 'wait_for_latest_email test' do
78
- it 'should work' do
79
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
- end
81
- end
82
-
83
- # unit tests for wait_for_nth_email
84
- # Wait for or fetch the email with a given index in the inbox specified
85
- # @param [Hash] opts the optional parameters
86
- # @option opts [String] :inbox_id Id of the inbox we are fetching emails from
87
- # @option opts [Integer] :index Zero based index of the email to wait for
88
- # @return [Email]
89
- describe 'wait_for_nth_email test' do
90
- it 'should work' do
91
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
92
- end
93
- end
94
-
95
- end
@@ -1,231 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
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 MailSlurpClient::ExtraOperationsApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'ExtraOperationsApi' do
20
- before do
21
- # run before each test
22
- @instance = MailSlurpClient::ExtraOperationsApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of ExtraOperationsApi' do
30
- it 'should create an instance of ExtraOperationsApi' do
31
- expect(@instance).to be_instance_of(MailSlurpClient::ExtraOperationsApi)
32
- end
33
- end
34
-
35
- # unit tests for bulk_create_inboxes
36
- # Bulk create Inboxes (email addresses)
37
- # Enterprise Plan Required
38
- # @param count Number of inboxes to be created in bulk
39
- # @param [Hash] opts the optional parameters
40
- # @return [Array<Inbox>]
41
- describe 'bulk_create_inboxes test' do
42
- it 'should work' do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- # unit tests for bulk_delete_inboxes
48
- # Bulk Delete Inboxes
49
- # Enterprise Plan Required
50
- # @param request_body ids
51
- # @param [Hash] opts the optional parameters
52
- # @return [nil]
53
- describe 'bulk_delete_inboxes 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 bulk_send_emails
60
- # Bulk Send Emails
61
- # Enterprise Plan Required
62
- # @param bulk_send_email_options bulkSendEmailOptions
63
- # @param [Hash] opts the optional parameters
64
- # @return [nil]
65
- describe 'bulk_send_emails 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 create_inbox
72
- # Create an Inbox (email address)
73
- # Create a new inbox and ephemeral email address to send and receive from. This is a necessary step before sending or receiving emails. The response contains the inbox&#39;s ID and its associated email address. It is recommended that you create a new inbox during each test method so that it is unique and empty
74
- # @param [Hash] opts the optional parameters
75
- # @return [Inbox]
76
- describe 'create_inbox 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 create_webhook
83
- # Attach a WebHook URL to an inbox
84
- # Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint.
85
- # @param inbox_id inboxId
86
- # @param create_webhook_options webhookOptions
87
- # @param [Hash] opts the optional parameters
88
- # @return [Webhook]
89
- describe 'create_webhook test' do
90
- it 'should work' do
91
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
92
- end
93
- end
94
-
95
- # unit tests for delete_email
96
- # Delete Email
97
- # Deletes an email and removes it from the inbox
98
- # @param email_id emailId
99
- # @param [Hash] opts the optional parameters
100
- # @return [nil]
101
- describe 'delete_email test' do
102
- it 'should work' do
103
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
104
- end
105
- end
106
-
107
- # unit tests for delete_inbox
108
- # Delete Inbox / Email Address
109
- # Permanently delete an inbox and associated email address
110
- # @param inbox_id inboxId
111
- # @param [Hash] opts the optional parameters
112
- # @return [nil]
113
- describe 'delete_inbox test' do
114
- it 'should work' do
115
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
116
- end
117
- end
118
-
119
- # unit tests for delete_webhook
120
- # Delete and disable a WebHook for an Inbox
121
- # @param inbox_id inboxId
122
- # @param webhook_id webhookId
123
- # @param [Hash] opts the optional parameters
124
- # @return [nil]
125
- describe 'delete_webhook test' do
126
- it 'should work' do
127
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
128
- end
129
- end
130
-
131
- # unit tests for download_attachment
132
- # Get email attachment
133
- # Returns the specified attachment for a given email as a byte stream (file download). Get the attachmentId from the email response. Requires enterprise account.
134
- # @param attachment_id attachmentId
135
- # @param email_id emailId
136
- # @param [Hash] opts the optional parameters
137
- # @return [nil]
138
- describe 'download_attachment test' do
139
- it 'should work' do
140
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
141
- end
142
- end
143
-
144
- # unit tests for get_email
145
- # Get Email Content
146
- # Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawMessage endpoint
147
- # @param email_id emailId
148
- # @param [Hash] opts the optional parameters
149
- # @return [Email]
150
- describe 'get_email test' do
151
- it 'should work' do
152
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
153
- end
154
- end
155
-
156
- # unit tests for get_emails
157
- # List Emails in an Inbox / EmailAddress
158
- # List emails that an inbox has received. Only emails that are sent to the inbox&#39;s email address will appear in the inbox. It may take several seconds for any email you send to an inbox&#39;s email address to appear in the inbox. To make this endpoint wait for a minimum number of emails use the &#x60;minCount&#x60; parameter. The server will retry the inbox database until the &#x60;minCount&#x60; is satisfied or the &#x60;retryTimeout&#x60; is reached
159
- # @param inbox_id Id of inbox that emails belongs to
160
- # @param [Hash] opts the optional parameters
161
- # @option opts [Integer] :limit Limit the result set, ordered by descending received date time
162
- # @option opts [Integer] :min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached.
163
- # @option opts [Integer] :retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned
164
- # @option opts [DateTime] :since Exclude emails received before this ISO 8601 date time
165
- # @return [Array<EmailPreview>]
166
- describe 'get_emails test' do
167
- it 'should work' do
168
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
169
- end
170
- end
171
-
172
- # unit tests for get_inbox
173
- # Get Inbox / EmailAddress
174
- # Returns an inbox&#39;s properties, including its email address and ID.
175
- # @param inbox_id inboxId
176
- # @param [Hash] opts the optional parameters
177
- # @return [Inbox]
178
- describe 'get_inbox test' do
179
- it 'should work' do
180
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
181
- end
182
- end
183
-
184
- # unit tests for get_inboxes
185
- # List Inboxes / Email Addresses
186
- # List the inboxes you have created
187
- # @param [Hash] opts the optional parameters
188
- # @return [Array<Inbox>]
189
- describe 'get_inboxes test' do
190
- it 'should work' do
191
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
192
- end
193
- end
194
-
195
- # unit tests for get_raw_email_contents
196
- # Get Raw Email Content
197
- # Returns a raw, unparsed and unprocessed email
198
- # @param email_id emailId
199
- # @param [Hash] opts the optional parameters
200
- # @return [String]
201
- describe 'get_raw_email_contents test' do
202
- it 'should work' do
203
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
204
- end
205
- end
206
-
207
- # unit tests for get_webhooks
208
- # Get all WebHooks for an Inbox
209
- # @param inbox_id inboxId
210
- # @param [Hash] opts the optional parameters
211
- # @return [Array<Webhook>]
212
- describe 'get_webhooks test' do
213
- it 'should work' do
214
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
215
- end
216
- end
217
-
218
- # unit tests for send_email
219
- # Send Email
220
- # Send an email from the inbox&#39;s email address. Specify the email recipients and contents in the request body. See the &#x60;SendEmailOptions&#x60; for more information. Note the &#x60;inboxId&#x60; refers to the inbox&#39;s id NOT its email address
221
- # @param inbox_id inboxId
222
- # @param send_email_options sendEmailOptions
223
- # @param [Hash] opts the optional parameters
224
- # @return [nil]
225
- describe 'send_email test' do
226
- it 'should work' do
227
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
228
- end
229
- end
230
-
231
- end
@@ -1,226 +0,0 @@
1
- =begin
2
- #MailSlurp API
3
-
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
5
-
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
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 MailSlurpClient::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- MailSlurpClient.configure { |c| c.host = 'http://example.com' }
21
- expect(MailSlurpClient::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- MailSlurpClient.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(MailSlurpClient::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- MailSlurpClient.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(MailSlurpClient::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
- MailSlurpClient.configure { |c| c.base_path = 'v4/dog' }
38
- expect(MailSlurpClient::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
- MailSlurpClient.configure { |c| c.base_path = '/v4/dog' }
43
- expect(MailSlurpClient::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- MailSlurpClient.configure { |c| c.base_path = nil }
48
- expect(MailSlurpClient::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) { MailSlurpClient::Configuration.new }
56
- let(:api_client) { MailSlurpClient::ApiClient.new(config) }
57
-
58
- it 'defaults to nil' do
59
- expect(MailSlurpClient::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) { MailSlurpClient::Configuration.new }
75
- let(:api_client) { MailSlurpClient::ApiClient.new(config) }
76
-
77
- it 'defaults to 0' do
78
- expect(MailSlurpClient::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 = MailSlurpClient::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 = MailSlurpClient::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 = MailSlurpClient::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 = MailSlurpClient::ApiClient.new
125
- # _model = MailSlurpClient::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) { MailSlurpClient::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) { MailSlurpClient::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) { MailSlurpClient::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) { MailSlurpClient::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) { MailSlurpClient::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