crx_packmgr_api_client 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -16
- data/crx_packmgr_api_client-0.2.0.gem +0 -0
- data/crx_packmgr_api_client.gemspec +9 -4
- data/docs/DefaultApi.md +457 -7
- data/docs/{PackageFilter.md → Filter.md} +2 -2
- data/docs/FilterRule.md +9 -0
- data/docs/Group.md +11 -0
- data/docs/{InlineResponse200.md → GroupList.md} +2 -2
- data/docs/InitData.md +13 -0
- data/docs/InstallStatus.md +8 -0
- data/docs/InstallStatusStatus.md +9 -0
- data/docs/Package.md +1 -1
- data/docs/PackageList.md +1 -0
- data/docs/ServiceResponse.md +12 -0
- data/docs/ServiceResponseRequest.md +8 -0
- data/docs/ServiceResponseRequestParam.md +9 -0
- data/docs/ServiceResponseResponse.md +9 -0
- data/docs/UpdateStatus.md +10 -0
- data/git_push.sh +1 -1
- data/lib/crx_packmgr_api_client.rb +13 -2
- data/lib/crx_packmgr_api_client/api/default_api.rb +491 -8
- data/lib/crx_packmgr_api_client/api_client.rb +1 -1
- data/lib/crx_packmgr_api_client/api_error.rb +1 -1
- data/lib/crx_packmgr_api_client/configuration.rb +1 -1
- data/lib/crx_packmgr_api_client/models/{package_filter.rb → filter.rb} +3 -3
- data/lib/crx_packmgr_api_client/models/filter_rule.rb +241 -0
- data/lib/crx_packmgr_api_client/models/group.rb +226 -0
- data/lib/crx_packmgr_api_client/models/{inline_response_200.rb → group_list.rb} +10 -10
- data/lib/crx_packmgr_api_client/models/init_data.rb +246 -0
- data/lib/crx_packmgr_api_client/models/install_status.rb +199 -0
- data/lib/crx_packmgr_api_client/models/install_status_status.rb +208 -0
- data/lib/crx_packmgr_api_client/models/package.rb +2 -2
- data/lib/crx_packmgr_api_client/models/package_list.rb +14 -5
- data/lib/crx_packmgr_api_client/models/service_response.rb +235 -0
- data/lib/crx_packmgr_api_client/models/service_response_request.rb +201 -0
- data/lib/crx_packmgr_api_client/models/service_response_request_param.rb +208 -0
- data/lib/crx_packmgr_api_client/models/service_response_response.rb +208 -0
- data/lib/crx_packmgr_api_client/models/update_status.rb +217 -0
- data/lib/crx_packmgr_api_client/version.rb +2 -2
- data/spec/acceptance/default_api_spec.rb +150 -0
- data/spec/api/default_api_spec.rb +2 -14
- data/spec/api/download_api_spec.rb +95 -0
- data/spec/api/groups_api_spec.rb +193 -0
- data/spec/api/init_api_spec.rb +104 -0
- data/spec/api/installstatus_api_spec.rb +91 -0
- data/spec/api/list_api_spec.rb +130 -0
- data/spec/api/screenshot_api_spec.rb +93 -0
- data/spec/api/service_api_spec.rb +374 -0
- data/spec/api/thumbnail_api_spec.rb +93 -0
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/files/list.json +533 -0
- data/spec/files/service_response.txt +11 -0
- data/spec/files/service_response1.txt +12 -0
- data/spec/files/test-1.0.0.zip +0 -0
- data/spec/files/thumbnail.png +0 -0
- data/spec/models/filter_rule_spec.rb +63 -0
- data/spec/models/{package_filter_spec.rb → filter_spec.rb} +7 -7
- data/spec/models/{inline_response_200_spec.rb → group_list_spec.rb} +8 -8
- data/spec/models/group_spec.rb +71 -0
- data/spec/models/init_data_spec.rb +83 -0
- data/spec/models/install_status_spec.rb +53 -0
- data/spec/models/install_status_status_spec.rb +59 -0
- data/spec/models/package_list_spec.rb +1 -1
- data/spec/models/package_spec.rb +1 -1
- data/spec/models/service_response_request_param_spec.rb +59 -0
- data/spec/models/service_response_request_spec.rb +53 -0
- data/spec/models/service_response_response_spec.rb +59 -0
- data/spec/models/service_response_spec.rb +77 -0
- data/spec/models/update_status_spec.rb +65 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/spec_helper_acceptance.rb +19 -0
- metadata +130 -17
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#API for interacting with the CRX Package Manager in AEM.
|
5
5
|
|
6
|
-
OpenAPI spec version:
|
6
|
+
OpenAPI spec version: 6.2.0
|
7
7
|
Contact: bryan.stopp@gmail.com
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
|
@@ -25,21 +25,21 @@ require 'date'
|
|
25
25
|
|
26
26
|
module CrxPackageManager
|
27
27
|
|
28
|
-
class
|
29
|
-
attr_accessor :
|
28
|
+
class GroupList
|
29
|
+
attr_accessor :groups
|
30
30
|
|
31
31
|
|
32
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
33
|
def self.attribute_map
|
34
34
|
{
|
35
|
-
:'
|
35
|
+
:'groups' => :'groups'
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
39
|
# Attribute type mapping.
|
40
40
|
def self.swagger_types
|
41
41
|
{
|
42
|
-
:'
|
42
|
+
:'groups' => :'Array<Group>'
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
@@ -51,9 +51,9 @@ module CrxPackageManager
|
|
51
51
|
# convert string to symbol for hash key
|
52
52
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
53
|
|
54
|
-
if attributes.has_key?(:'
|
55
|
-
if (value = attributes[:'
|
56
|
-
self.
|
54
|
+
if attributes.has_key?(:'groups')
|
55
|
+
if (value = attributes[:'groups']).is_a?(Array)
|
56
|
+
self.groups = value
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -77,7 +77,7 @@ module CrxPackageManager
|
|
77
77
|
def ==(o)
|
78
78
|
return true if self.equal?(o)
|
79
79
|
self.class == o.class &&
|
80
|
-
|
80
|
+
groups == o.groups
|
81
81
|
end
|
82
82
|
|
83
83
|
# @see the `==` method
|
@@ -89,7 +89,7 @@ module CrxPackageManager
|
|
89
89
|
# Calculates hash code according to all attributes.
|
90
90
|
# @return [Fixnum] Hash code
|
91
91
|
def hash
|
92
|
-
[
|
92
|
+
[groups].hash
|
93
93
|
end
|
94
94
|
|
95
95
|
# Builds the object from hash
|
@@ -0,0 +1,246 @@
|
|
1
|
+
=begin
|
2
|
+
#CRX Package Manager API
|
3
|
+
|
4
|
+
#API for interacting with the CRX Package Manager in AEM.
|
5
|
+
|
6
|
+
OpenAPI spec version: 6.2.0
|
7
|
+
Contact: bryan.stopp@gmail.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'date'
|
25
|
+
|
26
|
+
module CrxPackageManager
|
27
|
+
|
28
|
+
class InitData
|
29
|
+
attr_accessor :context_path
|
30
|
+
|
31
|
+
attr_accessor :launchpad_context_path
|
32
|
+
|
33
|
+
attr_accessor :jcr_version
|
34
|
+
|
35
|
+
attr_accessor :workspace
|
36
|
+
|
37
|
+
attr_accessor :user_id
|
38
|
+
|
39
|
+
attr_accessor :workspaces
|
40
|
+
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'context_path' => :'contextPath',
|
46
|
+
:'launchpad_context_path' => :'launchpadContextPath',
|
47
|
+
:'jcr_version' => :'jcrVersion',
|
48
|
+
:'workspace' => :'workspace',
|
49
|
+
:'user_id' => :'userID',
|
50
|
+
:'workspaces' => :'workspaces'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.swagger_types
|
56
|
+
{
|
57
|
+
:'context_path' => :'String',
|
58
|
+
:'launchpad_context_path' => :'String',
|
59
|
+
:'jcr_version' => :'String',
|
60
|
+
:'workspace' => :'String',
|
61
|
+
:'user_id' => :'String',
|
62
|
+
:'workspaces' => :'Array<String>'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
return unless attributes.is_a?(Hash)
|
70
|
+
|
71
|
+
# convert string to symbol for hash key
|
72
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
73
|
+
|
74
|
+
if attributes.has_key?(:'contextPath')
|
75
|
+
self.context_path = attributes[:'contextPath']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'launchpadContextPath')
|
79
|
+
self.launchpad_context_path = attributes[:'launchpadContextPath']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'jcrVersion')
|
83
|
+
self.jcr_version = attributes[:'jcrVersion']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'workspace')
|
87
|
+
self.workspace = attributes[:'workspace']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'userID')
|
91
|
+
self.user_id = attributes[:'userID']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'workspaces')
|
95
|
+
if (value = attributes[:'workspaces']).is_a?(Array)
|
96
|
+
self.workspaces = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
+
# @return Array for valid properies with the reasons
|
104
|
+
def list_invalid_properties
|
105
|
+
invalid_properties = Array.new
|
106
|
+
return invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
return true
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks equality by comparing each attribute.
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def ==(o)
|
118
|
+
return true if self.equal?(o)
|
119
|
+
self.class == o.class &&
|
120
|
+
context_path == o.context_path &&
|
121
|
+
launchpad_context_path == o.launchpad_context_path &&
|
122
|
+
jcr_version == o.jcr_version &&
|
123
|
+
workspace == o.workspace &&
|
124
|
+
user_id == o.user_id &&
|
125
|
+
workspaces == o.workspaces
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def eql?(o)
|
131
|
+
self == o
|
132
|
+
end
|
133
|
+
|
134
|
+
# Calculates hash code according to all attributes.
|
135
|
+
# @return [Fixnum] Hash code
|
136
|
+
def hash
|
137
|
+
[context_path, launchpad_context_path, jcr_version, workspace, user_id, workspaces].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
self.class.swagger_types.each_pair do |key, type|
|
146
|
+
if type =~ /^Array<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :BOOLEAN
|
177
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
temp_model = CrxPackageManager.const_get(type).new
|
198
|
+
temp_model.build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the string representation of the object
|
203
|
+
# @return [String] String presentation of the object
|
204
|
+
def to_s
|
205
|
+
to_hash.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the object in the form of hash
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
next if value.nil?
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map{ |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
=begin
|
2
|
+
#CRX Package Manager API
|
3
|
+
|
4
|
+
#API for interacting with the CRX Package Manager in AEM.
|
5
|
+
|
6
|
+
OpenAPI spec version: 6.2.0
|
7
|
+
Contact: bryan.stopp@gmail.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
you may not use this file except in compliance with the License.
|
12
|
+
You may obtain a copy of the License at
|
13
|
+
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
See the License for the specific language governing permissions and
|
20
|
+
limitations under the License.
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'date'
|
25
|
+
|
26
|
+
module CrxPackageManager
|
27
|
+
|
28
|
+
class InstallStatus
|
29
|
+
attr_accessor :status
|
30
|
+
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'status' => :'status'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'status' => :'InstallStatusStatus'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes.has_key?(:'status')
|
55
|
+
self.status = attributes[:'status']
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks equality by comparing each attribute.
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def ==(o)
|
76
|
+
return true if self.equal?(o)
|
77
|
+
self.class == o.class &&
|
78
|
+
status == o.status
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Fixnum] Hash code
|
89
|
+
def hash
|
90
|
+
[status].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.swagger_types.each_pair do |key, type|
|
99
|
+
if type =~ /^Array<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :BOOLEAN
|
130
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
temp_model = CrxPackageManager.const_get(type).new
|
151
|
+
temp_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map{ |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|