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.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +65 -0
  4. data/README.md +152 -0
  5. data/blueprint_ruby_client.gemspec +31 -0
  6. data/config.json +13 -0
  7. data/docs/Asset.md +9 -0
  8. data/docs/AssetBody.md +9 -0
  9. data/docs/AssetResultSet.md +9 -0
  10. data/docs/AssetsApi.md +376 -0
  11. data/docs/Error.md +10 -0
  12. data/docs/Errors.md +8 -0
  13. data/docs/HierarchyApi.md +745 -0
  14. data/docs/Links.md +10 -0
  15. data/docs/Meta.md +10 -0
  16. data/docs/Namespace.md +9 -0
  17. data/docs/NamespaceRelationship.md +8 -0
  18. data/docs/Node.md +11 -0
  19. data/docs/NodeAttributes.md +13 -0
  20. data/docs/NodeBody.md +9 -0
  21. data/docs/NodeRelationship.md +10 -0
  22. data/docs/NodeRelationships.md +10 -0
  23. data/docs/NodeResultSet.md +10 -0
  24. data/generate.sh +7 -0
  25. data/git_push.sh +52 -0
  26. data/lib/blueprint_ruby_client/api/assets_api.rb +598 -0
  27. data/lib/blueprint_ruby_client/api/hierarchy_api.rb +1174 -0
  28. data/lib/blueprint_ruby_client/api_client.rb +365 -0
  29. data/lib/blueprint_ruby_client/api_error.rb +36 -0
  30. data/lib/blueprint_ruby_client/configuration.rb +170 -0
  31. data/lib/blueprint_ruby_client/models/asset.rb +242 -0
  32. data/lib/blueprint_ruby_client/models/asset_body.rb +237 -0
  33. data/lib/blueprint_ruby_client/models/asset_result_set.rb +234 -0
  34. data/lib/blueprint_ruby_client/models/error.rb +267 -0
  35. data/lib/blueprint_ruby_client/models/errors.rb +209 -0
  36. data/lib/blueprint_ruby_client/models/links.rb +257 -0
  37. data/lib/blueprint_ruby_client/models/meta.rb +260 -0
  38. data/lib/blueprint_ruby_client/models/namespace.rb +242 -0
  39. data/lib/blueprint_ruby_client/models/namespace_relationship.rb +207 -0
  40. data/lib/blueprint_ruby_client/models/node.rb +293 -0
  41. data/lib/blueprint_ruby_client/models/node_attributes.rb +338 -0
  42. data/lib/blueprint_ruby_client/models/node_body.rb +237 -0
  43. data/lib/blueprint_ruby_client/models/node_relationship.rb +259 -0
  44. data/lib/blueprint_ruby_client/models/node_relationships.rb +257 -0
  45. data/lib/blueprint_ruby_client/models/node_result_set.rb +261 -0
  46. data/lib/blueprint_ruby_client/version.rb +15 -0
  47. data/lib/blueprint_ruby_client.rb +56 -0
  48. data/spec/api/assets_api_spec.rb +150 -0
  49. data/spec/api/hierarchy_api_spec.rb +266 -0
  50. data/spec/models/asset_body_spec.rb +56 -0
  51. data/spec/models/asset_result_set_spec.rb +56 -0
  52. data/spec/models/asset_spec.rb +56 -0
  53. data/spec/models/error_spec.rb +66 -0
  54. data/spec/models/errors_spec.rb +46 -0
  55. data/spec/models/links_spec.rb +66 -0
  56. data/spec/models/meta_spec.rb +66 -0
  57. data/spec/models/namespace_relationship_spec.rb +46 -0
  58. data/spec/models/namespace_spec.rb +56 -0
  59. data/spec/models/node_attributes_spec.rb +96 -0
  60. data/spec/models/node_body_spec.rb +56 -0
  61. data/spec/models/node_relationship_spec.rb +66 -0
  62. data/spec/models/node_relationships_spec.rb +66 -0
  63. data/spec/models/node_result_set_spec.rb +66 -0
  64. data/spec/models/node_spec.rb +76 -0
  65. data/swagger-codegen-cli.jar +0 -0
  66. data/templates/Gemfile.mustache +4 -0
  67. data/templates/README.mustache +139 -0
  68. data/templates/api.mustache +135 -0
  69. data/templates/api_client.mustache +357 -0
  70. data/templates/api_doc.mustache +79 -0
  71. data/templates/api_error.mustache +28 -0
  72. data/templates/api_info.mustache +18 -0
  73. data/templates/api_test.mustache +47 -0
  74. data/templates/base_object.mustache +103 -0
  75. data/templates/configuration.mustache +192 -0
  76. data/templates/gem.mustache +40 -0
  77. data/templates/gemspec.mustache +31 -0
  78. data/templates/gitignore.mustache +40 -0
  79. data/templates/model.mustache +242 -0
  80. data/templates/model_doc.mustache +9 -0
  81. data/templates/model_test.mustache +40 -0
  82. data/templates/version.mustache +7 -0
  83. metadata +322 -0
@@ -0,0 +1,261 @@
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 'date'
14
+
15
+ module BlueprintClient
16
+ class NodeResultSet
17
+ attr_accessor :meta
18
+
19
+ attr_accessor :data
20
+
21
+ attr_accessor :included
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+
27
+ :'meta' => :'meta',
28
+
29
+ :'data' => :'data',
30
+
31
+ :'included' => :'included'
32
+
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+
40
+ :'meta' => :'Meta',
41
+
42
+ :'data' => :'Array<Node>',
43
+
44
+ :'included' => :'Array<Node>'
45
+
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
+
57
+
58
+ if attributes.has_key?(:'meta')
59
+
60
+
61
+ self.meta = attributes[:'meta']
62
+
63
+
64
+ end
65
+
66
+
67
+ if attributes.has_key?(:'data')
68
+
69
+ if (value = attributes[:'data']).is_a?(Array)
70
+ self.data = value
71
+ end
72
+
73
+
74
+
75
+ end
76
+
77
+
78
+ if attributes.has_key?(:'included')
79
+
80
+ if (value = attributes[:'included']).is_a?(Array)
81
+ self.included = value
82
+ end
83
+
84
+
85
+
86
+ end
87
+
88
+
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properies with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+
96
+
97
+ return invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ end
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ meta == o.meta &&
140
+ data == o.data &&
141
+ included == o.included
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Fixnum] Hash code
152
+ def hash
153
+ [meta, data, included].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ self.class.swagger_types.each_pair do |key, type|
162
+ if type =~ /^Array<(.*)>/i
163
+ # check to ensure the input is an array given that the the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
166
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
167
+ end
168
+ elsif !attributes[self.class.attribute_map[key]].nil?
169
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
170
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
171
+ end
172
+
173
+ self
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def _deserialize(type, value)
181
+ case type.to_sym
182
+ when :DateTime
183
+ DateTime.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :BOOLEAN
193
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ temp_model = BlueprintClient.const_get(type).new
214
+ temp_model.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ next if value.nil?
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map{ |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+
260
+ end
261
+ end
@@ -0,0 +1,15 @@
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
+ module BlueprintClient
14
+ VERSION = "0.1.0"
15
+ end
@@ -0,0 +1,56 @@
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
+ # Common files
14
+ require 'blueprint_ruby_client/api_client'
15
+ require 'blueprint_ruby_client/api_error'
16
+ require 'blueprint_ruby_client/version'
17
+ require 'blueprint_ruby_client/configuration'
18
+
19
+ # Models
20
+ require 'blueprint_ruby_client/models/asset'
21
+ require 'blueprint_ruby_client/models/asset_body'
22
+ require 'blueprint_ruby_client/models/asset_result_set'
23
+ require 'blueprint_ruby_client/models/error'
24
+ require 'blueprint_ruby_client/models/errors'
25
+ require 'blueprint_ruby_client/models/links'
26
+ require 'blueprint_ruby_client/models/meta'
27
+ require 'blueprint_ruby_client/models/namespace'
28
+ require 'blueprint_ruby_client/models/namespace_relationship'
29
+ require 'blueprint_ruby_client/models/node'
30
+ require 'blueprint_ruby_client/models/node_attributes'
31
+ require 'blueprint_ruby_client/models/node_body'
32
+ require 'blueprint_ruby_client/models/node_relationship'
33
+ require 'blueprint_ruby_client/models/node_relationships'
34
+ require 'blueprint_ruby_client/models/node_result_set'
35
+
36
+ # APIs
37
+ require 'blueprint_ruby_client/api/assets_api'
38
+ require 'blueprint_ruby_client/api/hierarchy_api'
39
+
40
+ module BlueprintClient
41
+ class << self
42
+ # Customize default settings for the SDK using block.
43
+ # BlueprintClient.configure do |config|
44
+ # config.username = "xxx"
45
+ # config.password = "xxx"
46
+ # end
47
+ # If no block given, return the default Configuration object.
48
+ def configure
49
+ if block_given?
50
+ yield(Configuration.default)
51
+ else
52
+ Configuration.default
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,150 @@
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
+
16
+ # Unit tests for BlueprintClient::AssetsApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'AssetsApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = BlueprintClient::AssetsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of AssetsApi' do
30
+ it 'should create an instact of AssetsApi' do
31
+ @instance.should be_a(BlueprintClient::AssetsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for add_asset_to_node
36
+ #
37
+ # Add an asset to the node. Body must be empty. Will upsert the asset if it doesn&#39;t exist
38
+ # @param namespace identifier namespacing the blueprint.
39
+ # @param type Plural form of node type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
40
+ # @param id id identifying a domain model
41
+ # @param asset_type Plural form of asset type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
42
+ # @param asset_id id of an asset
43
+ # @param [Hash] opts the optional parameters
44
+ # @return [AssetBody]
45
+ describe 'add_asset_to_node test' 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
+ # unit tests for delete_asset
56
+ #
57
+ # Delete an Asset
58
+ # @param namespace identifier namespacing the blueprint.
59
+ # @param asset_id id of an asset
60
+ # @param asset_type Plural form of asset type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
61
+ # @param [Hash] opts the optional parameters
62
+ # @return [nil]
63
+ describe 'delete_asset test' do
64
+ it "should work" do
65
+ # assertion here
66
+ # should be_a()
67
+ # should be_nil
68
+ # should ==
69
+ # should_not ==
70
+ end
71
+ end
72
+
73
+ # unit tests for get_asset
74
+ #
75
+ # Get details of a given asset
76
+ # @param namespace identifier namespacing the blueprint.
77
+ # @param asset_type Plural form of asset type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
78
+ # @param asset_id id of an asset
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [AssetBody]
81
+ describe 'get_asset test' do
82
+ it "should work" do
83
+ # assertion here
84
+ # should be_a()
85
+ # should be_nil
86
+ # should ==
87
+ # should_not ==
88
+ end
89
+ end
90
+
91
+ # unit tests for get_assets_in_node
92
+ #
93
+ # Get for assets in the relevant node
94
+ # @param namespace identifier namespacing the blueprint.
95
+ # @param type Plural form of node type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
96
+ # @param id id identifying a domain model
97
+ # @param [Hash] opts the optional parameters
98
+ # @option opts [String] :filter_asset_type type of asset to return
99
+ # @option opts [Float] :offset index to start result set from
100
+ # @option opts [Float] :limit number of records to return
101
+ # @return [AssetResultSet]
102
+ describe 'get_assets_in_node test' do
103
+ it "should work" do
104
+ # assertion here
105
+ # should be_a()
106
+ # should be_nil
107
+ # should ==
108
+ # should_not ==
109
+ end
110
+ end
111
+
112
+ # unit tests for remove_asset_from_node
113
+ #
114
+ # Remove an asset from the relevant node
115
+ # @param namespace identifier namespacing the blueprint.
116
+ # @param type Plural form of node type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
117
+ # @param id id identifying a domain model
118
+ # @param asset_type Plural form of asset type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
119
+ # @param asset_id id of an asset
120
+ # @param [Hash] opts the optional parameters
121
+ # @return [nil]
122
+ describe 'remove_asset_from_node test' do
123
+ it "should work" do
124
+ # assertion here
125
+ # should be_a()
126
+ # should be_nil
127
+ # should ==
128
+ # should_not ==
129
+ end
130
+ end
131
+
132
+ # unit tests for replace_asset
133
+ # Replaces the Asset with the data sent in the body
134
+ # Wholesale replacement of Asset data: if you were to PUT to:\n /1/{namespace}/assets/sometype/someid\n\nwith a body of:\n { type: \&quot;someothertype\&quot;, id: \&quot;someotherid\&quot; }\n\nIt would change the Asset&#39;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
135
+ # @param namespace identifier namespacing the blueprint.
136
+ # @param asset_id id of an asset
137
+ # @param asset_type Plural form of asset type (adds an &#39;s&#39; to the end of the type) todo - allow configuration of plurals
138
+ # @param [Hash] opts the optional parameters
139
+ # @return [AssetBody]
140
+ describe 'replace_asset test' do
141
+ it "should work" do
142
+ # assertion here
143
+ # should be_a()
144
+ # should be_nil
145
+ # should ==
146
+ # should_not ==
147
+ end
148
+ end
149
+
150
+ end