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