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
data/docs/Links.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# BlueprintClient::Links
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**_self** | **String** | | [optional]
|
7
|
+
**_next** | **String** | | [optional]
|
8
|
+
**previous** | **String** | | [optional]
|
9
|
+
|
10
|
+
|
data/docs/Meta.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# BlueprintClient::Meta
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**offset** | **Float** | start index of this set | [optional]
|
7
|
+
**limit** | **Float** | max limit of records in this set | [optional]
|
8
|
+
**count** | **Float** | total count of all matches | [optional]
|
9
|
+
|
10
|
+
|
data/docs/Namespace.md
ADDED
data/docs/Node.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# BlueprintClient::Node
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **String** | the unique id of the node of a given type. |
|
7
|
+
**type** | **String** | |
|
8
|
+
**attributes** | [**NodeAttributes**](NodeAttributes.md) | | [optional]
|
9
|
+
**relationships** | [**NodeRelationships**](NodeRelationships.md) | | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# BlueprintClient::NodeAttributes
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**title** | **String** | | [optional]
|
7
|
+
**description** | **String** | A more detailed description of the node | [optional]
|
8
|
+
**valid_from** | **Date** | The node is judged invalid before this date. Should be an ISO8601 date | [optional]
|
9
|
+
**valid_to** | **Date** | The node is judged invalid after this date. Should be an ISO8601 date | [optional]
|
10
|
+
**student_numbers** | **Float** | | [optional]
|
11
|
+
**domain_ids** | **Array<String>** | Additional identifiers linked to the external domain of the hierarchy, for example JACS code. Allows comparisons between hierarchies. | [optional]
|
12
|
+
|
13
|
+
|
data/docs/NodeBody.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# BlueprintClient::NodeRelationship
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**meta** | [**Meta**](Meta.md) | | [optional]
|
7
|
+
**links** | [**Links**](Links.md) | | [optional]
|
8
|
+
**data** | [**Array<Node>**](Node.md) | | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# BlueprintClient::NodeRelationships
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**children** | [**NodeRelationship**](NodeRelationship.md) | | [optional]
|
7
|
+
**parents** | [**NodeRelationship**](NodeRelationship.md) | | [optional]
|
8
|
+
**namespace** | [**NamespaceRelationship**](NamespaceRelationship.md) | | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# BlueprintClient::NodeResultSet
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**meta** | [**Meta**](Meta.md) | | [optional]
|
7
|
+
**data** | [**Array<Node>**](Node.md) | | [optional]
|
8
|
+
**included** | [**Array<Node>**](Node.md) | | [optional]
|
9
|
+
|
10
|
+
|
data/generate.sh
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
if [ ! -f swagger-codegen-cli.jar ]; then
|
4
|
+
wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.1.6/swagger-codegen-cli-2.1.6.jar -O swagger-codegen-cli.jar
|
5
|
+
fi
|
6
|
+
java -jar swagger-codegen-cli.jar generate -l ruby -o . -i https://staging-hierarchy.talis.com/api-docs -c config.json -t templates
|
7
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
3
|
+
#
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
5
|
+
|
6
|
+
git_user_id=$1
|
7
|
+
git_repo_id=$2
|
8
|
+
release_note=$3
|
9
|
+
|
10
|
+
if [ "$git_user_id" = "" ]; then
|
11
|
+
git_user_id="talis"
|
12
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
13
|
+
fi
|
14
|
+
|
15
|
+
if [ "$git_repo_id" = "" ]; then
|
16
|
+
git_repo_id="blueprint_rb"
|
17
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
18
|
+
fi
|
19
|
+
|
20
|
+
if [ "$release_note" = "" ]; then
|
21
|
+
release_note="Minor update"
|
22
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
23
|
+
fi
|
24
|
+
|
25
|
+
# Initialize the local directory as a Git repository
|
26
|
+
git init
|
27
|
+
|
28
|
+
# Adds the files in the local repository and stages them for commit.
|
29
|
+
git add .
|
30
|
+
|
31
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
32
|
+
git commit -m "$release_note"
|
33
|
+
|
34
|
+
# Sets the new remote
|
35
|
+
git_remote=`git remote`
|
36
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
37
|
+
|
38
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
39
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
40
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
41
|
+
else
|
42
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
43
|
+
fi
|
44
|
+
|
45
|
+
fi
|
46
|
+
|
47
|
+
git pull origin master
|
48
|
+
|
49
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
50
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
51
|
+
git push origin master 2>&1 | grep -v 'To https'
|
52
|
+
|
@@ -0,0 +1,598 @@
|
|
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 "uri"
|
14
|
+
|
15
|
+
module BlueprintClient
|
16
|
+
class AssetsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# Add an asset to the node. Body must be empty. Will upsert the asset if it doesn't exist
|
25
|
+
# @param namespace identifier namespacing the blueprint.
|
26
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
27
|
+
# @param id id identifying a domain model
|
28
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
29
|
+
# @param asset_id id of an asset
|
30
|
+
# @param [Hash] opts the optional parameters
|
31
|
+
# @return [AssetBody]
|
32
|
+
def add_asset_to_node(namespace, type, id, asset_type, asset_id, opts = {})
|
33
|
+
data, _status_code, _headers = add_asset_to_node_with_http_info(namespace, type, id, asset_type, asset_id, opts)
|
34
|
+
return data
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Add an asset to the node. Body must be empty. Will upsert the asset if it doesn't exist
|
39
|
+
# @param namespace identifier namespacing the blueprint.
|
40
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
41
|
+
# @param id id identifying a domain model
|
42
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
43
|
+
# @param asset_id id of an asset
|
44
|
+
# @param [Hash] opts the optional parameters
|
45
|
+
# @return [Array<(AssetBody, Fixnum, Hash)>] AssetBody data, response status code and response headers
|
46
|
+
def add_asset_to_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {})
|
47
|
+
if @api_client.config.debugging
|
48
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.add_asset_to_node ..."
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# verify the required parameter 'namespace' is set
|
53
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.add_asset_to_node" if namespace.nil?
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
# verify the required parameter 'type' is set
|
61
|
+
fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.add_asset_to_node" if type.nil?
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
# verify the required parameter 'id' is set
|
69
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.add_asset_to_node" if id.nil?
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
# verify the required parameter 'asset_type' is set
|
77
|
+
fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.add_asset_to_node" if asset_type.nil?
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
# verify the required parameter 'asset_id' is set
|
85
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.add_asset_to_node" if asset_id.nil?
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
# resource path
|
92
|
+
local_var_path = "/{namespace}/nodes/{type}/{id}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)
|
93
|
+
|
94
|
+
# query parameters
|
95
|
+
query_params = {}
|
96
|
+
|
97
|
+
# header parameters
|
98
|
+
header_params = {}
|
99
|
+
|
100
|
+
# HTTP header 'Accept' (if needed)
|
101
|
+
local_header_accept = ['application/vnd.api+json']
|
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 = ['application/json']
|
106
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
107
|
+
|
108
|
+
# form parameters
|
109
|
+
form_params = {}
|
110
|
+
|
111
|
+
# http body (model)
|
112
|
+
post_body = nil
|
113
|
+
|
114
|
+
auth_names = ['oauth2']
|
115
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
116
|
+
:header_params => header_params,
|
117
|
+
:query_params => query_params,
|
118
|
+
:form_params => form_params,
|
119
|
+
:body => post_body,
|
120
|
+
:auth_names => auth_names,
|
121
|
+
:return_type => 'AssetBody')
|
122
|
+
if @api_client.config.debugging
|
123
|
+
@api_client.config.logger.debug "API called: AssetsApi#add_asset_to_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
124
|
+
end
|
125
|
+
return data, status_code, headers
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Delete an Asset
|
130
|
+
# @param namespace identifier namespacing the blueprint.
|
131
|
+
# @param asset_id id of an asset
|
132
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
133
|
+
# @param [Hash] opts the optional parameters
|
134
|
+
# @return [nil]
|
135
|
+
def delete_asset(namespace, asset_id, asset_type, opts = {})
|
136
|
+
delete_asset_with_http_info(namespace, asset_id, asset_type, opts)
|
137
|
+
return nil
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# Delete an Asset
|
142
|
+
# @param namespace identifier namespacing the blueprint.
|
143
|
+
# @param asset_id id of an asset
|
144
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
145
|
+
# @param [Hash] opts the optional parameters
|
146
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
147
|
+
def delete_asset_with_http_info(namespace, asset_id, asset_type, opts = {})
|
148
|
+
if @api_client.config.debugging
|
149
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.delete_asset ..."
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
# verify the required parameter 'namespace' is set
|
154
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.delete_asset" if namespace.nil?
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
# verify the required parameter 'asset_id' is set
|
162
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.delete_asset" if asset_id.nil?
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
# verify the required parameter 'asset_type' is set
|
170
|
+
fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.delete_asset" if asset_type.nil?
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
# resource path
|
177
|
+
local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetId' + '}', asset_id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s)
|
178
|
+
|
179
|
+
# query parameters
|
180
|
+
query_params = {}
|
181
|
+
|
182
|
+
# header parameters
|
183
|
+
header_params = {}
|
184
|
+
|
185
|
+
# HTTP header 'Accept' (if needed)
|
186
|
+
local_header_accept = ['application/vnd.api+json']
|
187
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
188
|
+
|
189
|
+
# HTTP header 'Content-Type'
|
190
|
+
local_header_content_type = ['application/json']
|
191
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
192
|
+
|
193
|
+
# form parameters
|
194
|
+
form_params = {}
|
195
|
+
|
196
|
+
# http body (model)
|
197
|
+
post_body = nil
|
198
|
+
|
199
|
+
auth_names = ['oauth2']
|
200
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
201
|
+
:header_params => header_params,
|
202
|
+
:query_params => query_params,
|
203
|
+
:form_params => form_params,
|
204
|
+
:body => post_body,
|
205
|
+
:auth_names => auth_names)
|
206
|
+
if @api_client.config.debugging
|
207
|
+
@api_client.config.logger.debug "API called: AssetsApi#delete_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
208
|
+
end
|
209
|
+
return data, status_code, headers
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# Get details of a given asset
|
214
|
+
# @param namespace identifier namespacing the blueprint.
|
215
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
216
|
+
# @param asset_id id of an asset
|
217
|
+
# @param [Hash] opts the optional parameters
|
218
|
+
# @return [AssetBody]
|
219
|
+
def get_asset(namespace, asset_type, asset_id, opts = {})
|
220
|
+
data, _status_code, _headers = get_asset_with_http_info(namespace, asset_type, asset_id, opts)
|
221
|
+
return data
|
222
|
+
end
|
223
|
+
|
224
|
+
#
|
225
|
+
# Get details of a given asset
|
226
|
+
# @param namespace identifier namespacing the blueprint.
|
227
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
228
|
+
# @param asset_id id of an asset
|
229
|
+
# @param [Hash] opts the optional parameters
|
230
|
+
# @return [Array<(AssetBody, Fixnum, Hash)>] AssetBody data, response status code and response headers
|
231
|
+
def get_asset_with_http_info(namespace, asset_type, asset_id, opts = {})
|
232
|
+
if @api_client.config.debugging
|
233
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.get_asset ..."
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
# verify the required parameter 'namespace' is set
|
238
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.get_asset" if namespace.nil?
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
# verify the required parameter 'asset_type' is set
|
246
|
+
fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.get_asset" if asset_type.nil?
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
# verify the required parameter 'asset_id' is set
|
254
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.get_asset" if asset_id.nil?
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
# resource path
|
261
|
+
local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)
|
262
|
+
|
263
|
+
# query parameters
|
264
|
+
query_params = {}
|
265
|
+
|
266
|
+
# header parameters
|
267
|
+
header_params = {}
|
268
|
+
|
269
|
+
# HTTP header 'Accept' (if needed)
|
270
|
+
local_header_accept = ['application/vnd.api+json']
|
271
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
272
|
+
|
273
|
+
# HTTP header 'Content-Type'
|
274
|
+
local_header_content_type = ['application/json']
|
275
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
276
|
+
|
277
|
+
# form parameters
|
278
|
+
form_params = {}
|
279
|
+
|
280
|
+
# http body (model)
|
281
|
+
post_body = nil
|
282
|
+
|
283
|
+
auth_names = ['oauth2']
|
284
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
285
|
+
:header_params => header_params,
|
286
|
+
:query_params => query_params,
|
287
|
+
:form_params => form_params,
|
288
|
+
:body => post_body,
|
289
|
+
:auth_names => auth_names,
|
290
|
+
:return_type => 'AssetBody')
|
291
|
+
if @api_client.config.debugging
|
292
|
+
@api_client.config.logger.debug "API called: AssetsApi#get_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
293
|
+
end
|
294
|
+
return data, status_code, headers
|
295
|
+
end
|
296
|
+
|
297
|
+
#
|
298
|
+
# Get for assets in the relevant node
|
299
|
+
# @param namespace identifier namespacing the blueprint.
|
300
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
301
|
+
# @param id id identifying a domain model
|
302
|
+
# @param [Hash] opts the optional parameters
|
303
|
+
# @option opts [String] :filter_asset_type type of asset to return
|
304
|
+
# @option opts [Float] :offset index to start result set from
|
305
|
+
# @option opts [Float] :limit number of records to return
|
306
|
+
# @return [AssetResultSet]
|
307
|
+
def get_assets_in_node(namespace, type, id, opts = {})
|
308
|
+
data, _status_code, _headers = get_assets_in_node_with_http_info(namespace, type, id, opts)
|
309
|
+
return data
|
310
|
+
end
|
311
|
+
|
312
|
+
#
|
313
|
+
# Get for assets in the relevant node
|
314
|
+
# @param namespace identifier namespacing the blueprint.
|
315
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
316
|
+
# @param id id identifying a domain model
|
317
|
+
# @param [Hash] opts the optional parameters
|
318
|
+
# @option opts [String] :filter_asset_type type of asset to return
|
319
|
+
# @option opts [Float] :offset index to start result set from
|
320
|
+
# @option opts [Float] :limit number of records to return
|
321
|
+
# @return [Array<(AssetResultSet, Fixnum, Hash)>] AssetResultSet data, response status code and response headers
|
322
|
+
def get_assets_in_node_with_http_info(namespace, type, id, opts = {})
|
323
|
+
if @api_client.config.debugging
|
324
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.get_assets_in_node ..."
|
325
|
+
end
|
326
|
+
|
327
|
+
|
328
|
+
# verify the required parameter 'namespace' is set
|
329
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.get_assets_in_node" if namespace.nil?
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
# verify the required parameter 'type' is set
|
337
|
+
fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.get_assets_in_node" if type.nil?
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
# verify the required parameter 'id' is set
|
345
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.get_assets_in_node" if id.nil?
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
# resource path
|
370
|
+
local_var_path = "/{namespace}/nodes/{type}/{id}/assets".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s)
|
371
|
+
|
372
|
+
# query parameters
|
373
|
+
query_params = {}
|
374
|
+
query_params[:'filter[assetType]'] = opts[:'filter_asset_type'] if opts[:'filter_asset_type']
|
375
|
+
query_params[:'offset'] = opts[:'offset'] if opts[:'offset']
|
376
|
+
query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
|
377
|
+
|
378
|
+
# header parameters
|
379
|
+
header_params = {}
|
380
|
+
|
381
|
+
# HTTP header 'Accept' (if needed)
|
382
|
+
local_header_accept = ['application/vnd.api+json']
|
383
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
384
|
+
|
385
|
+
# HTTP header 'Content-Type'
|
386
|
+
local_header_content_type = ['application/json']
|
387
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
388
|
+
|
389
|
+
# form parameters
|
390
|
+
form_params = {}
|
391
|
+
|
392
|
+
# http body (model)
|
393
|
+
post_body = nil
|
394
|
+
|
395
|
+
auth_names = ['oauth2']
|
396
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
397
|
+
:header_params => header_params,
|
398
|
+
:query_params => query_params,
|
399
|
+
:form_params => form_params,
|
400
|
+
:body => post_body,
|
401
|
+
:auth_names => auth_names,
|
402
|
+
:return_type => 'AssetResultSet')
|
403
|
+
if @api_client.config.debugging
|
404
|
+
@api_client.config.logger.debug "API called: AssetsApi#get_assets_in_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
405
|
+
end
|
406
|
+
return data, status_code, headers
|
407
|
+
end
|
408
|
+
|
409
|
+
#
|
410
|
+
# Remove an asset from the relevant node
|
411
|
+
# @param namespace identifier namespacing the blueprint.
|
412
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
413
|
+
# @param id id identifying a domain model
|
414
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
415
|
+
# @param asset_id id of an asset
|
416
|
+
# @param [Hash] opts the optional parameters
|
417
|
+
# @return [nil]
|
418
|
+
def remove_asset_from_node(namespace, type, id, asset_type, asset_id, opts = {})
|
419
|
+
remove_asset_from_node_with_http_info(namespace, type, id, asset_type, asset_id, opts)
|
420
|
+
return nil
|
421
|
+
end
|
422
|
+
|
423
|
+
#
|
424
|
+
# Remove an asset from the relevant node
|
425
|
+
# @param namespace identifier namespacing the blueprint.
|
426
|
+
# @param type Plural form of node type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
427
|
+
# @param id id identifying a domain model
|
428
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
429
|
+
# @param asset_id id of an asset
|
430
|
+
# @param [Hash] opts the optional parameters
|
431
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
432
|
+
def remove_asset_from_node_with_http_info(namespace, type, id, asset_type, asset_id, opts = {})
|
433
|
+
if @api_client.config.debugging
|
434
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.remove_asset_from_node ..."
|
435
|
+
end
|
436
|
+
|
437
|
+
|
438
|
+
# verify the required parameter 'namespace' is set
|
439
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.remove_asset_from_node" if namespace.nil?
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
# verify the required parameter 'type' is set
|
447
|
+
fail ArgumentError, "Missing the required parameter 'type' when calling AssetsApi.remove_asset_from_node" if type.nil?
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
# verify the required parameter 'id' is set
|
455
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling AssetsApi.remove_asset_from_node" if id.nil?
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
# verify the required parameter 'asset_type' is set
|
463
|
+
fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.remove_asset_from_node" if asset_type.nil?
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
# verify the required parameter 'asset_id' is set
|
471
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.remove_asset_from_node" if asset_id.nil?
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
# resource path
|
478
|
+
local_var_path = "/{namespace}/nodes/{type}/{id}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s).sub('{' + 'assetId' + '}', asset_id.to_s)
|
479
|
+
|
480
|
+
# query parameters
|
481
|
+
query_params = {}
|
482
|
+
|
483
|
+
# header parameters
|
484
|
+
header_params = {}
|
485
|
+
|
486
|
+
# HTTP header 'Accept' (if needed)
|
487
|
+
local_header_accept = ['application/vnd.api+json']
|
488
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
489
|
+
|
490
|
+
# HTTP header 'Content-Type'
|
491
|
+
local_header_content_type = ['application/json']
|
492
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
493
|
+
|
494
|
+
# form parameters
|
495
|
+
form_params = {}
|
496
|
+
|
497
|
+
# http body (model)
|
498
|
+
post_body = nil
|
499
|
+
|
500
|
+
auth_names = ['oauth2']
|
501
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
502
|
+
:header_params => header_params,
|
503
|
+
:query_params => query_params,
|
504
|
+
:form_params => form_params,
|
505
|
+
:body => post_body,
|
506
|
+
:auth_names => auth_names)
|
507
|
+
if @api_client.config.debugging
|
508
|
+
@api_client.config.logger.debug "API called: AssetsApi#remove_asset_from_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
509
|
+
end
|
510
|
+
return data, status_code, headers
|
511
|
+
end
|
512
|
+
|
513
|
+
# Replaces the Asset with the data sent in the body
|
514
|
+
# Wholesale replacement of Asset data: if you were to PUT to:\n /1/{namespace}/assets/sometype/someid\n\nwith a body of:\n { type: \"someothertype\", id: \"someotherid\" }\n\nIt would change the Asset's path to:\n /1/{namespace}/assets/someothertype/someotherid\n\nand\n /1/{namespace}/assets/sometype/someid\nwould return a 404.\nIt would also update the assets associated with any node.\n
|
515
|
+
# @param namespace identifier namespacing the blueprint.
|
516
|
+
# @param asset_id id of an asset
|
517
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
518
|
+
# @param [Hash] opts the optional parameters
|
519
|
+
# @return [AssetBody]
|
520
|
+
def replace_asset(namespace, asset_id, asset_type, opts = {})
|
521
|
+
data, _status_code, _headers = replace_asset_with_http_info(namespace, asset_id, asset_type, opts)
|
522
|
+
return data
|
523
|
+
end
|
524
|
+
|
525
|
+
# Replaces the Asset with the data sent in the body
|
526
|
+
# Wholesale replacement of Asset data: if you were to PUT to:\n /1/{namespace}/assets/sometype/someid\n\nwith a body of:\n { type: \"someothertype\", id: \"someotherid\" }\n\nIt would change the Asset's path to:\n /1/{namespace}/assets/someothertype/someotherid\n\nand\n /1/{namespace}/assets/sometype/someid\nwould return a 404.\nIt would also update the assets associated with any node.\n
|
527
|
+
# @param namespace identifier namespacing the blueprint.
|
528
|
+
# @param asset_id id of an asset
|
529
|
+
# @param asset_type Plural form of asset type (adds an 's' to the end of the type) todo - allow configuration of plurals
|
530
|
+
# @param [Hash] opts the optional parameters
|
531
|
+
# @return [Array<(AssetBody, Fixnum, Hash)>] AssetBody data, response status code and response headers
|
532
|
+
def replace_asset_with_http_info(namespace, asset_id, asset_type, opts = {})
|
533
|
+
if @api_client.config.debugging
|
534
|
+
@api_client.config.logger.debug "Calling API: AssetsApi.replace_asset ..."
|
535
|
+
end
|
536
|
+
|
537
|
+
|
538
|
+
# verify the required parameter 'namespace' is set
|
539
|
+
fail ArgumentError, "Missing the required parameter 'namespace' when calling AssetsApi.replace_asset" if namespace.nil?
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
# verify the required parameter 'asset_id' is set
|
547
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling AssetsApi.replace_asset" if asset_id.nil?
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
# verify the required parameter 'asset_type' is set
|
555
|
+
fail ArgumentError, "Missing the required parameter 'asset_type' when calling AssetsApi.replace_asset" if asset_type.nil?
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
# resource path
|
562
|
+
local_var_path = "/{namespace}/assets/{assetType}/{assetId}".sub('{format}','json').sub('{' + 'namespace' + '}', namespace.to_s).sub('{' + 'assetId' + '}', asset_id.to_s).sub('{' + 'assetType' + '}', asset_type.to_s)
|
563
|
+
|
564
|
+
# query parameters
|
565
|
+
query_params = {}
|
566
|
+
|
567
|
+
# header parameters
|
568
|
+
header_params = {}
|
569
|
+
|
570
|
+
# HTTP header 'Accept' (if needed)
|
571
|
+
local_header_accept = ['application/vnd.api+json']
|
572
|
+
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
573
|
+
|
574
|
+
# HTTP header 'Content-Type'
|
575
|
+
local_header_content_type = ['application/json']
|
576
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
577
|
+
|
578
|
+
# form parameters
|
579
|
+
form_params = {}
|
580
|
+
|
581
|
+
# http body (model)
|
582
|
+
post_body = nil
|
583
|
+
|
584
|
+
auth_names = ['oauth2']
|
585
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
586
|
+
:header_params => header_params,
|
587
|
+
:query_params => query_params,
|
588
|
+
:form_params => form_params,
|
589
|
+
:body => post_body,
|
590
|
+
:auth_names => auth_names,
|
591
|
+
:return_type => 'AssetBody')
|
592
|
+
if @api_client.config.debugging
|
593
|
+
@api_client.config.logger.debug "API called: AssetsApi#replace_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
594
|
+
end
|
595
|
+
return data, status_code, headers
|
596
|
+
end
|
597
|
+
end
|
598
|
+
end
|