casemanager_client 0.0.5

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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +111 -0
  5. data/Rakefile +10 -0
  6. data/bin/console +14 -0
  7. data/bin/setup +8 -0
  8. data/casemanager_client.gemspec +45 -0
  9. data/docs/CaseItem.md +10 -0
  10. data/docs/CaseWithPatient.md +12 -0
  11. data/docs/DefaultApi.md +238 -0
  12. data/docs/Error.md +9 -0
  13. data/docs/ModelCase.md +11 -0
  14. data/docs/Patient.md +14 -0
  15. data/docs/PatientWithCases.md +15 -0
  16. data/docs/Patients.md +8 -0
  17. data/docs/Workflow.md +9 -0
  18. data/docs/WorkflowTask.md +14 -0
  19. data/gen.sh +3 -0
  20. data/git_push.sh +55 -0
  21. data/lib/casemanager_client.rb +48 -0
  22. data/lib/casemanager_client/api/default_api.rb +301 -0
  23. data/lib/casemanager_client/api_client.rb +390 -0
  24. data/lib/casemanager_client/api_error.rb +38 -0
  25. data/lib/casemanager_client/configuration.rb +259 -0
  26. data/lib/casemanager_client/models/case_item.rb +250 -0
  27. data/lib/casemanager_client/models/case_with_patient.rb +236 -0
  28. data/lib/casemanager_client/models/error.rb +202 -0
  29. data/lib/casemanager_client/models/model_case.rb +222 -0
  30. data/lib/casemanager_client/models/patient.rb +242 -0
  31. data/lib/casemanager_client/models/patient_with_cases.rb +258 -0
  32. data/lib/casemanager_client/models/patients.rb +190 -0
  33. data/lib/casemanager_client/models/workflow.rb +204 -0
  34. data/lib/casemanager_client/models/workflow_task.rb +272 -0
  35. data/lib/casemanager_client/version.rb +15 -0
  36. data/pkg/casemanager_client-0.0.5.gem +0 -0
  37. data/spec/api/default_api_spec.rb +60 -0
  38. data/spec/api_client_spec.rb +226 -0
  39. data/spec/configuration_spec.rb +42 -0
  40. data/spec/models/case_item_spec.rb +53 -0
  41. data/spec/models/case_with_patient_spec.rb +59 -0
  42. data/spec/models/error_spec.rb +47 -0
  43. data/spec/models/model_case_spec.rb +53 -0
  44. data/spec/models/patient_spec.rb +53 -0
  45. data/spec/models/patient_with_cases_spec.rb +59 -0
  46. data/spec/models/workflow_spec.rb +47 -0
  47. data/spec/models/workflow_task_spec.rb +77 -0
  48. data/spec/spec_helper.rb +111 -0
  49. metadata +283 -0
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #SPX: CaseManager
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CasemanagerClient
16
+ class WorkflowTask
17
+ attr_accessor :id
18
+
19
+ # The name of the task. The logical operator tasks \"OR\" is also indicated by the name field. When a task is named \"OR\", the task represents the \"OR\" logical operation for all parent tasks. This means that only one parent task is required to be completed before children tasks may be started.
20
+ attr_accessor :name
21
+
22
+ # Attributes of Case Items that are directly related to this workflow task.
23
+ attr_accessor :case_items
24
+
25
+ # Other workflow tasks that come immediately before this task in the workflow. No parents IDs indicates this is the first task in a workflow. Workflows can branch and those branches can later rejoin. Multiple parent IDs indicate the rejoining of a branch. When multiple parent IDs are present, it defaults to AND logic. That means all parent task are required to be completed before this task may be started. When a task has a name of \"OR\" and has multiple parent IDs, it is specifying that only one of the parent tasks needs to be completed before children tasks may be started.
26
+ attr_accessor :parent_ids
27
+
28
+ # Is this task an important task in the workflow? Could be used when generating a visual timeline of the workflow.
29
+ attr_accessor :key_task
30
+
31
+ # When this task was started. If null, the task has not been started. If `started_at` has a value, and `completed_at` does not, the task is currently in progress
32
+ attr_accessor :started_at
33
+
34
+ # When this task was completed
35
+ attr_accessor :completed_at
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'id' => :'id',
41
+ :'name' => :'name',
42
+ :'case_items' => :'case_items',
43
+ :'parent_ids' => :'parent_ids',
44
+ :'key_task' => :'key_task',
45
+ :'started_at' => :'started_at',
46
+ :'completed_at' => :'completed_at'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'id' => :'Integer',
54
+ :'name' => :'String',
55
+ :'case_items' => :'Array<CaseItem>',
56
+ :'parent_ids' => :'Array<Integer>',
57
+ :'key_task' => :'BOOLEAN',
58
+ :'started_at' => :'DateTime',
59
+ :'completed_at' => :'DateTime'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
70
+
71
+ if attributes.has_key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.has_key?(:'name')
76
+ self.name = attributes[:'name']
77
+ end
78
+
79
+ if attributes.has_key?(:'case_items')
80
+ if (value = attributes[:'case_items']).is_a?(Array)
81
+ self.case_items = value
82
+ end
83
+ end
84
+
85
+ if attributes.has_key?(:'parent_ids')
86
+ if (value = attributes[:'parent_ids']).is_a?(Array)
87
+ self.parent_ids = value
88
+ end
89
+ end
90
+
91
+ if attributes.has_key?(:'key_task')
92
+ self.key_task = attributes[:'key_task']
93
+ end
94
+
95
+ if attributes.has_key?(:'started_at')
96
+ self.started_at = attributes[:'started_at']
97
+ end
98
+
99
+ if attributes.has_key?(:'completed_at')
100
+ self.completed_at = attributes[:'completed_at']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @id.nil?
109
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
110
+ end
111
+
112
+ if @name.nil?
113
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
114
+ end
115
+
116
+ if @case_items.nil?
117
+ invalid_properties.push('invalid value for "case_items", case_items cannot be nil.')
118
+ end
119
+
120
+ if @parent_ids.nil?
121
+ invalid_properties.push('invalid value for "parent_ids", parent_ids cannot be nil.')
122
+ end
123
+
124
+ if @key_task.nil?
125
+ invalid_properties.push('invalid value for "key_task", key_task cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ return false if @id.nil?
135
+ return false if @name.nil?
136
+ return false if @case_items.nil?
137
+ return false if @parent_ids.nil?
138
+ return false if @key_task.nil?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ id == o.id &&
148
+ name == o.name &&
149
+ case_items == o.case_items &&
150
+ parent_ids == o.parent_ids &&
151
+ key_task == o.key_task &&
152
+ started_at == o.started_at &&
153
+ completed_at == o.completed_at
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Fixnum] Hash code
164
+ def hash
165
+ [id, name, case_items, parent_ids, key_task, started_at, completed_at].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ self.class.openapi_types.each_pair do |key, type|
174
+ if type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
178
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ end
180
+ elsif !attributes[self.class.attribute_map[key]].nil?
181
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
183
+ end
184
+
185
+ self
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def _deserialize(type, value)
193
+ case type.to_sym
194
+ when :DateTime
195
+ DateTime.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :BOOLEAN
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ temp_model = CasemanagerClient.const_get(type).new
226
+ temp_model.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ next if value.nil?
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+ end
272
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #SPX: CaseManager
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: 1.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.4
10
+
11
+ =end
12
+
13
+ module CasemanagerClient
14
+ VERSION = '0.0.5'
15
+ end
@@ -0,0 +1,60 @@
1
+ =begin
2
+ #SPX: CaseManager
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for CasemanagerClient::DefaultApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'DefaultApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = CasemanagerClient::DefaultApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of DefaultApi' do
30
+ it 'should create an instance of DefaultApi' do
31
+ expect(@instance).to be_instance_of(CasemanagerClient::DefaultApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for list_patients
36
+ # List all Patients with Cases
37
+ # @param cmm_user_id the CMM2 T_Users ID
38
+ # @param v Version of the CaseManager API. Required to be &#x60;v&#x3D;sudo_v1&#x60;
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Patients]
41
+ describe 'list_patients 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 show_case
48
+ # Get the details of a specific case
49
+ # @param case_key
50
+ # @param cmm_user_id the CMM2 T_Users ID
51
+ # @param v Version of the CaseManager API. Required to be &#x60;v&#x3D;sudo_v1&#x60;
52
+ # @param [Hash] opts the optional parameters
53
+ # @return [CaseWithPatient]
54
+ describe 'show_case 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
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #SPX: CaseManager
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe CasemanagerClient::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ CasemanagerClient.configure { |c| c.host = 'http://example.com' }
21
+ expect(CasemanagerClient::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ CasemanagerClient.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(CasemanagerClient::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ CasemanagerClient.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(CasemanagerClient::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
+ CasemanagerClient.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(CasemanagerClient::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
+ CasemanagerClient.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(CasemanagerClient::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ CasemanagerClient.configure { |c| c.base_path = nil }
48
+ expect(CasemanagerClient::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) { CasemanagerClient::Configuration.new }
56
+ let(:api_client) { CasemanagerClient::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(CasemanagerClient::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) { CasemanagerClient::Configuration.new }
75
+ let(:api_client) { CasemanagerClient::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(CasemanagerClient::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 = CasemanagerClient::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 = CasemanagerClient::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 = CasemanagerClient::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 = CasemanagerClient::ApiClient.new
125
+ # _model = CasemanagerClient::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) { CasemanagerClient::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) { CasemanagerClient::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) { CasemanagerClient::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) { CasemanagerClient::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) { CasemanagerClient::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