blueprint_ruby_client 0.4.1 → 0.5.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +65 -0
  3. data/LICENSE +201 -0
  4. data/README.md +25 -11
  5. data/docs/AssetTypeConfigsApi.md +63 -0
  6. data/docs/AssetTypeTemplatesApi.md +179 -0
  7. data/docs/AssetsApi.md +19 -19
  8. data/docs/HierarchyApi.md +35 -35
  9. data/docs/Integration.md +10 -0
  10. data/docs/IntegrationBody.md +9 -0
  11. data/docs/IntegrationTransform.md +11 -0
  12. data/docs/IntegrationTransformExample.md +9 -0
  13. data/docs/IntegrationsApi.md +329 -0
  14. data/docs/LTIApi.md +98 -0
  15. data/docs/Lti1IntegrationAttributes.md +11 -0
  16. data/docs/NodeAttributes.md +2 -0
  17. data/docs/SecurityApi.md +48 -0
  18. data/docs/Template.md +10 -0
  19. data/docs/TemplateAttributes.md +9 -0
  20. data/docs/TemplateBody.md +9 -0
  21. data/docs/{AssetAttributes.md → TemplateVariables.md} +3 -2
  22. data/generate.sh +1 -2
  23. data/git_push.sh +16 -1
  24. data/lib/blueprint_ruby_client/api/asset_type_configs_api.rb +84 -0
  25. data/lib/blueprint_ruby_client/api/asset_type_templates_api.rb +214 -0
  26. data/lib/blueprint_ruby_client/api/assets_api.rb +23 -191
  27. data/lib/blueprint_ruby_client/api/hierarchy_api.rb +49 -409
  28. data/lib/blueprint_ruby_client/api/integrations_api.rb +415 -0
  29. data/lib/blueprint_ruby_client/api/lti_api.rb +156 -0
  30. data/lib/blueprint_ruby_client/api/security_api.rb +75 -0
  31. data/lib/blueprint_ruby_client/api_client.rb +0 -2
  32. data/lib/blueprint_ruby_client/models/asset.rb +2 -59
  33. data/lib/blueprint_ruby_client/models/asset_body.rb +2 -42
  34. data/lib/blueprint_ruby_client/models/asset_relationship.rb +2 -57
  35. data/lib/blueprint_ruby_client/models/asset_result_set.rb +2 -57
  36. data/lib/blueprint_ruby_client/models/error.rb +2 -59
  37. data/lib/blueprint_ruby_client/models/errors.rb +2 -25
  38. data/lib/blueprint_ruby_client/models/integration.rb +225 -0
  39. data/lib/blueprint_ruby_client/models/{mixed_resource_result_set.rb → integration_body.rb} +27 -12
  40. data/lib/blueprint_ruby_client/models/integration_transform.rb +221 -0
  41. data/lib/blueprint_ruby_client/models/integration_transform_example.rb +197 -0
  42. data/lib/blueprint_ruby_client/models/links.rb +2 -57
  43. data/lib/blueprint_ruby_client/models/lti1_integration_attributes.rb +225 -0
  44. data/lib/blueprint_ruby_client/models/meta.rb +2 -57
  45. data/lib/blueprint_ruby_client/models/namespace.rb +2 -43
  46. data/lib/blueprint_ruby_client/models/namespace_relationship.rb +2 -25
  47. data/lib/blueprint_ruby_client/models/node.rb +2 -75
  48. data/lib/blueprint_ruby_client/models/node_attributes.rb +26 -109
  49. data/lib/blueprint_ruby_client/models/node_body.rb +2 -42
  50. data/lib/blueprint_ruby_client/models/node_relationship.rb +2 -57
  51. data/lib/blueprint_ruby_client/models/node_relationships.rb +2 -73
  52. data/lib/blueprint_ruby_client/models/node_result_set.rb +2 -57
  53. data/lib/blueprint_ruby_client/models/resource.rb +2 -59
  54. data/lib/blueprint_ruby_client/models/template.rb +215 -0
  55. data/lib/blueprint_ruby_client/models/template_attributes.rb +217 -0
  56. data/lib/blueprint_ruby_client/models/{asset_attributes.rb → template_body.rb} +23 -33
  57. data/lib/blueprint_ruby_client/models/template_variables.rb +237 -0
  58. data/lib/blueprint_ruby_client/version.rb +1 -1
  59. data/lib/blueprint_ruby_client.rb +14 -0
  60. data/spec/api/asset_type_configs_api_spec.rb +52 -0
  61. data/spec/api/asset_type_templates_api_spec.rb +88 -0
  62. data/spec/api/assets_api_spec.rb +9 -9
  63. data/spec/api/hierarchy_api_spec.rb +17 -17
  64. data/spec/api/integrations_api_spec.rb +141 -0
  65. data/spec/api/lti_api_spec.rb +69 -0
  66. data/spec/api/security_api_spec.rb +50 -0
  67. data/spec/api_client_spec.rb +226 -0
  68. data/spec/configuration_spec.rb +42 -0
  69. data/spec/models/integration_body_spec.rb +56 -0
  70. data/spec/models/integration_spec.rb +66 -0
  71. data/spec/models/integration_transform_example_spec.rb +56 -0
  72. data/spec/models/integration_transform_spec.rb +76 -0
  73. data/spec/models/lti1_integration_attributes_spec.rb +76 -0
  74. data/spec/models/node_attributes_spec.rb +20 -0
  75. data/spec/models/template_attributes_spec.rb +56 -0
  76. data/spec/models/{asset_attributes_spec.rb → template_body_spec.rb} +17 -7
  77. data/spec/models/template_spec.rb +66 -0
  78. data/spec/models/template_variables_spec.rb +56 -0
  79. data/spec/spec_helper.rb +111 -0
  80. data/swagger-codegen-cli.jar +0 -0
  81. data/templates/model.mustache +5 -5
  82. metadata +67 -12
  83. data/docs/MixedResourceResultSet.md +0 -7
  84. data/spec/models/mixed_resource_result_set_spec.rb +0 -36
@@ -0,0 +1,225 @@
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 Integration
17
+ # the unique id of the resource of a given type.
18
+ attr_accessor :id
19
+
20
+ attr_accessor :type
21
+
22
+ attr_accessor :attributes
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'type' => :'type',
29
+ :'attributes' => :'attributes'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'id' => :'String',
37
+ :'type' => :'String',
38
+ :'attributes' => :'Lti1IntegrationAttributes'
39
+ }
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ # convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
49
+
50
+ if attributes.has_key?(:'id')
51
+ self.id = attributes[:'id']
52
+ end
53
+
54
+ if attributes.has_key?(:'type')
55
+ self.type = attributes[:'type']
56
+ end
57
+
58
+ if attributes.has_key?(:'attributes')
59
+ self.attributes = attributes[:'attributes']
60
+ end
61
+
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properies with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ return invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ if @id.nil?
75
+ return false
76
+ end
77
+
78
+ if @type.nil?
79
+ return false
80
+ end
81
+
82
+ allowed_values = ["lti1"]
83
+ if @type && !allowed_values.include?(@type)
84
+ return false
85
+ end
86
+ end
87
+
88
+ # Custom attribute writer method checking allowed values (enum).
89
+ # @param [Object] type Object to be assigned
90
+ def type=(type)
91
+ allowed_values = ["lti1"]
92
+ if type && !allowed_values.include?(type)
93
+ fail ArgumentError, "invalid value for 'type', must be one of #{allowed_values}."
94
+ end
95
+ @type = type
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ id == o.id &&
104
+ type == o.type &&
105
+ attributes == o.attributes
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [id, type, attributes].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /^Array<(.*)>/i
127
+ # check to ensure the input is an array given that the the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :BOOLEAN
157
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ temp_model = BlueprintClient.const_get(type).new
178
+ temp_model.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+ end
@@ -13,18 +13,24 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
13
13
  require 'date'
14
14
 
15
15
  module BlueprintClient
16
- class MixedResourceResultSet
16
+ class IntegrationBody
17
+ attr_accessor :meta
18
+
19
+ attr_accessor :data
20
+
17
21
  # Attribute mapping from ruby-style variable name to JSON key.
18
22
  def self.attribute_map
19
23
  {
20
-
24
+ :'meta' => :'meta',
25
+ :'data' => :'data'
21
26
  }
22
27
  end
23
28
 
24
29
  # Attribute type mapping.
25
30
  def self.swagger_types
26
31
  {
27
-
32
+ :'meta' => :'Meta',
33
+ :'data' => :'Integration'
28
34
  }
29
35
  end
30
36
 
@@ -36,34 +42,43 @@ module BlueprintClient
36
42
  # convert string to symbol for hash key
37
43
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
44
 
39
-
45
+ if attributes.has_key?(:'meta')
46
+ self.meta = attributes[:'meta']
47
+ end
48
+
49
+ if attributes.has_key?(:'data')
50
+ self.data = attributes[:'data']
51
+ end
52
+
40
53
  end
41
54
 
42
55
  # Show invalid properties with the reasons. Usually used together with valid?
43
56
  # @return Array for valid properies with the reasons
44
57
  def list_invalid_properties
45
58
  invalid_properties = Array.new
46
-
47
-
48
59
  return invalid_properties
49
60
  end
50
61
 
51
62
  # Check to see if the all the properties in the model are valid
52
63
  # @return true if the model is valid
53
64
  def valid?
54
-
65
+ if @data.nil?
66
+ return false
67
+ end
68
+
55
69
  end
56
70
 
57
-
58
71
  # Checks equality by comparing each attribute.
59
- # @param [Object] Object to be compared
72
+ # @param [Object] Object to be compared
60
73
  def ==(o)
61
74
  return true if self.equal?(o)
62
- self.class == o.class
75
+ self.class == o.class &&
76
+ meta == o.meta &&
77
+ data == o.data
63
78
  end
64
79
 
65
80
  # @see the `==` method
66
- # @param [Object] Object to be compared
81
+ # @param [Object] Object to be compared
67
82
  def eql?(o)
68
83
  self == o
69
84
  end
@@ -71,7 +86,7 @@ module BlueprintClient
71
86
  # Calculates hash code according to all attributes.
72
87
  # @return [Fixnum] Hash code
73
88
  def hash
74
- [].hash
89
+ [meta, data].hash
75
90
  end
76
91
 
77
92
  # Builds the object from hash
@@ -0,0 +1,221 @@
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 IntegrationTransform
17
+ attr_accessor :field
18
+
19
+ attr_accessor :regex
20
+
21
+ attr_accessor :refs
22
+
23
+ attr_accessor :example
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'field' => :'field',
29
+ :'regex' => :'regex',
30
+ :'refs' => :'refs',
31
+ :'example' => :'example'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'field' => :'String',
39
+ :'regex' => :'String',
40
+ :'refs' => :'Array<String>',
41
+ :'example' => :'IntegrationTransformExample'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+
53
+ if attributes.has_key?(:'field')
54
+ self.field = attributes[:'field']
55
+ end
56
+
57
+ if attributes.has_key?(:'regex')
58
+ self.regex = attributes[:'regex']
59
+ end
60
+
61
+ if attributes.has_key?(:'refs')
62
+ if (value = attributes[:'refs']).is_a?(Array)
63
+ self.refs = value
64
+ end
65
+ end
66
+
67
+ if attributes.has_key?(:'example')
68
+ self.example = attributes[:'example']
69
+ end
70
+
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properies with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ return invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ if @field.nil?
84
+ return false
85
+ end
86
+
87
+ if @refs.nil?
88
+ return false
89
+ end
90
+
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ field == o.field &&
99
+ regex == o.regex &&
100
+ refs == o.refs &&
101
+ example == o.example
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [field, regex, refs, example].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /^Array<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = BlueprintClient.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end