ddr_client 2.0.0.d9f2bd2b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +168 -0
  4. data/Rakefile +8 -0
  5. data/ddr_client.gemspec +46 -0
  6. data/docs/BatchObjectsApi.md +125 -0
  7. data/docs/BatchesApi.md +305 -0
  8. data/docs/DdrAPIBatchEntity.md +24 -0
  9. data/docs/DdrAPIBatchEntityLogfile.md +11 -0
  10. data/docs/DdrAPIBatchObjectAttributeEntity.md +16 -0
  11. data/docs/DdrAPIBatchObjectDatastreamEntity.md +17 -0
  12. data/docs/DdrAPIBatchObjectEntity.md +26 -0
  13. data/docs/DdrAPIBatchObjectMessageEntity.md +13 -0
  14. data/docs/DdrAPIBatchObjectRelationshipEntity.md +15 -0
  15. data/docs/DdrAPIBatchObjectRoleEntity.md +15 -0
  16. data/docs/DdrAPIEventEntity.md +17 -0
  17. data/docs/DdrAPIFileEntity.md +11 -0
  18. data/docs/DdrAPIGroupEntity.md +10 -0
  19. data/docs/DdrAPIGroupMemberEntity.md +10 -0
  20. data/docs/DdrAPILinkEntity.md +9 -0
  21. data/docs/DdrAPIResourceEntity.md +17 -0
  22. data/docs/DdrAPIResourceEntityFiles.md +17 -0
  23. data/docs/DdrAPIResourceEntityMetadata.md +62 -0
  24. data/docs/DdrAPIResourceEntityRelated.md +11 -0
  25. data/docs/DdrAPIRoleEntity.md +10 -0
  26. data/docs/DdrAPITechnicalMetadataEntity.md +24 -0
  27. data/docs/DdrAPIUserEntity.md +19 -0
  28. data/docs/EventsApi.md +131 -0
  29. data/docs/GroupsApi.md +63 -0
  30. data/docs/IndexApi.md +161 -0
  31. data/docs/PatchResources.md +11 -0
  32. data/docs/PatchResourcesMetadata.md +62 -0
  33. data/docs/PatchResourcesRelated.md +11 -0
  34. data/docs/PatchResourcesRoles.md +10 -0
  35. data/docs/PostResources.md +12 -0
  36. data/docs/QueuesApi.md +102 -0
  37. data/docs/ReportsApi.md +177 -0
  38. data/docs/ResourcesApi.md +1003 -0
  39. data/docs/SchemaApi.md +128 -0
  40. data/docs/UsersApi.md +131 -0
  41. data/git_push.sh +55 -0
  42. data/lib/ddr_client/api/batch_objects_api.rb +138 -0
  43. data/lib/ddr_client/api/batches_api.rb +306 -0
  44. data/lib/ddr_client/api/events_api.rb +147 -0
  45. data/lib/ddr_client/api/groups_api.rb +70 -0
  46. data/lib/ddr_client/api/index_api.rb +164 -0
  47. data/lib/ddr_client/api/queues_api.rb +109 -0
  48. data/lib/ddr_client/api/reports_api.rb +179 -0
  49. data/lib/ddr_client/api/resources_api.rb +1098 -0
  50. data/lib/ddr_client/api/schema_api.rb +152 -0
  51. data/lib/ddr_client/api/users_api.rb +141 -0
  52. data/lib/ddr_client/api_client.rb +391 -0
  53. data/lib/ddr_client/api_error.rb +38 -0
  54. data/lib/ddr_client/configuration.rb +209 -0
  55. data/lib/ddr_client/models/ddr_api_batch_entity.rb +333 -0
  56. data/lib/ddr_client/models/ddr_api_batch_entity_logfile.rb +211 -0
  57. data/lib/ddr_client/models/ddr_api_batch_object_attribute_entity.rb +256 -0
  58. data/lib/ddr_client/models/ddr_api_batch_object_datastream_entity.rb +265 -0
  59. data/lib/ddr_client/models/ddr_api_batch_object_entity.rb +349 -0
  60. data/lib/ddr_client/models/ddr_api_batch_object_message_entity.rb +230 -0
  61. data/lib/ddr_client/models/ddr_api_batch_object_relationship_entity.rb +247 -0
  62. data/lib/ddr_client/models/ddr_api_batch_object_role_entity.rb +247 -0
  63. data/lib/ddr_client/models/ddr_api_event_entity.rb +325 -0
  64. data/lib/ddr_client/models/ddr_api_file_entity.rb +215 -0
  65. data/lib/ddr_client/models/ddr_api_group_entity.rb +203 -0
  66. data/lib/ddr_client/models/ddr_api_group_member_entity.rb +202 -0
  67. data/lib/ddr_client/models/ddr_api_link_entity.rb +193 -0
  68. data/lib/ddr_client/models/ddr_api_resource_entity.rb +310 -0
  69. data/lib/ddr_client/models/ddr_api_resource_entity_files.rb +276 -0
  70. data/lib/ddr_client/models/ddr_api_resource_entity_metadata.rb +874 -0
  71. data/lib/ddr_client/models/ddr_api_resource_entity_related.rb +216 -0
  72. data/lib/ddr_client/models/ddr_api_role_entity.rb +251 -0
  73. data/lib/ddr_client/models/ddr_api_technical_metadata_entity.rb +329 -0
  74. data/lib/ddr_client/models/ddr_api_user_entity.rb +296 -0
  75. data/lib/ddr_client/models/patch_resources.rb +221 -0
  76. data/lib/ddr_client/models/patch_resources_metadata.rb +726 -0
  77. data/lib/ddr_client/models/patch_resources_related.rb +216 -0
  78. data/lib/ddr_client/models/patch_resources_roles.rb +220 -0
  79. data/lib/ddr_client/models/post_resources.rb +265 -0
  80. data/lib/ddr_client/version.rb +15 -0
  81. data/lib/ddr_client.rb +74 -0
  82. data/spec/api/batch_objects_api_spec.rb +61 -0
  83. data/spec/api/batches_api_spec.rb +100 -0
  84. data/spec/api/events_api_spec.rb +64 -0
  85. data/spec/api/groups_api_spec.rb +46 -0
  86. data/spec/api/index_api_spec.rb +67 -0
  87. data/spec/api/queues_api_spec.rb +55 -0
  88. data/spec/api/reports_api_spec.rb +70 -0
  89. data/spec/api/resources_api_spec.rb +271 -0
  90. data/spec/api/schema_api_spec.rb +65 -0
  91. data/spec/api/users_api_spec.rb +64 -0
  92. data/spec/api_client_spec.rb +243 -0
  93. data/spec/configuration_spec.rb +42 -0
  94. data/spec/models/ddr_api_batch_entity_logfile_spec.rb +59 -0
  95. data/spec/models/ddr_api_batch_entity_spec.rb +137 -0
  96. data/spec/models/ddr_api_batch_object_attribute_entity_spec.rb +89 -0
  97. data/spec/models/ddr_api_batch_object_datastream_entity_spec.rb +95 -0
  98. data/spec/models/ddr_api_batch_object_entity_spec.rb +149 -0
  99. data/spec/models/ddr_api_batch_object_message_entity_spec.rb +71 -0
  100. data/spec/models/ddr_api_batch_object_relationship_entity_spec.rb +83 -0
  101. data/spec/models/ddr_api_batch_object_role_entity_spec.rb +83 -0
  102. data/spec/models/ddr_api_event_entity_spec.rb +103 -0
  103. data/spec/models/ddr_api_file_entity_spec.rb +59 -0
  104. data/spec/models/ddr_api_group_entity_spec.rb +53 -0
  105. data/spec/models/ddr_api_group_member_entity_spec.rb +53 -0
  106. data/spec/models/ddr_api_link_entity_spec.rb +47 -0
  107. data/spec/models/ddr_api_resource_entity_files_spec.rb +95 -0
  108. data/spec/models/ddr_api_resource_entity_metadata_spec.rb +389 -0
  109. data/spec/models/ddr_api_resource_entity_related_spec.rb +59 -0
  110. data/spec/models/ddr_api_resource_entity_spec.rb +99 -0
  111. data/spec/models/ddr_api_role_entity_spec.rb +61 -0
  112. data/spec/models/ddr_api_technical_metadata_entity_spec.rb +137 -0
  113. data/spec/models/ddr_api_user_entity_spec.rb +107 -0
  114. data/spec/models/patch_resources_metadata_spec.rb +365 -0
  115. data/spec/models/patch_resources_related_spec.rb +59 -0
  116. data/spec/models/patch_resources_roles_spec.rb +53 -0
  117. data/spec/models/patch_resources_spec.rb +59 -0
  118. data/spec/models/post_resources_spec.rb +69 -0
  119. data/spec/spec_helper.rb +111 -0
  120. metadata +399 -0
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DdrClient::ResourcesApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'ResourcesApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = DdrClient::ResourcesApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ResourcesApi' do
30
+ it 'should create an instance of ResourcesApi' do
31
+ expect(@instance).to be_instance_of(DdrClient::ResourcesApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_resources
36
+ # Filter resources
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :admin_set Limit to selected admin set
39
+ # @option opts [String] :original_filename Match by original file name
40
+ # @option opts [Array<String>] :sha1 Match by original file SHA1 digest
41
+ # @option opts [Array<String>] :model Limit to selected model type(s)
42
+ # @option opts [String] :workflow_state Filter by workflow state
43
+ # @option opts [DateTime] :modified_before Limit results to resources created or modified before a date/time
44
+ # @option opts [DateTime] :modified_since Limit results to resources created or modified since a date/time
45
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
46
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
47
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
48
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
49
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
50
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
51
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
52
+ # @return [Array<DdrAPIResourceEntity>]
53
+ describe 'get_resources 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_resources_by_role
60
+ # Find resources by role
61
+ # @param [Hash] opts the optional parameters
62
+ # @option opts [String] :agent Person or group to whom access is granted
63
+ # @option opts [String] :role_type Type of access granted
64
+ # @option opts [String] :scope Scope of the access granted
65
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
66
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
67
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
68
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
69
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
70
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
71
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
72
+ # @return [Array<DdrAPIResourceEntity>]
73
+ describe 'get_resources_by_role test' do
74
+ it 'should work' do
75
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
76
+ end
77
+ end
78
+
79
+ # unit tests for get_resources_id
80
+ # Retrieve a resource
81
+ # @param id
82
+ # @param [Hash] opts the optional parameters
83
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
84
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
85
+ # @return [DdrAPIResourceEntity]
86
+ describe 'get_resources_id test' do
87
+ it 'should work' do
88
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
89
+ end
90
+ end
91
+
92
+ # unit tests for get_resources_id_attachments
93
+ # Get attachments to a Collection
94
+ # @param id
95
+ # @param [Hash] opts the optional parameters
96
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
97
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
98
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
99
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
100
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
101
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
102
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
103
+ # @return [Array<DdrAPIResourceEntity>]
104
+ describe 'get_resources_id_attachments test' do
105
+ it 'should work' do
106
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
107
+ end
108
+ end
109
+
110
+ # unit tests for get_resources_id_batches
111
+ # Get batches associated with the resource (by batch collection_id or batch object resource_id)
112
+ # @param id
113
+ # @param [Hash] opts the optional parameters
114
+ # @option opts [BOOLEAN] :batch_objects Include batch objects for each batch
115
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
116
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
117
+ # @return [Array<DdrAPIBatchEntity>]
118
+ describe 'get_resources_id_batches test' do
119
+ it 'should work' do
120
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
121
+ end
122
+ end
123
+
124
+ # unit tests for get_resources_id_children
125
+ # Get children of a resource
126
+ # @param id
127
+ # @param [Hash] opts the optional parameters
128
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
129
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
130
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
131
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
132
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
133
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
134
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
135
+ # @return [Array<DdrAPIResourceEntity>]
136
+ describe 'get_resources_id_children test' do
137
+ it 'should work' do
138
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
139
+ end
140
+ end
141
+
142
+ # unit tests for get_resources_id_download
143
+ # Download original file
144
+ # @param id
145
+ # @param [Hash] opts the optional parameters
146
+ # @return [File]
147
+ describe 'get_resources_id_download test' do
148
+ it 'should work' do
149
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
150
+ end
151
+ end
152
+
153
+ # unit tests for get_resources_id_files_slug
154
+ # Download a file attached to a resource
155
+ # @param id
156
+ # @param slug
157
+ # @param [Hash] opts the optional parameters
158
+ # @return [File]
159
+ describe 'get_resources_id_files_slug 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 get_resources_id_fixity
166
+ # Perform a fixity check on the resource
167
+ # Content &lt;&#x3D; 1GB is checked and results returned; content &gt; 1GB is accepted and background job information is returned
168
+ # @param id
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [nil]
171
+ describe 'get_resources_id_fixity test' do
172
+ it 'should work' do
173
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
174
+ end
175
+ end
176
+
177
+ # unit tests for get_resources_id_members
178
+ # Get members of a Collection
179
+ # Members include all resources related to the collection by admin_policy_id, which includes itself.
180
+ # @param id
181
+ # @param [Hash] opts the optional parameters
182
+ # @option opts [Array<String>] :model Limit to selected model type(s)
183
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
184
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
185
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
186
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
187
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
188
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
189
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
190
+ # @return [Array<DdrAPIResourceEntity>]
191
+ describe 'get_resources_id_members test' do
192
+ it 'should work' do
193
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
194
+ end
195
+ end
196
+
197
+ # unit tests for get_resources_id_permanent_id
198
+ # Retrieve metadata for the permanent ID assigned to the resource
199
+ # @param id
200
+ # @param [Hash] opts the optional parameters
201
+ # @return [nil]
202
+ describe 'get_resources_id_permanent_id test' do
203
+ it 'should work' do
204
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
205
+ end
206
+ end
207
+
208
+ # unit tests for get_resources_id_permissions
209
+ # Return the effective permissions on the resource
210
+ # @param id
211
+ # @param [Hash] opts the optional parameters
212
+ # @return [nil]
213
+ describe 'get_resources_id_permissions test' do
214
+ it 'should work' do
215
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
216
+ end
217
+ end
218
+
219
+ # unit tests for get_resources_id_targets
220
+ # Get targets associated with the Collection
221
+ # @param id
222
+ # @param [Hash] opts the optional parameters
223
+ # @option opts [Array<String>] :fields Metadata fields to include (resource ID and model are always included)
224
+ # @option opts [Array<String>] :exclude_fields Metadata fields to exclude (cannot combine with \&quot;fields\&quot;)
225
+ # @option opts [Array<String>] :csv_fields CSV only: Include additional columns
226
+ # @option opts [Array<String>] :file_fields CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)
227
+ # @option opts [BOOLEAN] :remove_empty_columns CSV only: Remove empty columns from CSV output table
228
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
229
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
230
+ # @return [Array<DdrAPIResourceEntity>]
231
+ describe 'get_resources_id_targets test' do
232
+ it 'should work' do
233
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
234
+ end
235
+ end
236
+
237
+ # unit tests for get_resources_id_technical_metadata
238
+ # Get technical metadata for Component members of the Collection
239
+ # @param id
240
+ # @param [Hash] opts the optional parameters
241
+ # @return [Array<DdrAPITechnicalMetadataEntity>]
242
+ describe 'get_resources_id_technical_metadata test' do
243
+ it 'should work' do
244
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
245
+ end
246
+ end
247
+
248
+ # unit tests for patch_resources_id
249
+ # Update a resource
250
+ # @param id
251
+ # @param resources
252
+ # @param [Hash] opts the optional parameters
253
+ # @return [DdrAPIResourceEntity]
254
+ describe 'patch_resources_id test' do
255
+ it 'should work' do
256
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
257
+ end
258
+ end
259
+
260
+ # unit tests for post_resources
261
+ # Create a resource
262
+ # @param resources
263
+ # @param [Hash] opts the optional parameters
264
+ # @return [DdrAPIResourceEntity]
265
+ describe 'post_resources test' do
266
+ it 'should work' do
267
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
268
+ end
269
+ end
270
+
271
+ end
@@ -0,0 +1,65 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DdrClient::SchemaApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'SchemaApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = DdrClient::SchemaApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of SchemaApi' do
30
+ it 'should create an instance of SchemaApi' do
31
+ expect(@instance).to be_instance_of(DdrClient::SchemaApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_schema_event
36
+ # Event schema
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [nil]
39
+ describe 'get_schema_event 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_schema_resource
46
+ # Resource schema
47
+ # @param [Hash] opts the optional parameters
48
+ # @return [nil]
49
+ describe 'get_schema_resource test' do
50
+ it 'should work' do
51
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ end
53
+ end
54
+
55
+ # unit tests for get_schema_user
56
+ # User schema
57
+ # @param [Hash] opts the optional parameters
58
+ # @return [nil]
59
+ describe 'get_schema_user test' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ end
@@ -0,0 +1,64 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DdrClient::UsersApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'UsersApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = DdrClient::UsersApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of UsersApi' do
30
+ it 'should create an instance of UsersApi' do
31
+ expect(@instance).to be_instance_of(DdrClient::UsersApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_users
36
+ # List users
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :username User Name
39
+ # @option opts [String] :netid Duke NetID
40
+ # @option opts [String] :duid Duke Unique ID
41
+ # @option opts [String] :email Email Address
42
+ # @option opts [String] :first_name First Name
43
+ # @option opts [String] :last_name Last Name
44
+ # @option opts [Object] :per_page JSON only: Number of records to return per page (default: 20)
45
+ # @option opts [Object] :page JSON only: Page number of results to return (default: 1)
46
+ # @return [Array<DdrAPIUserEntity>]
47
+ describe 'get_users test' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ # unit tests for get_users_id
54
+ # Retrieve a user record
55
+ # @param id
56
+ # @param [Hash] opts the optional parameters
57
+ # @return [DdrAPIUserEntity]
58
+ describe 'get_users_id 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
+ end
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe DdrClient::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ DdrClient.configure { |c| c.host = 'http://example.com' }
21
+ expect(DdrClient::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ DdrClient.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(DdrClient::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ DdrClient.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(DdrClient::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
+ DdrClient.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(DdrClient::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
+ DdrClient.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(DdrClient::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ DdrClient.configure { |c| c.base_path = nil }
48
+ expect(DdrClient::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) { DdrClient::Configuration.new }
56
+ let(:api_client) { DdrClient::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(DdrClient::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) { DdrClient::Configuration.new }
75
+ let(:api_client) { DdrClient::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(DdrClient::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 '#build_request' do
93
+ let(:config) { DdrClient::Configuration.new }
94
+ let(:api_client) { DdrClient::ApiClient.new(config) }
95
+
96
+ it 'does not send multipart to request' do
97
+ expect(Typhoeus::Request).to receive(:new).with(anything, hash_not_including(:multipart))
98
+ api_client.build_request(:get, '/test')
99
+ end
100
+
101
+ context 'when the content type is multipart' do
102
+ it 'sends multipart to request' do
103
+ expect(Typhoeus::Request).to receive(:new).with(anything, hash_including(multipart: true))
104
+ api_client.build_request(:get, '/test', {header_params: { 'Content-Type' => 'multipart/form-data'}})
105
+ end
106
+ end
107
+ end
108
+
109
+ describe '#deserialize' do
110
+ it "handles Array<Integer>" do
111
+ api_client = DdrClient::ApiClient.new
112
+ headers = { 'Content-Type' => 'application/json' }
113
+ response = double('response', headers: headers, body: '[12, 34]')
114
+ data = api_client.deserialize(response, 'Array<Integer>')
115
+ expect(data).to be_instance_of(Array)
116
+ expect(data).to eq([12, 34])
117
+ end
118
+
119
+ it 'handles Array<Array<Integer>>' do
120
+ api_client = DdrClient::ApiClient.new
121
+ headers = { 'Content-Type' => 'application/json' }
122
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
123
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
124
+ expect(data).to be_instance_of(Array)
125
+ expect(data).to eq([[12, 34], [56]])
126
+ end
127
+
128
+ it 'handles Hash<String, String>' do
129
+ api_client = DdrClient::ApiClient.new
130
+ headers = { 'Content-Type' => 'application/json' }
131
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
132
+ data = api_client.deserialize(response, 'Hash<String, String>')
133
+ expect(data).to be_instance_of(Hash)
134
+ expect(data).to eq(:message => 'Hello')
135
+ end
136
+ end
137
+
138
+ describe "#object_to_hash" do
139
+ it 'ignores nils and includes empty arrays' do
140
+ # uncomment below to test object_to_hash for model
141
+ # api_client = DdrClient::ApiClient.new
142
+ # _model = DdrClient::ModelName.new
143
+ # update the model attribute below
144
+ # _model.id = 1
145
+ # update the expected value (hash) below
146
+ # expected = {id: 1, name: '', tags: []}
147
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
148
+ end
149
+ end
150
+
151
+ describe '#build_collection_param' do
152
+ let(:param) { ['aa', 'bb', 'cc'] }
153
+ let(:api_client) { DdrClient::ApiClient.new }
154
+
155
+ it 'works for csv' do
156
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
157
+ end
158
+
159
+ it 'works for ssv' do
160
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
161
+ end
162
+
163
+ it 'works for tsv' do
164
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
165
+ end
166
+
167
+ it 'works for pipes' do
168
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
169
+ end
170
+
171
+ it 'works for multi' do
172
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
173
+ end
174
+
175
+ it 'fails for invalid collection format' do
176
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
177
+ end
178
+ end
179
+
180
+ describe '#json_mime?' do
181
+ let(:api_client) { DdrClient::ApiClient.new }
182
+
183
+ it 'works' do
184
+ expect(api_client.json_mime?(nil)).to eq false
185
+ expect(api_client.json_mime?('')).to eq false
186
+
187
+ expect(api_client.json_mime?('application/json')).to eq true
188
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
189
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
190
+
191
+ expect(api_client.json_mime?('application/xml')).to eq false
192
+ expect(api_client.json_mime?('text/plain')).to eq false
193
+ expect(api_client.json_mime?('application/jsonp')).to eq false
194
+ end
195
+ end
196
+
197
+ describe '#select_header_accept' do
198
+ let(:api_client) { DdrClient::ApiClient.new }
199
+
200
+ it 'works' do
201
+ expect(api_client.select_header_accept(nil)).to be_nil
202
+ expect(api_client.select_header_accept([])).to be_nil
203
+
204
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
205
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
206
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
207
+
208
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
209
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
210
+ end
211
+ end
212
+
213
+ describe '#select_header_content_type' do
214
+ let(:api_client) { DdrClient::ApiClient.new }
215
+
216
+ it 'works' do
217
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
218
+ expect(api_client.select_header_content_type([])).to eq('application/json')
219
+
220
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
221
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
222
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
223
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
224
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
225
+ end
226
+ end
227
+
228
+ describe '#sanitize_filename' do
229
+ let(:api_client) { DdrClient::ApiClient.new }
230
+
231
+ it 'works' do
232
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
233
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
234
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
235
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
236
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
237
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
238
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
239
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
240
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe DdrClient::Configuration do
16
+ let(:config) { DdrClient::Configuration.default }
17
+
18
+ before(:each) do
19
+ # uncomment below to setup host and base_path
20
+ # require 'URI'
21
+ # uri = URI.parse("https://example.org/api")
22
+ # DdrClient.configure do |c|
23
+ # c.host = uri.host
24
+ # c.base_path = uri.path
25
+ # end
26
+ end
27
+
28
+ describe '#base_url' do
29
+ it 'should have the default value' do
30
+ # uncomment below to test default value of the base path
31
+ # expect(config.base_url).to eq("https://example.org/api")
32
+ end
33
+
34
+ it 'should remove trailing slashes' do
35
+ [nil, '', '/', '//'].each do |base_path|
36
+ config.base_path = base_path
37
+ # uncomment below to test trailing slashes
38
+ # expect(config.base_url).to eq("https://example.org/api")
39
+ end
40
+ end
41
+ end
42
+ end