korona-entry-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +128 -0
  4. data/Rakefile +10 -0
  5. data/docs/BadRequestError.md +19 -0
  6. data/docs/EntryResponse.md +21 -0
  7. data/docs/ExternalTicketConfiguration.md +29 -0
  8. data/docs/ExternalTicketConfigurationList.md +17 -0
  9. data/docs/ExternalTicketConfigurationsApi.md +247 -0
  10. data/docs/ModelReference.md +23 -0
  11. data/docs/NotAcceptableError.md +19 -0
  12. data/docs/OrganizationalUnit.md +27 -0
  13. data/docs/OrganizationalUnitList.md +17 -0
  14. data/docs/OrganizationalUnitsApi.md +247 -0
  15. data/docs/Ticket.md +35 -0
  16. data/docs/TicketEntry.md +49 -0
  17. data/docs/TicketEntryLog.md +39 -0
  18. data/docs/TicketEntryLogList.md +17 -0
  19. data/docs/TicketImage.md +17 -0
  20. data/docs/TicketInformation.md +27 -0
  21. data/docs/TicketList.md +17 -0
  22. data/docs/TicketPersonalization.md +21 -0
  23. data/docs/TicketsApi.md +654 -0
  24. data/git_push.sh +58 -0
  25. data/korona-entry-client.gemspec +39 -0
  26. data/lib/korona-entry-client.rb +58 -0
  27. data/lib/korona-entry-client/api/external_ticket_configurations_api.rb +356 -0
  28. data/lib/korona-entry-client/api/organizational_units_api.rb +356 -0
  29. data/lib/korona-entry-client/api/tickets_api.rb +854 -0
  30. data/lib/korona-entry-client/api_client.rb +386 -0
  31. data/lib/korona-entry-client/api_error.rb +57 -0
  32. data/lib/korona-entry-client/configuration.rb +248 -0
  33. data/lib/korona-entry-client/models/bad_request_error.rb +217 -0
  34. data/lib/korona-entry-client/models/entry_response.rb +226 -0
  35. data/lib/korona-entry-client/models/external_ticket_configuration.rb +304 -0
  36. data/lib/korona-entry-client/models/external_ticket_configuration_list.rb +214 -0
  37. data/lib/korona-entry-client/models/model_reference.rb +238 -0
  38. data/lib/korona-entry-client/models/not_acceptable_error.rb +250 -0
  39. data/lib/korona-entry-client/models/organizational_unit.rb +257 -0
  40. data/lib/korona-entry-client/models/organizational_unit_list.rb +214 -0
  41. data/lib/korona-entry-client/models/ticket.rb +299 -0
  42. data/lib/korona-entry-client/models/ticket_entry.rb +403 -0
  43. data/lib/korona-entry-client/models/ticket_entry_log.rb +374 -0
  44. data/lib/korona-entry-client/models/ticket_entry_log_list.rb +214 -0
  45. data/lib/korona-entry-client/models/ticket_image.rb +215 -0
  46. data/lib/korona-entry-client/models/ticket_information.rb +258 -0
  47. data/lib/korona-entry-client/models/ticket_list.rb +214 -0
  48. data/lib/korona-entry-client/models/ticket_personalization.rb +228 -0
  49. data/lib/korona-entry-client/version.rb +15 -0
  50. data/spec/api/external_ticket_configurations_api_spec.rb +95 -0
  51. data/spec/api/organizational_units_api_spec.rb +95 -0
  52. data/spec/api/tickets_api_spec.rb +191 -0
  53. data/spec/api_client_spec.rb +226 -0
  54. data/spec/configuration_spec.rb +42 -0
  55. data/spec/models/bad_request_error_spec.rb +47 -0
  56. data/spec/models/entry_response_spec.rb +53 -0
  57. data/spec/models/external_ticket_configuration_list_spec.rb +41 -0
  58. data/spec/models/external_ticket_configuration_spec.rb +77 -0
  59. data/spec/models/model_reference_spec.rb +59 -0
  60. data/spec/models/not_acceptable_error_spec.rb +51 -0
  61. data/spec/models/organizational_unit_list_spec.rb +41 -0
  62. data/spec/models/organizational_unit_spec.rb +71 -0
  63. data/spec/models/ticket_entry_log_list_spec.rb +41 -0
  64. data/spec/models/ticket_entry_log_spec.rb +119 -0
  65. data/spec/models/ticket_entry_spec.rb +137 -0
  66. data/spec/models/ticket_image_spec.rb +41 -0
  67. data/spec/models/ticket_information_spec.rb +71 -0
  68. data/spec/models/ticket_list_spec.rb +41 -0
  69. data/spec/models/ticket_personalization_spec.rb +53 -0
  70. data/spec/models/ticket_spec.rb +95 -0
  71. data/spec/spec_helper.rb +111 -0
  72. metadata +196 -0
@@ -0,0 +1,95 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for KoronaEntryClient::ExternalTicketConfigurationsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'ExternalTicketConfigurationsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = KoronaEntryClient::ExternalTicketConfigurationsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ExternalTicketConfigurationsApi' do
30
+ it 'should create an instance of ExternalTicketConfigurationsApi' do
31
+ expect(@api_instance).to be_instance_of(KoronaEntryClient::ExternalTicketConfigurationsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for create_external_ticket_configurations
36
+ # Creates a new external ticket configuration. If an unkown ticket number will be checked and the pattern of the ticket number will be equals to a pattern of a external ticket configuration, a new ticket will be created. The TicketEntry of the external ticket configuration will be copied and adjusted to the new ticket. The newly created ticket is then checked for validity.
37
+ # @param client Identification of executing client.
38
+ # @param body Properties to update of the external ticket configuration.
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [ModelReference]
41
+ describe 'create_external_ticket_configurations 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 delete_external_ticket_configuration
48
+ # Deletes the single external ticket configuration.
49
+ # @param client Identification of executing client.
50
+ # @param external_ticket_configuration_id ID to identify the external ticket configuration.
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [nil]
53
+ describe 'delete_external_ticket_configuration test' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ # unit tests for get_external_ticket_configuration
60
+ # Returns the external ticket configuration.
61
+ # @param client Identification of executing client.
62
+ # @param external_ticket_configuration_id ID to identify the external ticket configuration.
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [ExternalTicketConfiguration]
65
+ describe 'get_external_ticket_configuration 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_external_ticket_configurations
72
+ # Returns all external ticket configurations
73
+ # @param client Identification of executing client.
74
+ # @param [Hash] opts the optional parameters
75
+ # @return [ExternalTicketConfigurationList]
76
+ describe 'get_external_ticket_configurations 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 update_external_ticket_configuration
83
+ # Updates the single external ticket configuration.
84
+ # @param client Identification of executing client.
85
+ # @param external_ticket_configuration_id ID to identify the external ticket configuration.
86
+ # @param body Properties to update of the external ticket configuration.
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [ModelReference]
89
+ describe 'update_external_ticket_configuration 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
@@ -0,0 +1,95 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for KoronaEntryClient::OrganizationalUnitsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'OrganizationalUnitsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = KoronaEntryClient::OrganizationalUnitsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of OrganizationalUnitsApi' do
30
+ it 'should create an instance of OrganizationalUnitsApi' do
31
+ expect(@api_instance).to be_instance_of(KoronaEntryClient::OrganizationalUnitsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for create_organizational_unit
36
+ # Creates a new organizational unit.
37
+ # @param client Identification of executing client.
38
+ # @param body Properties to update of the organizational unit.
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [ModelReference]
41
+ describe 'create_organizational_unit 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 delete_organizational_unit
48
+ # Deletes the single organizational unit.
49
+ # @param client Identification of executing client.
50
+ # @param organizational_unit_id ID to identify the organizational unit.
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [nil]
53
+ describe 'delete_organizational_unit test' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ # unit tests for get_organizational_unit
60
+ # Returns the single organizational unit.
61
+ # @param client Identification of executing client.
62
+ # @param organizational_unit_id ID to identify the organizational unit.
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [OrganizationalUnit]
65
+ describe 'get_organizational_unit 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_organizational_units
72
+ # Returns all organizational unit
73
+ # @param client Identification of executing client.
74
+ # @param [Hash] opts the optional parameters
75
+ # @return [OrganizationalUnitList]
76
+ describe 'get_organizational_units 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 update_organizational_unit
83
+ # Updates the single organizational unit.
84
+ # @param client Identification of executing client.
85
+ # @param organizational_unit_id ID to identify the organizational unit.
86
+ # @param body Properties to update of the organizational unit.
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [ModelReference]
89
+ describe 'update_organizational_unit 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
@@ -0,0 +1,191 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for KoronaEntryClient::TicketsApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'TicketsApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = KoronaEntryClient::TicketsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of TicketsApi' do
30
+ it 'should create an instance of TicketsApi' do
31
+ expect(@api_instance).to be_instance_of(KoronaEntryClient::TicketsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for check_ticket
36
+ # Checks a ticket. The entry can optionally also be committed.
37
+ # @param client Identification of executing client.
38
+ # @param ticket_number Ticket number to be checked.
39
+ # @param [Hash] opts the optional parameters
40
+ # @option opts [Boolean] :commit_entry True if entry should be committed.
41
+ # @option opts [String] :commit_type
42
+ # @option opts [String] :organizational_unit_number Number of organizational unit.
43
+ # @option opts [DateTime] :time The time to be checked. *Now* if not specified further.
44
+ # @option opts [Integer] :number_of_uses Number of uses. *1* if not specified further.
45
+ # @return [EntryResponse]
46
+ describe 'check_ticket test' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
49
+ end
50
+ end
51
+
52
+ # unit tests for create_ticket
53
+ # Creates a new ticket.
54
+ # @param client Identification of executing client.
55
+ # @param body Properties to update of the ticket.
56
+ # @param [Hash] opts the optional parameters
57
+ # @return [ModelReference]
58
+ describe 'create_ticket test' do
59
+ it 'should work' do
60
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
61
+ end
62
+ end
63
+
64
+ # unit tests for delete_image
65
+ # Deletes the owners image of the ticket.
66
+ # @param client Identification of executing client.
67
+ # @param ticket_id ID to identify the ticket.
68
+ # @param [Hash] opts the optional parameters
69
+ # @return [nil]
70
+ describe 'delete_image test' do
71
+ it 'should work' do
72
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
73
+ end
74
+ end
75
+
76
+ # unit tests for delete_ticket
77
+ # Deletes the single ticket.
78
+ # @param client Identification of executing client.
79
+ # @param ticket_id ID to identify the ticket.
80
+ # @param [Hash] opts the optional parameters
81
+ # @return [nil]
82
+ describe 'delete_ticket test' do
83
+ it 'should work' do
84
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
85
+ end
86
+ end
87
+
88
+ # unit tests for get_image
89
+ # Returns the owners image of the ticket
90
+ # @param client Identification of executing client.
91
+ # @param ticket_id ID to identify the ticket.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [TicketImage]
94
+ describe 'get_image 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 get_logs
101
+ # Returns the log for a optional single ticket and/or organizational unit
102
+ # @param client Identification of executing client.
103
+ # @param time_from Log time from.
104
+ # @param time_to Log time to.
105
+ # @param log_types Restrict the logs to specific log events.
106
+ # @param [Hash] opts the optional parameters
107
+ # @option opts [String] :ticket_number Optional filter to restrict the logs to actions to the specified ticket.
108
+ # @option opts [String] :organizational_unit_number Optional filter to restrict the logs to actions within the specified organizational unit.
109
+ # @return [TicketEntryLogList]
110
+ describe 'get_logs test' do
111
+ it 'should work' do
112
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
113
+ end
114
+ end
115
+
116
+ # unit tests for get_ticket
117
+ # Returns the single ticket.
118
+ # @param client Identification of executing client.
119
+ # @param ticket_id ID to identify the ticket.
120
+ # @param [Hash] opts the optional parameters
121
+ # @return [Ticket]
122
+ describe 'get_ticket test' do
123
+ it 'should work' do
124
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
125
+ end
126
+ end
127
+
128
+ # unit tests for get_ticket_entry
129
+ # Returns a single ticket entry.
130
+ # @param client Identification of executing client.
131
+ # @param ticket_id ID to identify the ticket.
132
+ # @param ticket_entry_id ID to identify the ticket entry of the ticket.
133
+ # @param [Hash] opts the optional parameters
134
+ # @return [TicketEntry]
135
+ describe 'get_ticket_entry test' do
136
+ it 'should work' do
137
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
138
+ end
139
+ end
140
+
141
+ # unit tests for get_tickets
142
+ # Lists all tickets.
143
+ # @param client Identification of executing client.
144
+ # @param offset Position in the dataset to start to retrieve.
145
+ # @param page_size Amount of objects to return per page.
146
+ # @param [Hash] opts the optional parameters
147
+ # @option opts [String] :ticket_number Restrict the list for a specific ticket number
148
+ # @option opts [DateTime] :create_date_from Restrict the list for begin of creation date.
149
+ # @option opts [DateTime] :create_date_to Restrict the list for end of creation date.
150
+ # @option opts [DateTime] :deactivation_date_from Restrict the list for start of deactivation date.
151
+ # @option opts [DateTime] :deactivation_date_to Restrict the list for end of deactivation date.
152
+ # @option opts [Boolean] :locked Restrict the list for locked tickets.
153
+ # @option opts [DateTime] :locked_to_date_from Restrict the list for for locked tickets.
154
+ # @option opts [DateTime] :locked_to_date_to Restrict the list for for locked tickets.
155
+ # @option opts [String] :personalization_customer_number Restrict the list for tickets owned by customers with specific customer number.
156
+ # @option opts [String] :personalization_lastname Restrict the list for tickets owned by customers with specific last name.
157
+ # @option opts [String] :personalization_firstname Restrict the list for tickets owned by customers with specific first name.
158
+ # @return [TicketList]
159
+ describe 'get_tickets test' do
160
+ it 'should work' do
161
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
162
+ end
163
+ end
164
+
165
+ # unit tests for update_image
166
+ # Updates the owners image of the ticket
167
+ # @param client Identification of executing client.
168
+ # @param ticket_id ID to identify the ticket.
169
+ # @param body Properties to update of the image.
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [ModelReference]
172
+ describe 'update_image test' do
173
+ it 'should work' do
174
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
175
+ end
176
+ end
177
+
178
+ # unit tests for update_ticket
179
+ # Updates the single ticket.
180
+ # @param client Identification of executing client.
181
+ # @param ticket_id ID to identify the ticket.
182
+ # @param body Properties to update of the ticket.
183
+ # @param [Hash] opts the optional parameters
184
+ # @return [ModelReference]
185
+ describe 'update_ticket test' do
186
+ it 'should work' do
187
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
188
+ end
189
+ end
190
+
191
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #KORONA.entry API v1
3
+
4
+ #Our api provides access to our entry services
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe KoronaEntryClient::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ KoronaEntryClient.configure { |c| c.host = 'http://example.com' }
21
+ expect(KoronaEntryClient::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ KoronaEntryClient.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(KoronaEntryClient::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ KoronaEntryClient.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(KoronaEntryClient::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
+ KoronaEntryClient.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(KoronaEntryClient::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
+ KoronaEntryClient.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(KoronaEntryClient::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ KoronaEntryClient.configure { |c| c.base_path = nil }
48
+ expect(KoronaEntryClient::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) { KoronaEntryClient::Configuration.new }
56
+ let(:api_client) { KoronaEntryClient::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(KoronaEntryClient::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) { KoronaEntryClient::Configuration.new }
75
+ let(:api_client) { KoronaEntryClient::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(KoronaEntryClient::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 = KoronaEntryClient::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 = KoronaEntryClient::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 = KoronaEntryClient::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 = KoronaEntryClient::ApiClient.new
125
+ # _model = KoronaEntryClient::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) { KoronaEntryClient::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 { 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) { KoronaEntryClient::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) { KoronaEntryClient::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) { KoronaEntryClient::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) { KoronaEntryClient::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