ruby-linstor-client 1.0.0

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 (193) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +86 -0
  4. data/LICENSE +21 -0
  5. data/README.md +21 -0
  6. data/Rakefile +10 -0
  7. data/codegen.sh +22 -0
  8. data/generator/custom/one_of_drbd_resource_definition_layer.rb +7 -0
  9. data/generator/custom/one_of_drbd_volume_definition.rb +7 -0
  10. data/generator/custom/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +11 -0
  11. data/generator/openapi-generator.yaml +11 -0
  12. data/generator/template/Gemfile.mustache +9 -0
  13. data/generator/template/README.mustache +148 -0
  14. data/generator/template/Rakefile.mustache +10 -0
  15. data/generator/template/api.mustache +209 -0
  16. data/generator/template/api_client.mustache +264 -0
  17. data/generator/template/api_client_faraday_partial.mustache +136 -0
  18. data/generator/template/api_client_spec.mustache +220 -0
  19. data/generator/template/api_client_typhoeus_partial.mustache +153 -0
  20. data/generator/template/api_doc.mustache +118 -0
  21. data/generator/template/api_error.mustache +49 -0
  22. data/generator/template/api_info.mustache +12 -0
  23. data/generator/template/api_test.mustache +47 -0
  24. data/generator/template/base_object.mustache +120 -0
  25. data/generator/template/configuration.mustache +385 -0
  26. data/generator/template/configuration_spec.mustache +34 -0
  27. data/generator/template/configuration_tls_faraday_partial.mustache +29 -0
  28. data/generator/template/configuration_tls_typhoeus_partial.mustache +34 -0
  29. data/generator/template/gem.mustache +53 -0
  30. data/generator/template/gemspec.mustache +35 -0
  31. data/generator/template/git_push.sh.mustache +57 -0
  32. data/generator/template/gitignore.mustache +39 -0
  33. data/generator/template/model.mustache +26 -0
  34. data/generator/template/model_doc.mustache +12 -0
  35. data/generator/template/model_test.mustache +77 -0
  36. data/generator/template/partial_model_enum_class.mustache +20 -0
  37. data/generator/template/partial_model_generic.mustache +371 -0
  38. data/generator/template/partial_model_generic_doc.mustache +28 -0
  39. data/generator/template/partial_oneof_module.mustache +137 -0
  40. data/generator/template/partial_oneof_module_doc.mustache +92 -0
  41. data/generator/template/rspec.mustache +2 -0
  42. data/generator/template/rubocop.mustache +148 -0
  43. data/generator/template/spec_helper.mustache +103 -0
  44. data/generator/template/travis.mustache +14 -0
  45. data/generator/template/version.mustache +7 -0
  46. data/lib/ruby-linstor-client/api/developers_api.rb +5856 -0
  47. data/lib/ruby-linstor-client/api_client.rb +393 -0
  48. data/lib/ruby-linstor-client/api_error.rb +57 -0
  49. data/lib/ruby-linstor-client/configuration.rb +298 -0
  50. data/lib/ruby-linstor-client/models/api_call_rc.rb +293 -0
  51. data/lib/ruby-linstor-client/models/auto_place_request.rb +245 -0
  52. data/lib/ruby-linstor-client/models/auto_select_filter.rb +305 -0
  53. data/lib/ruby-linstor-client/models/candidate.rb +248 -0
  54. data/lib/ruby-linstor-client/models/controller_props_modify.rb +243 -0
  55. data/lib/ruby-linstor-client/models/controller_version.rb +245 -0
  56. data/lib/ruby-linstor-client/models/drbd_proxy_enable.rb +219 -0
  57. data/lib/ruby-linstor-client/models/drbd_proxy_modify.rb +288 -0
  58. data/lib/ruby-linstor-client/models/drbd_resource.rb +276 -0
  59. data/lib/ruby-linstor-client/models/drbd_resource_definition_layer.rb +283 -0
  60. data/lib/ruby-linstor-client/models/drbd_volume.rb +285 -0
  61. data/lib/ruby-linstor-client/models/drbd_volume_definition.rb +236 -0
  62. data/lib/ruby-linstor-client/models/error_report.rb +252 -0
  63. data/lib/ruby-linstor-client/models/key_value_store.rb +231 -0
  64. data/lib/ruby-linstor-client/models/key_value_store_modify.rb +243 -0
  65. data/lib/ruby-linstor-client/models/layer_type.rb +40 -0
  66. data/lib/ruby-linstor-client/models/luks_resource.rb +220 -0
  67. data/lib/ruby-linstor-client/models/luks_volume.rb +275 -0
  68. data/lib/ruby-linstor-client/models/max_volume_sizes.rb +229 -0
  69. data/lib/ruby-linstor-client/models/net_interface.rb +309 -0
  70. data/lib/ruby-linstor-client/models/node.rb +381 -0
  71. data/lib/ruby-linstor-client/models/node_modify.rb +252 -0
  72. data/lib/ruby-linstor-client/models/nvme_resource.rb +220 -0
  73. data/lib/ruby-linstor-client/models/nvme_volume.rb +266 -0
  74. data/lib/ruby-linstor-client/models/one_of_drbd_resource_definition_layer.rb +7 -0
  75. data/lib/ruby-linstor-client/models/one_of_drbd_volume_definition.rb +7 -0
  76. data/lib/ruby-linstor-client/models/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +11 -0
  77. data/lib/ruby-linstor-client/models/pass_phrase_create.rb +227 -0
  78. data/lib/ruby-linstor-client/models/physical_storage.rb +238 -0
  79. data/lib/ruby-linstor-client/models/physical_storage_create.rb +337 -0
  80. data/lib/ruby-linstor-client/models/physical_storage_device.rb +245 -0
  81. data/lib/ruby-linstor-client/models/physical_storage_storage_pool_create.rb +232 -0
  82. data/lib/ruby-linstor-client/models/provider_kind.rb +43 -0
  83. data/lib/ruby-linstor-client/models/resource.rb +278 -0
  84. data/lib/ruby-linstor-client/models/resource_connection.rb +261 -0
  85. data/lib/ruby-linstor-client/models/resource_connection_modify.rb +243 -0
  86. data/lib/ruby-linstor-client/models/resource_create.rb +238 -0
  87. data/lib/ruby-linstor-client/models/resource_definition.rb +295 -0
  88. data/lib/ruby-linstor-client/models/resource_definition_create.rb +262 -0
  89. data/lib/ruby-linstor-client/models/resource_definition_layer.rb +228 -0
  90. data/lib/ruby-linstor-client/models/resource_definition_modify.rb +274 -0
  91. data/lib/ruby-linstor-client/models/resource_group.rb +262 -0
  92. data/lib/ruby-linstor-client/models/resource_group_modify.rb +261 -0
  93. data/lib/ruby-linstor-client/models/resource_group_spawn.rb +255 -0
  94. data/lib/ruby-linstor-client/models/resource_layer.rb +283 -0
  95. data/lib/ruby-linstor-client/models/resource_modify.rb +243 -0
  96. data/lib/ruby-linstor-client/models/resource_state.rb +218 -0
  97. data/lib/ruby-linstor-client/models/resource_with_volumes.rb +297 -0
  98. data/lib/ruby-linstor-client/models/resource_with_volumes_all_of.rb +220 -0
  99. data/lib/ruby-linstor-client/models/snapshot.rb +282 -0
  100. data/lib/ruby-linstor-client/models/snapshot_restore.rb +236 -0
  101. data/lib/ruby-linstor-client/models/snapshot_volume_definition.rb +228 -0
  102. data/lib/ruby-linstor-client/models/storage_pool.rb +333 -0
  103. data/lib/ruby-linstor-client/models/storage_pool_definition.rb +230 -0
  104. data/lib/ruby-linstor-client/models/storage_pool_definition_modify.rb +243 -0
  105. data/lib/ruby-linstor-client/models/storage_resource.rb +220 -0
  106. data/lib/ruby-linstor-client/models/storage_volume.rb +256 -0
  107. data/lib/ruby-linstor-client/models/volume.rb +327 -0
  108. data/lib/ruby-linstor-client/models/volume_definition.rb +277 -0
  109. data/lib/ruby-linstor-client/models/volume_definition_create.rb +232 -0
  110. data/lib/ruby-linstor-client/models/volume_definition_layer.rb +233 -0
  111. data/lib/ruby-linstor-client/models/volume_definition_modify.rb +264 -0
  112. data/lib/ruby-linstor-client/models/volume_group.rb +251 -0
  113. data/lib/ruby-linstor-client/models/volume_group_modify.rb +255 -0
  114. data/lib/ruby-linstor-client/models/volume_layer.rb +228 -0
  115. data/lib/ruby-linstor-client/models/volume_modify.rb +243 -0
  116. data/lib/ruby-linstor-client/models/volume_state.rb +218 -0
  117. data/lib/ruby-linstor-client/models/writecache_resource.rb +220 -0
  118. data/lib/ruby-linstor-client/models/writecache_volume.rb +266 -0
  119. data/lib/ruby-linstor-client/version.rb +15 -0
  120. data/lib/ruby-linstor-client.rb +109 -0
  121. data/pkg/ruby-linstor-client-1.0.0.gem +0 -0
  122. data/ruby-linstor-client.gemspec +39 -0
  123. data/spec/api/developers_api_spec.rb +1116 -0
  124. data/spec/api_client_spec.rb +188 -0
  125. data/spec/configuration_spec.rb +42 -0
  126. data/spec/models/api_call_rc_spec.rb +70 -0
  127. data/spec/models/auto_place_request_spec.rb +46 -0
  128. data/spec/models/auto_select_filter_spec.rb +82 -0
  129. data/spec/models/candidate_spec.rb +52 -0
  130. data/spec/models/controller_props_modify_spec.rb +46 -0
  131. data/spec/models/controller_version_spec.rb +52 -0
  132. data/spec/models/drbd_proxy_enable_spec.rb +34 -0
  133. data/spec/models/drbd_proxy_modify_spec.rb +56 -0
  134. data/spec/models/drbd_resource_definition_layer_spec.rb +76 -0
  135. data/spec/models/drbd_resource_spec.rb +70 -0
  136. data/spec/models/drbd_volume_definition_spec.rb +46 -0
  137. data/spec/models/drbd_volume_spec.rb +76 -0
  138. data/spec/models/error_report_spec.rb +52 -0
  139. data/spec/models/key_value_store_modify_spec.rb +46 -0
  140. data/spec/models/key_value_store_spec.rb +40 -0
  141. data/spec/models/layer_type_spec.rb +28 -0
  142. data/spec/models/luks_resource_spec.rb +34 -0
  143. data/spec/models/luks_volume_spec.rb +70 -0
  144. data/spec/models/max_volume_sizes_spec.rb +40 -0
  145. data/spec/models/net_interface_spec.rb +68 -0
  146. data/spec/models/node_modify_spec.rb +52 -0
  147. data/spec/models/node_spec.rb +102 -0
  148. data/spec/models/nvme_resource_spec.rb +34 -0
  149. data/spec/models/nvme_volume_spec.rb +64 -0
  150. data/spec/models/pass_phrase_create_spec.rb +40 -0
  151. data/spec/models/physical_storage_create_spec.rb +80 -0
  152. data/spec/models/physical_storage_device_spec.rb +52 -0
  153. data/spec/models/physical_storage_spec.rb +46 -0
  154. data/spec/models/physical_storage_storage_pool_create_spec.rb +40 -0
  155. data/spec/models/provider_kind_spec.rb +28 -0
  156. data/spec/models/resource_connection_modify_spec.rb +46 -0
  157. data/spec/models/resource_connection_spec.rb +58 -0
  158. data/spec/models/resource_create_spec.rb +46 -0
  159. data/spec/models/resource_definition_create_spec.rb +58 -0
  160. data/spec/models/resource_definition_layer_spec.rb +40 -0
  161. data/spec/models/resource_definition_modify_spec.rb +64 -0
  162. data/spec/models/resource_definition_spec.rb +76 -0
  163. data/spec/models/resource_group_modify_spec.rb +58 -0
  164. data/spec/models/resource_group_spawn_spec.rb +52 -0
  165. data/spec/models/resource_group_spec.rb +58 -0
  166. data/spec/models/resource_layer_spec.rb +76 -0
  167. data/spec/models/resource_modify_spec.rb +46 -0
  168. data/spec/models/resource_spec.rb +70 -0
  169. data/spec/models/resource_state_spec.rb +34 -0
  170. data/spec/models/resource_with_volumes_all_of_spec.rb +34 -0
  171. data/spec/models/resource_with_volumes_spec.rb +76 -0
  172. data/spec/models/snapshot_restore_spec.rb +40 -0
  173. data/spec/models/snapshot_spec.rb +70 -0
  174. data/spec/models/snapshot_volume_definition_spec.rb +40 -0
  175. data/spec/models/storage_pool_definition_modify_spec.rb +46 -0
  176. data/spec/models/storage_pool_definition_spec.rb +40 -0
  177. data/spec/models/storage_pool_spec.rb +94 -0
  178. data/spec/models/storage_resource_spec.rb +34 -0
  179. data/spec/models/storage_volume_spec.rb +58 -0
  180. data/spec/models/volume_definition_create_spec.rb +40 -0
  181. data/spec/models/volume_definition_layer_spec.rb +40 -0
  182. data/spec/models/volume_definition_modify_spec.rb +58 -0
  183. data/spec/models/volume_definition_spec.rb +64 -0
  184. data/spec/models/volume_group_modify_spec.rb +52 -0
  185. data/spec/models/volume_group_spec.rb +52 -0
  186. data/spec/models/volume_layer_spec.rb +40 -0
  187. data/spec/models/volume_modify_spec.rb +46 -0
  188. data/spec/models/volume_spec.rb +100 -0
  189. data/spec/models/volume_state_spec.rb +34 -0
  190. data/spec/models/writecache_resource_spec.rb +34 -0
  191. data/spec/models/writecache_volume_spec.rb +64 -0
  192. data/spec/spec_helper.rb +111 -0
  193. metadata +344 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1e3b1709fbd0690c1c94c7e05470139e2d413787b27ace25ad3a09a33fe92a78
4
+ data.tar.gz: a87eed99686541a1c82cc43c3af9fb24be1b42e0af05105c11a434bee66980c2
5
+ SHA512:
6
+ metadata.gz: 922c53b07d974c75373c3f2a25d95b9ad24a775211bbdfa5ce95c448977f5bcd486bf512d27f107fa5a3cc9e6dfd37185b56b423d1ee7ac9a00d00ab2800179f
7
+ data.tar.gz: 4277ba7147cf22eb1b80a696443b26905dde12f02f92c75eb137561c8549b7d2ffe9661b01c6135aea41af7a4f5781c8699fa6621a3a81a1ba35026e9e7838f0
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-linstor-client (1.0.0)
5
+ faraday (~> 1.0, >= 1.0.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ byebug (11.1.3)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.5.0)
14
+ faraday (1.8.0)
15
+ faraday-em_http (~> 1.0)
16
+ faraday-em_synchrony (~> 1.0)
17
+ faraday-excon (~> 1.1)
18
+ faraday-httpclient (~> 1.0.1)
19
+ faraday-net_http (~> 1.0)
20
+ faraday-net_http_persistent (~> 1.1)
21
+ faraday-patron (~> 1.0)
22
+ faraday-rack (~> 1.0)
23
+ multipart-post (>= 1.2, < 3)
24
+ ruby2_keywords (>= 0.0.4)
25
+ faraday-em_http (1.0.0)
26
+ faraday-em_synchrony (1.0.0)
27
+ faraday-excon (1.1.0)
28
+ faraday-httpclient (1.0.1)
29
+ faraday-net_http (1.0.1)
30
+ faraday-net_http_persistent (1.2.0)
31
+ faraday-patron (1.0.0)
32
+ faraday-rack (1.0.0)
33
+ jaro_winkler (1.5.4)
34
+ method_source (1.0.0)
35
+ multipart-post (2.1.1)
36
+ parallel (1.21.0)
37
+ parser (3.1.0.0)
38
+ ast (~> 2.4.1)
39
+ pry (0.13.1)
40
+ coderay (~> 1.1)
41
+ method_source (~> 1.0)
42
+ pry-byebug (3.9.0)
43
+ byebug (~> 11.0)
44
+ pry (~> 0.13.0)
45
+ psych (4.0.3)
46
+ stringio
47
+ rainbow (3.1.1)
48
+ rake (13.0.6)
49
+ rspec (3.10.0)
50
+ rspec-core (~> 3.10.0)
51
+ rspec-expectations (~> 3.10.0)
52
+ rspec-mocks (~> 3.10.0)
53
+ rspec-core (3.10.1)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-expectations (3.10.2)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.10.0)
58
+ rspec-mocks (3.10.2)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.10.0)
61
+ rspec-support (3.10.3)
62
+ rubocop (0.66.0)
63
+ jaro_winkler (~> 1.5.1)
64
+ parallel (~> 1.10)
65
+ parser (>= 2.5, != 2.5.1.1)
66
+ psych (>= 3.1.0)
67
+ rainbow (>= 2.2.2, < 4.0)
68
+ ruby-progressbar (~> 1.7)
69
+ unicode-display_width (>= 1.4.0, < 1.6)
70
+ ruby-progressbar (1.11.0)
71
+ ruby2_keywords (0.0.5)
72
+ stringio (3.0.1)
73
+ unicode-display_width (1.5.0)
74
+
75
+ PLATFORMS
76
+ x86_64-linux
77
+
78
+ DEPENDENCIES
79
+ pry-byebug
80
+ rake (~> 13.0.1)
81
+ rspec (~> 3.6, >= 3.6.0)
82
+ rubocop (~> 0.66.0)
83
+ ruby-linstor-client!
84
+
85
+ BUNDLED WITH
86
+ 2.3.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 buty4649
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # ruby-linstor-client
2
+ LINSTOR API client library for Ruby.
3
+ Code generated by [openapi-generator](https://github.com/OpenAPITools/openapi-generator).
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ require 'ruby-linstor-client'
9
+
10
+ LinstorClient.configure do |c|
11
+ c.host = "203.0.113.25:3370"
12
+ end
13
+
14
+ client = LinstorClient::DevelopersApi.ne
15
+ clinet.view_resources
16
+ ```
17
+
18
+ ## Supported Linstor API version
19
+
20
+ * 1.0.13
21
+ * https://app.swaggerhub.com/apis-docs/Linstor/Linstor/1.0.13#/developers/viewResources
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
data/codegen.sh ADDED
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ VERSION="v5.3.1"
4
+
5
+ docker run -i --rm -v $(pwd):/work -w /work --entrypoint /bin/bash openapitools/openapi-generator-cli:$VERSION <<__EOS__
6
+ curl -s https://raw.githubusercontent.com/LINBIT/linstor-server/v1.4.2/docs/rest_v1_openapi.yaml |
7
+ sed -e 's/- Controller/- CONTROLLER/g' \
8
+ -e 's/- Satellite/- SATELLITE/g' \
9
+ -e 's/- Combined/- COMBINED/g' \
10
+ -e 's/- Auxiliary/- AUXILIARY/g' \
11
+ -e 's/- Plain/- PLAIN/g' \
12
+ > /tmp/openapi.yaml
13
+
14
+ docker-entrypoint.sh generate \
15
+ -i /tmp/openapi.yaml \
16
+ -g ruby -t generator/template -o . -c generator/openapi-generator.yaml --skip-validate-spec
17
+
18
+ for i in generator/custom/*.rb
19
+ do
20
+ cp -v "\$i" lib/ruby-linstor-client/models
21
+ done
22
+ __EOS__
@@ -0,0 +1,7 @@
1
+ module LinstorClient
2
+ class OneOfDrbdResourceDefinitionLayer
3
+ def self.build_from_hash(attributes)
4
+ ResourceDefinitionLayer.new.build_from_hash(attributes)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module LinstorClient
2
+ class OneOfDrbdVolumeDefinition
3
+ def self.build_from_hash(attributes)
4
+ DrbdVolumeDefinition.new.build_from_hash(attributes)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module LinstorClient
2
+ class OneOfDrbdVolumeLUKSVolumeStorageVolumeNVMEVolumeWritecacheVolume
3
+ def self.build_from_hash(attributes)
4
+ if attributes.key?(:drbd_volume_definition)
5
+ DrbdVolume.build_from_hash(attributes)
6
+ else
7
+ StorageVolume.build_from_hash(attributes)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ moduleName: LinstorClient
2
+ library: faraday
3
+ gemName: ruby-linstor-client
4
+ gemVersion: 1.0.0
5
+ gemAuthor: buty4649
6
+ gemAuthorEmail: buty4649@gmail.com
7
+ gemDescription: Linstor REST API Ruby Gem
8
+ gemSummary: Linstor REST API Ruby Gem
9
+ gemHomepage: https://github.com/buty4649/ruby-linstor-client
10
+ gemLicense: MIT
11
+ gemRequiredRubyVersion: ">= 2.7"
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
@@ -0,0 +1,148 @@
1
+ # {{gemName}}
2
+
3
+ {{moduleName}} - the Ruby gem for the {{appName}}
4
+
5
+ {{#appDescriptionWithNewLines}}
6
+ {{{.}}}
7
+ {{/appDescriptionWithNewLines}}
8
+
9
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
10
+
11
+ - API version: {{appVersion}}
12
+ - Package version: {{gemVersion}}
13
+ {{^hideGenerationTimestamp}}
14
+ - Build date: {{generatedDate}}
15
+ {{/hideGenerationTimestamp}}
16
+ - Build package: {{generatorClass}}
17
+ {{#infoUrl}}
18
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
19
+ {{/infoUrl}}
20
+
21
+ ## Installation
22
+
23
+ ### Build a gem
24
+
25
+ To build the Ruby code into a gem:
26
+
27
+ ```shell
28
+ gem build {{{gemName}}}.gemspec
29
+ ```
30
+
31
+ Then either install the gem locally:
32
+
33
+ ```shell
34
+ gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
35
+ ```
36
+
37
+ (for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
38
+
39
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
40
+
41
+ Finally add this to the Gemfile:
42
+
43
+ gem '{{{gemName}}}', '~> {{{gemVersion}}}'
44
+
45
+ ### Install from Git
46
+
47
+ If the Ruby gem is hosted at a git repository: https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
48
+
49
+ gem '{{{gemName}}}', :git => 'https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
50
+
51
+ ### Include the Ruby code directly
52
+
53
+ Include the Ruby code directly using `-I` as follows:
54
+
55
+ ```shell
56
+ ruby -Ilib script.rb
57
+ ```
58
+
59
+ ## Getting Started
60
+
61
+ Please follow the [installation](#installation) procedure and then run the following code:
62
+
63
+ ```ruby
64
+ # Load the gem
65
+ require '{{{gemName}}}'
66
+ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
67
+ # Setup authorization
68
+ {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
69
+ # Configure HTTP basic authorization: {{{name}}}
70
+ config.username = 'YOUR_USERNAME'
71
+ config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}}
72
+ # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
73
+ config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
74
+ # Configure API key authorization: {{{name}}}
75
+ config.api_key['{{{name}}}'] = 'YOUR API KEY'
76
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
77
+ # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
78
+ # Configure OAuth2 access token for authorization: {{{name}}}
79
+ config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
80
+ {{/authMethods}}end
81
+ {{/hasAuthMethods}}
82
+
83
+ api_instance = {{{moduleName}}}::{{{classname}}}.new
84
+ {{#requiredParams}}
85
+ {{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}}
86
+ {{/requiredParams}}
87
+ {{#optionalParams}}
88
+ {{#-first}}
89
+ opts = {
90
+ {{/-first}}
91
+ {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
92
+ {{#-last}}
93
+ }
94
+ {{/-last}}
95
+ {{/optionalParams}}
96
+
97
+ begin
98
+ {{#summary}} #{{{.}}}
99
+ {{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
100
+ p result{{/returnType}}
101
+ rescue {{{moduleName}}}::ApiError => e
102
+ puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
103
+ end
104
+ {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
105
+ ```
106
+
107
+ ## Documentation for API Endpoints
108
+
109
+ All URIs are relative to *{{basePath}}*
110
+
111
+ Class | Method | HTTP request | Description
112
+ ------------ | ------------- | ------------- | -------------
113
+ {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
114
+ {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
115
+
116
+ ## Documentation for Models
117
+
118
+ {{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
119
+ {{/model}}{{/models}}
120
+
121
+ ## Documentation for Authorization
122
+
123
+ {{^authMethods}} All endpoints do not require authorization.
124
+ {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
125
+ {{#authMethods}}### {{name}}
126
+
127
+ {{#isApiKey}}
128
+
129
+ - **Type**: API key
130
+ - **API key parameter name**: {{keyParamName}}
131
+ - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
132
+ {{/isApiKey}}
133
+ {{#isBasic}}
134
+ {{#isBasicBasic}}- **Type**: HTTP basic authentication
135
+ {{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
136
+ {{/isBasicBearer}}
137
+ {{/isBasic}}
138
+ {{#isOAuth}}
139
+
140
+ - **Type**: OAuth
141
+ - **Flow**: {{flow}}
142
+ - **Authorization URL**: {{authorizationUrl}}
143
+ - **Scopes**: {{^scopes}}N/A{{/scopes}}
144
+ {{#scopes}} - {{scope}}: {{description}}
145
+ {{/scopes}}
146
+ {{/isOAuth}}
147
+
148
+ {{/authMethods}}
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'cgi'
6
+
7
+ module {{moduleName}}
8
+ {{#operations}}
9
+ class {{classname}}
10
+ attr_accessor :api_client
11
+
12
+ def initialize(api_client = ApiClient.default)
13
+ @api_client = api_client
14
+ end
15
+ {{#operation}}
16
+ {{#summary}}
17
+ # {{{.}}}
18
+ {{/summary}}
19
+ {{#notes}}
20
+ # {{{.}}}
21
+ {{/notes}}
22
+ {{#allParams}}{{#required}} # @param {{paramName}} [{{{dataType}}}] {{description}}
23
+ {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
24
+ {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
25
+ {{/required}}{{/allParams}} # @return [{{{returnType}}}{{^returnType}}nil{{/returnType}}]
26
+ def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
27
+ {{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
28
+ {{#returnType}}data{{/returnType}}{{^returnType}}nil{{/returnType}}
29
+ end
30
+
31
+ {{#summary}}
32
+ # {{.}}
33
+ {{/summary}}
34
+ {{#notes}}
35
+ # {{.}}
36
+ {{/notes}}
37
+ {{#allParams}}{{#required}} # @param {{paramName}} [{{{dataType}}}] {{description}}
38
+ {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
39
+ {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
40
+ {{/required}}{{/allParams}} # @return [Array<({{{returnType}}}{{^returnType}}nil{{/returnType}}, Integer, Hash)>] {{#returnType}}{{{.}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers
41
+ def {{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: {{classname}}.{{operationId}} ...'
44
+ end
45
+ {{#allParams}}
46
+ {{^isNullable}}
47
+ {{#required}}
48
+ # verify the required parameter '{{paramName}}' is set
49
+ if @api_client.config.client_side_validation && {{{paramName}}}.nil?
50
+ fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}"
51
+ end
52
+ {{#isEnum}}
53
+ {{^isContainer}}
54
+ # verify enum value
55
+ allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]
56
+ if @api_client.config.client_side_validation && !allowable_values.include?({{{paramName}}})
57
+ fail ArgumentError, "invalid value for \"{{{paramName}}}\", must be one of #{allowable_values}"
58
+ end
59
+ {{/isContainer}}
60
+ {{/isEnum}}
61
+ {{/required}}
62
+ {{/isNullable}}
63
+ {{^required}}
64
+ {{#isEnum}}
65
+ {{#collectionFormat}}
66
+ allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]
67
+ if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all? { |item| allowable_values.include?(item) }
68
+ fail ArgumentError, "invalid value for \"{{{paramName}}}\", must include one of #{allowable_values}"
69
+ end
70
+ {{/collectionFormat}}
71
+ {{^collectionFormat}}
72
+ allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]
73
+ if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !allowable_values.include?(opts[:'{{{paramName}}}'])
74
+ fail ArgumentError, "invalid value for \"{{{paramName}}}\", must be one of #{allowable_values}"
75
+ end
76
+ {{/collectionFormat}}
77
+ {{/isEnum}}
78
+ {{/required}}
79
+ {{#hasValidation}}
80
+ {{#maxLength}}
81
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}}
82
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be smaller than or equal to {{{maxLength}}}.'
83
+ end
84
+
85
+ {{/maxLength}}
86
+ {{#minLength}}
87
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}}
88
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, the character length must be great than or equal to {{{minLength}}}.'
89
+ end
90
+
91
+ {{/minLength}}
92
+ {{#maximum}}
93
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
94
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.'
95
+ end
96
+
97
+ {{/maximum}}
98
+ {{#minimum}}
99
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
100
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.'
101
+ end
102
+
103
+ {{/minimum}}
104
+ {{#pattern}}
105
+ pattern = Regexp.new({{{pattern}}})
106
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} !~ pattern
107
+ fail ArgumentError, "invalid value for '{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:\"{{{paramName}}}\"]{{/required}}' when calling {{classname}}.{{operationId}}, must conform to the pattern #{pattern}."
108
+ end
109
+
110
+ {{/pattern}}
111
+ {{#maxItems}}
112
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length > {{{maxItems}}}
113
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{{maxItems}}}.'
114
+ end
115
+
116
+ {{/maxItems}}
117
+ {{#minItems}}
118
+ if @api_client.config.client_side_validation && {{^required}}!opts[:'{{{paramName}}}'].nil? && {{/required}}{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.length < {{{minItems}}}
119
+ fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{{minItems}}}.'
120
+ end
121
+
122
+ {{/minItems}}
123
+ {{/hasValidation}}
124
+ {{/allParams}}
125
+ # resource path
126
+ local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}}
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+ {{#queryParams}}
131
+ {{#required}}
132
+ query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
133
+ {{/required}}
134
+ {{/queryParams}}
135
+ {{#queryParams}}
136
+ {{^required}}
137
+ query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
138
+ {{/required}}
139
+ {{/queryParams}}
140
+
141
+ # header parameters
142
+ header_params = opts[:header_params] || {}
143
+ {{#hasProduces}}
144
+ # HTTP header 'Accept' (if needed)
145
+ header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}])
146
+ {{/hasProduces}}
147
+ {{#hasConsumes}}
148
+ # HTTP header 'Content-Type'
149
+ content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}])
150
+ if !content_type.nil?
151
+ header_params['Content-Type'] = content_type
152
+ end
153
+ {{/hasConsumes}}
154
+ {{#headerParams}}
155
+ {{#required}}
156
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
157
+ {{/required}}
158
+ {{/headerParams}}
159
+ {{#headerParams}}
160
+ {{^required}}
161
+ header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil?
162
+ {{/required}}
163
+ {{/headerParams}}
164
+
165
+ # form parameters
166
+ form_params = opts[:form_params] || {}
167
+ {{#formParams}}
168
+ {{#required}}
169
+ form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
170
+ {{/required}}
171
+ {{/formParams}}
172
+ {{#formParams}}
173
+ {{^required}}
174
+ form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil?
175
+ {{/required}}
176
+ {{/formParams}}
177
+
178
+ # http body (model)
179
+ post_body = opts[:debug_body]{{#bodyParam}} || @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}){{/bodyParam}}
180
+
181
+ # return_type
182
+ return_type = opts[:debug_return_type]{{#returnType}} || '{{{.}}}'{{/returnType}}
183
+
184
+ # auth_names
185
+ auth_names = opts[:debug_auth_names] || [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}]
186
+
187
+ new_options = opts.merge(
188
+ :operation => :"{{classname}}.{{operationId}}",
189
+ :header_params => header_params,
190
+ :query_params => query_params,
191
+ :form_params => form_params,
192
+ :body => post_body,
193
+ :auth_names => auth_names,
194
+ :return_type => return_type
195
+ )
196
+
197
+ data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path, new_options)
198
+ if @api_client.config.debugging
199
+ @api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
200
+ end
201
+ return data, status_code, headers
202
+ end
203
+ {{^-last}}
204
+
205
+ {{/-last}}
206
+ {{/operation}}
207
+ end
208
+ {{/operations}}
209
+ end