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