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