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