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,234 @@
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 AssetResultSet
17
+ attr_accessor :meta
18
+
19
+ attr_accessor :data
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+
25
+ :'meta' => :'meta',
26
+
27
+ :'data' => :'data'
28
+
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+
36
+ :'meta' => :'Meta',
37
+
38
+ :'data' => :'Array<Asset>'
39
+
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+
52
+ if attributes.has_key?(:'meta')
53
+
54
+
55
+ self.meta = attributes[:'meta']
56
+
57
+
58
+ end
59
+
60
+
61
+ if attributes.has_key?(:'data')
62
+
63
+ if (value = attributes[:'data']).is_a?(Array)
64
+ self.data = value
65
+ end
66
+
67
+
68
+
69
+ end
70
+
71
+
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properies with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+
79
+
80
+ return invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ end
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ meta == o.meta &&
114
+ data == o.data
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [meta, data].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /^Array<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = BlueprintClient.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+ end
@@ -0,0 +1,267 @@
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 Error
17
+ attr_accessor :status
18
+
19
+ attr_accessor :title
20
+
21
+ attr_accessor :detail
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+
27
+ :'status' => :'status',
28
+
29
+ :'title' => :'title',
30
+
31
+ :'detail' => :'detail'
32
+
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+
40
+ :'status' => :'Float',
41
+
42
+ :'title' => :'String',
43
+
44
+ :'detail' => :'String'
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?(:'status')
59
+
60
+
61
+ self.status = attributes[:'status']
62
+
63
+
64
+ end
65
+
66
+
67
+ if attributes.has_key?(:'title')
68
+
69
+
70
+ self.title = attributes[:'title']
71
+
72
+
73
+ end
74
+
75
+
76
+ if attributes.has_key?(:'detail')
77
+
78
+
79
+ self.detail = attributes[:'detail']
80
+
81
+
82
+ end
83
+
84
+
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properies with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+
92
+
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+
100
+
101
+ if @status.nil?
102
+ return false
103
+ end
104
+
105
+
106
+
107
+
108
+
109
+
110
+ if @title.nil?
111
+ return false
112
+ end
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ end
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ status == o.status &&
146
+ title == o.title &&
147
+ detail == o.detail
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Fixnum] Hash code
158
+ def hash
159
+ [status, title, detail].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.swagger_types.each_pair do |key, type|
168
+ if type =~ /^Array<(.*)>/i
169
+ # check to ensure the input is an array given that the the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
172
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
173
+ end
174
+ elsif !attributes[self.class.attribute_map[key]].nil?
175
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
177
+ end
178
+
179
+ self
180
+ end
181
+
182
+ # Deserializes the data based on type
183
+ # @param string type Data type
184
+ # @param string value Value to be deserialized
185
+ # @return [Object] Deserialized data
186
+ def _deserialize(type, value)
187
+ case type.to_sym
188
+ when :DateTime
189
+ DateTime.parse(value)
190
+ when :Date
191
+ Date.parse(value)
192
+ when :String
193
+ value.to_s
194
+ when :Integer
195
+ value.to_i
196
+ when :Float
197
+ value.to_f
198
+ when :BOOLEAN
199
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
200
+ true
201
+ else
202
+ false
203
+ end
204
+ when :Object
205
+ # generic object (usually a Hash), return directly
206
+ value
207
+ when /\AArray<(?<inner_type>.+)>\z/
208
+ inner_type = Regexp.last_match[:inner_type]
209
+ value.map { |v| _deserialize(inner_type, v) }
210
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
211
+ k_type = Regexp.last_match[:k_type]
212
+ v_type = Regexp.last_match[:v_type]
213
+ {}.tap do |hash|
214
+ value.each do |k, v|
215
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
+ end
217
+ end
218
+ else # model
219
+ temp_model = BlueprintClient.const_get(type).new
220
+ temp_model.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ next if value.nil?
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map{ |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+ end