blueprint_ruby_client 0.1.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.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +65 -0
- data/README.md +152 -0
- data/blueprint_ruby_client.gemspec +31 -0
- data/config.json +13 -0
- data/docs/Asset.md +9 -0
- data/docs/AssetBody.md +9 -0
- data/docs/AssetResultSet.md +9 -0
- data/docs/AssetsApi.md +376 -0
- data/docs/Error.md +10 -0
- data/docs/Errors.md +8 -0
- data/docs/HierarchyApi.md +745 -0
- data/docs/Links.md +10 -0
- data/docs/Meta.md +10 -0
- data/docs/Namespace.md +9 -0
- data/docs/NamespaceRelationship.md +8 -0
- data/docs/Node.md +11 -0
- data/docs/NodeAttributes.md +13 -0
- data/docs/NodeBody.md +9 -0
- data/docs/NodeRelationship.md +10 -0
- data/docs/NodeRelationships.md +10 -0
- data/docs/NodeResultSet.md +10 -0
- data/generate.sh +7 -0
- data/git_push.sh +52 -0
- data/lib/blueprint_ruby_client/api/assets_api.rb +598 -0
- data/lib/blueprint_ruby_client/api/hierarchy_api.rb +1174 -0
- data/lib/blueprint_ruby_client/api_client.rb +365 -0
- data/lib/blueprint_ruby_client/api_error.rb +36 -0
- data/lib/blueprint_ruby_client/configuration.rb +170 -0
- data/lib/blueprint_ruby_client/models/asset.rb +242 -0
- data/lib/blueprint_ruby_client/models/asset_body.rb +237 -0
- data/lib/blueprint_ruby_client/models/asset_result_set.rb +234 -0
- data/lib/blueprint_ruby_client/models/error.rb +267 -0
- data/lib/blueprint_ruby_client/models/errors.rb +209 -0
- data/lib/blueprint_ruby_client/models/links.rb +257 -0
- data/lib/blueprint_ruby_client/models/meta.rb +260 -0
- data/lib/blueprint_ruby_client/models/namespace.rb +242 -0
- data/lib/blueprint_ruby_client/models/namespace_relationship.rb +207 -0
- data/lib/blueprint_ruby_client/models/node.rb +293 -0
- data/lib/blueprint_ruby_client/models/node_attributes.rb +338 -0
- data/lib/blueprint_ruby_client/models/node_body.rb +237 -0
- data/lib/blueprint_ruby_client/models/node_relationship.rb +259 -0
- data/lib/blueprint_ruby_client/models/node_relationships.rb +257 -0
- data/lib/blueprint_ruby_client/models/node_result_set.rb +261 -0
- data/lib/blueprint_ruby_client/version.rb +15 -0
- data/lib/blueprint_ruby_client.rb +56 -0
- data/spec/api/assets_api_spec.rb +150 -0
- data/spec/api/hierarchy_api_spec.rb +266 -0
- data/spec/models/asset_body_spec.rb +56 -0
- data/spec/models/asset_result_set_spec.rb +56 -0
- data/spec/models/asset_spec.rb +56 -0
- data/spec/models/error_spec.rb +66 -0
- data/spec/models/errors_spec.rb +46 -0
- data/spec/models/links_spec.rb +66 -0
- data/spec/models/meta_spec.rb +66 -0
- data/spec/models/namespace_relationship_spec.rb +46 -0
- data/spec/models/namespace_spec.rb +56 -0
- data/spec/models/node_attributes_spec.rb +96 -0
- data/spec/models/node_body_spec.rb +56 -0
- data/spec/models/node_relationship_spec.rb +66 -0
- data/spec/models/node_relationships_spec.rb +66 -0
- data/spec/models/node_result_set_spec.rb +66 -0
- data/spec/models/node_spec.rb +76 -0
- data/swagger-codegen-cli.jar +0 -0
- data/templates/Gemfile.mustache +4 -0
- data/templates/README.mustache +139 -0
- data/templates/api.mustache +135 -0
- data/templates/api_client.mustache +357 -0
- data/templates/api_doc.mustache +79 -0
- data/templates/api_error.mustache +28 -0
- data/templates/api_info.mustache +18 -0
- data/templates/api_test.mustache +47 -0
- data/templates/base_object.mustache +103 -0
- data/templates/configuration.mustache +192 -0
- data/templates/gem.mustache +40 -0
- data/templates/gemspec.mustache +31 -0
- data/templates/gitignore.mustache +40 -0
- data/templates/model.mustache +242 -0
- data/templates/model_doc.mustache +9 -0
- data/templates/model_test.mustache +40 -0
- data/templates/version.mustache +7 -0
- metadata +322 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
=begin
|
2
|
+
Talis Blueprint API
|
3
|
+
|
4
|
+
This is the API documentation for [Blueprint](https://github.com/talis/blueprint-server), a primitive for institutional structure and time periods
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for BlueprintClient::NodeRelationships
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'NodeRelationships' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = BlueprintClient::NodeRelationships.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of NodeRelationships' do
|
31
|
+
it 'should create an instact of NodeRelationships' do
|
32
|
+
@instance.should be_a(BlueprintClient::NodeRelationships)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "children"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here
|
38
|
+
# should be_a()
|
39
|
+
# should be_nil
|
40
|
+
# should ==
|
41
|
+
# should_not ==
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'test attribute "parents"' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here
|
48
|
+
# should be_a()
|
49
|
+
# should be_nil
|
50
|
+
# should ==
|
51
|
+
# should_not ==
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'test attribute "namespace"' do
|
56
|
+
it 'should work' do
|
57
|
+
# assertion here
|
58
|
+
# should be_a()
|
59
|
+
# should be_nil
|
60
|
+
# should ==
|
61
|
+
# should_not ==
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
=begin
|
2
|
+
Talis Blueprint API
|
3
|
+
|
4
|
+
This is the API documentation for [Blueprint](https://github.com/talis/blueprint-server), a primitive for institutional structure and time periods
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for BlueprintClient::NodeResultSet
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'NodeResultSet' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = BlueprintClient::NodeResultSet.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of NodeResultSet' do
|
31
|
+
it 'should create an instact of NodeResultSet' do
|
32
|
+
@instance.should be_a(BlueprintClient::NodeResultSet)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "meta"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here
|
38
|
+
# should be_a()
|
39
|
+
# should be_nil
|
40
|
+
# should ==
|
41
|
+
# should_not ==
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'test attribute "data"' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here
|
48
|
+
# should be_a()
|
49
|
+
# should be_nil
|
50
|
+
# should ==
|
51
|
+
# should_not ==
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'test attribute "included"' do
|
56
|
+
it 'should work' do
|
57
|
+
# assertion here
|
58
|
+
# should be_a()
|
59
|
+
# should be_nil
|
60
|
+
# should ==
|
61
|
+
# should_not ==
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
=begin
|
2
|
+
Talis Blueprint API
|
3
|
+
|
4
|
+
This is the API documentation for [Blueprint](https://github.com/talis/blueprint-server), a primitive for institutional structure and time periods
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for BlueprintClient::Node
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'Node' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = BlueprintClient::Node.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of Node' do
|
31
|
+
it 'should create an instact of Node' do
|
32
|
+
@instance.should be_a(BlueprintClient::Node)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "id"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here
|
38
|
+
# should be_a()
|
39
|
+
# should be_nil
|
40
|
+
# should ==
|
41
|
+
# should_not ==
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'test attribute "type"' do
|
46
|
+
it 'should work' do
|
47
|
+
# assertion here
|
48
|
+
# should be_a()
|
49
|
+
# should be_nil
|
50
|
+
# should ==
|
51
|
+
# should_not ==
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'test attribute "attributes"' do
|
56
|
+
it 'should work' do
|
57
|
+
# assertion here
|
58
|
+
# should be_a()
|
59
|
+
# should be_nil
|
60
|
+
# should ==
|
61
|
+
# should_not ==
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'test attribute "relationships"' do
|
66
|
+
it 'should work' do
|
67
|
+
# assertion here
|
68
|
+
# should be_a()
|
69
|
+
# should be_nil
|
70
|
+
# should ==
|
71
|
+
# should_not ==
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
Binary file
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# {{gemName}}
|
2
|
+
|
3
|
+
{{moduleName}} - the Ruby gem for the {{appName}}
|
4
|
+
|
5
|
+
{{#appDescription}}
|
6
|
+
{{{appDescription}}}
|
7
|
+
{{/appDescription}}
|
8
|
+
|
9
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
10
|
+
|
11
|
+
- API version: {{appVersion}}
|
12
|
+
- Package version: {{gemVersion}}
|
13
|
+
- Build date: {{generatedDate}}
|
14
|
+
- Build package: {{generatorClass}}
|
15
|
+
{{#infoUrl}}
|
16
|
+
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
17
|
+
{{/infoUrl}}
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
### Generating the code
|
22
|
+
|
23
|
+
To update the gem code to the latest API specification:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
sh generate.sh
|
27
|
+
```
|
28
|
+
|
29
|
+
Customise the code generation by modifying the template files.
|
30
|
+
|
31
|
+
### Build a gem
|
32
|
+
|
33
|
+
To build the Ruby code into a gem:
|
34
|
+
|
35
|
+
```shell
|
36
|
+
gem build {{{gemName}}}.gemspec
|
37
|
+
```
|
38
|
+
|
39
|
+
Then either install the gem locally:
|
40
|
+
|
41
|
+
```shell
|
42
|
+
gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
|
43
|
+
```
|
44
|
+
(for development, run `gem install --dev ./{{{gemName}}}-{{{gemVersion}}}.gem` to install the development dependencies)
|
45
|
+
|
46
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
47
|
+
|
48
|
+
Finally add this to the Gemfile:
|
49
|
+
|
50
|
+
gem '{{{gemName}}}', '~> {{{gemVersion}}}'
|
51
|
+
|
52
|
+
### Install from Git
|
53
|
+
|
54
|
+
If the Ruby gem is hosted at a git repository: https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
|
55
|
+
|
56
|
+
gem '{{{gemName}}}', :git => 'https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
|
57
|
+
|
58
|
+
### Include the Ruby code directly
|
59
|
+
|
60
|
+
Include the Ruby code directly using `-I` as follows:
|
61
|
+
|
62
|
+
```shell
|
63
|
+
ruby -Ilib script.rb
|
64
|
+
```
|
65
|
+
|
66
|
+
## Getting Started
|
67
|
+
|
68
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
69
|
+
```ruby
|
70
|
+
# Load the gem
|
71
|
+
require '{{{gemName}}}'
|
72
|
+
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
|
73
|
+
# Setup authorization
|
74
|
+
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}
|
75
|
+
# Configure HTTP basic authorization: {{{name}}}
|
76
|
+
config.username = 'YOUR USERNAME'
|
77
|
+
config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
78
|
+
# Configure API key authorization: {{{name}}}
|
79
|
+
config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY'
|
80
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil)
|
81
|
+
#config.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
|
82
|
+
# Configure OAuth2 access token for authorization: {{{name}}}
|
83
|
+
config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
|
84
|
+
{{/authMethods}}end
|
85
|
+
{{/hasAuthMethods}}
|
86
|
+
|
87
|
+
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
88
|
+
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
89
|
+
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
90
|
+
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
91
|
+
opts = { {{#allParams}}{{^required}}
|
92
|
+
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
93
|
+
}{{/hasOptionalParams}}{{/hasParams}}
|
94
|
+
|
95
|
+
begin
|
96
|
+
{{#summary}} #{{{.}}}
|
97
|
+
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
|
98
|
+
p result{{/returnType}}
|
99
|
+
rescue {{{moduleName}}}::ApiError => e
|
100
|
+
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
|
101
|
+
end
|
102
|
+
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
103
|
+
```
|
104
|
+
|
105
|
+
## Documentation for API Endpoints
|
106
|
+
|
107
|
+
All URIs are relative to *{{basePath}}*
|
108
|
+
|
109
|
+
Class | Method | HTTP request | Description
|
110
|
+
------------ | ------------- | ------------- | -------------
|
111
|
+
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
112
|
+
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
113
|
+
|
114
|
+
## Documentation for Models
|
115
|
+
|
116
|
+
{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
|
117
|
+
{{/model}}{{/models}}
|
118
|
+
|
119
|
+
## Documentation for Authorization
|
120
|
+
|
121
|
+
{{^authMethods}} All endpoints do not require authorization.
|
122
|
+
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
123
|
+
{{#authMethods}}### {{name}}
|
124
|
+
|
125
|
+
{{#isApiKey}}- **Type**: API key
|
126
|
+
- **API key parameter name**: {{keyParamName}}
|
127
|
+
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
128
|
+
{{/isApiKey}}
|
129
|
+
{{#isBasic}}- **Type**: HTTP basic authentication
|
130
|
+
{{/isBasic}}
|
131
|
+
{{#isOAuth}}- **Type**: OAuth
|
132
|
+
- **Flow**: {{flow}}
|
133
|
+
- **Authorization URL**: {{authorizationUrl}}
|
134
|
+
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
135
|
+
{{#scopes}} - {{scope}}: {{description}}
|
136
|
+
{{/scopes}}
|
137
|
+
{{/isOAuth}}
|
138
|
+
|
139
|
+
{{/authMethods}}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
=begin
|
2
|
+
{{> api_info}}
|
3
|
+
=end
|
4
|
+
|
5
|
+
require "uri"
|
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
|
+
{{newline}}
|
17
|
+
# {{{summary}}}
|
18
|
+
# {{{notes}}}
|
19
|
+
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
20
|
+
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
21
|
+
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
22
|
+
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
23
|
+
def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
24
|
+
{{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
|
25
|
+
{{#returnType}}return data{{/returnType}}{{^returnType}}return nil{{/returnType}}
|
26
|
+
end
|
27
|
+
|
28
|
+
# {{summary}}
|
29
|
+
# {{notes}}
|
30
|
+
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
31
|
+
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
32
|
+
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
33
|
+
{{/required}}{{/allParams}} # @return [Array<({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Fixnum, Hash)>] {{#returnType}}{{{returnType}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers
|
34
|
+
def {{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
35
|
+
if @api_client.config.debugging
|
36
|
+
@api_client.config.logger.debug "Calling API: {{classname}}.{{operationId}} ..."
|
37
|
+
end
|
38
|
+
{{#allParams}}
|
39
|
+
{{#required}}
|
40
|
+
# verify the required parameter '{{paramName}}' is set
|
41
|
+
fail ArgumentError, "Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}" if {{{paramName}}}.nil?
|
42
|
+
{{#isEnum}}
|
43
|
+
# verify enum value
|
44
|
+
unless [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?({{{paramName}}})
|
45
|
+
fail ArgumentError, "invalid value for '{{{paramName}}}', must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"
|
46
|
+
end
|
47
|
+
{{/isEnum}}
|
48
|
+
{{/required}}
|
49
|
+
{{^required}}
|
50
|
+
{{#isEnum}}
|
51
|
+
if opts[:'{{{paramName}}}'] && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(opts[:'{{{paramName}}}'])
|
52
|
+
fail ArgumentError, 'invalid value for "{{{paramName}}}", must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}'
|
53
|
+
end
|
54
|
+
{{/isEnum}}
|
55
|
+
{{/required}}
|
56
|
+
{{#hasValidation}}
|
57
|
+
{{#minLength}}
|
58
|
+
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length > {{{maxLength}}}
|
59
|
+
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}}}.'
|
60
|
+
end
|
61
|
+
|
62
|
+
{{/minLength}}
|
63
|
+
{{#maxLength}}
|
64
|
+
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}.to_s.length < {{{minLength}}}
|
65
|
+
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}}}.'
|
66
|
+
end
|
67
|
+
|
68
|
+
{{/maxLength}}
|
69
|
+
{{#maximum}}
|
70
|
+
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} > {{{maximum}}}
|
71
|
+
fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{{maximum}}}.'
|
72
|
+
end
|
73
|
+
|
74
|
+
{{/maximum}}
|
75
|
+
{{#minimum}}
|
76
|
+
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} < {{{minimum}}}
|
77
|
+
fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must be greater than or equal to {{{minimum}}}.'
|
78
|
+
end
|
79
|
+
|
80
|
+
{{/minimum}}
|
81
|
+
{{#pattern}}
|
82
|
+
if {{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}} !~ Regexp.new({{{pattern}}})
|
83
|
+
fail ArgumentError, 'invalid value for "{{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:"{{{paramName}}}"]{{/required}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.'
|
84
|
+
end
|
85
|
+
|
86
|
+
{{/pattern}}
|
87
|
+
{{/hasValidation}}
|
88
|
+
{{/allParams}}
|
89
|
+
# resource path
|
90
|
+
local_var_path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
|
91
|
+
|
92
|
+
# query parameters
|
93
|
+
query_params = {}{{#queryParams}}{{#required}}
|
94
|
+
query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}{{/required}}{{/queryParams}}{{#queryParams}}{{^required}}
|
95
|
+
query_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if opts[:'{{{paramName}}}']{{/required}}{{/queryParams}}
|
96
|
+
|
97
|
+
# header parameters
|
98
|
+
header_params = {}
|
99
|
+
|
100
|
+
# HTTP header 'Accept' (if needed)
|
101
|
+
local_header_accept = [{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]
|
102
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
103
|
+
|
104
|
+
# HTTP header 'Content-Type'
|
105
|
+
local_header_content_type = [{{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]
|
106
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type){{#headerParams}}{{#required}}
|
107
|
+
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}{{/required}}{{/headerParams}}{{#headerParams}}{{^required}}
|
108
|
+
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if opts[:'{{{paramName}}}']{{/required}}{{/headerParams}}
|
109
|
+
|
110
|
+
# form parameters
|
111
|
+
form_params = {}{{#formParams}}{{#required}}
|
112
|
+
form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}{{/required}}{{/formParams}}{{#formParams}}{{^required}}
|
113
|
+
form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if opts[:'{{paramName}}']{{/required}}{{/formParams}}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
{{^bodyParam}}post_body = nil
|
117
|
+
{{/bodyParam}}{{#bodyParam}}post_body = @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}})
|
118
|
+
{{/bodyParam}}
|
119
|
+
auth_names = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
|
120
|
+
data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path,
|
121
|
+
:header_params => header_params,
|
122
|
+
:query_params => query_params,
|
123
|
+
:form_params => form_params,
|
124
|
+
:body => post_body,
|
125
|
+
:auth_names => auth_names{{#returnType}},
|
126
|
+
:return_type => '{{{returnType}}}'{{/returnType}})
|
127
|
+
if @api_client.config.debugging
|
128
|
+
@api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
129
|
+
end
|
130
|
+
return data, status_code, headers
|
131
|
+
end
|
132
|
+
{{/operation}}
|
133
|
+
end
|
134
|
+
{{/operations}}
|
135
|
+
end
|