osdn-client 0.0.20160304 → 0.0.20160711
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +201 -0
- data/README.md +182 -0
- data/docs/DefaultApi.md +115 -0
- data/docs/Group.md +23 -0
- data/docs/GroupToolFlags.md +17 -0
- data/docs/News.md +14 -0
- data/docs/Package.md +13 -0
- data/docs/Pong.md +11 -0
- data/docs/ProjectApi.md +1511 -0
- data/docs/ProjectFrsApi.md +888 -0
- data/docs/ProjectNewsApi.md +576 -0
- data/docs/RelFile.md +19 -0
- data/docs/Release.md +16 -0
- data/docs/SimpleChamber.md +11 -0
- data/docs/SimpleGroup.md +11 -0
- data/docs/SimpleUser.md +10 -0
- data/docs/Skill.md +11 -0
- data/docs/Token.md +12 -0
- data/docs/User.md +20 -0
- data/docs/UserApi.md +63 -0
- data/lib/osdn-client.rb +32 -9
- data/lib/osdn-client/api/default_api.rb +50 -39
- data/lib/osdn-client/api/project_api.rb +661 -773
- data/lib/osdn-client/api/project_frs_api.rb +350 -412
- data/lib/osdn-client/api/project_news_api.rb +217 -244
- data/lib/osdn-client/api/user_api.rb +35 -20
- data/lib/osdn-client/api_client.rb +74 -13
- data/lib/osdn-client/api_error.rb +23 -0
- data/lib/osdn-client/configuration.rb +45 -1
- data/lib/osdn-client/models/group.rb +103 -65
- data/lib/osdn-client/models/group_tool_flags.rb +91 -47
- data/lib/osdn-client/models/news.rb +85 -38
- data/lib/osdn-client/models/package.rb +83 -35
- data/lib/osdn-client/models/pong.rb +79 -29
- data/lib/osdn-client/models/rel_file.rb +95 -53
- data/lib/osdn-client/models/release.rb +89 -44
- data/lib/osdn-client/models/simple_chamber.rb +79 -29
- data/lib/osdn-client/models/simple_group.rb +79 -29
- data/lib/osdn-client/models/simple_user.rb +77 -26
- data/lib/osdn-client/models/skill.rb +79 -29
- data/lib/osdn-client/models/token.rb +81 -32
- data/lib/osdn-client/models/user.rb +97 -56
- data/lib/osdn-client/version.rb +24 -1
- data/osdn-client.gemspec +30 -7
- data/spec/api/default_api_spec.rb +73 -0
- data/spec/api/{ProjectApi_spec.rb → project_api_spec.rb} +187 -264
- data/spec/api/{ProjectFrsApi_spec.rb → project_frs_api_spec.rb} +103 -136
- data/spec/api/{ProjectNewsApi_spec.rb → project_news_api_spec.rb} +71 -88
- data/spec/api/user_api_spec.rb +58 -0
- data/spec/api_client_spec.rb +315 -0
- data/spec/configuration_spec.rb +48 -0
- data/spec/models/group_spec.rb +143 -0
- data/spec/models/group_tool_flags_spec.rb +107 -0
- data/spec/models/news_spec.rb +89 -0
- data/spec/models/package_spec.rb +83 -0
- data/spec/models/pong_spec.rb +71 -0
- data/spec/models/rel_file_spec.rb +119 -0
- data/spec/models/release_spec.rb +101 -0
- data/spec/models/simple_chamber_spec.rb +71 -0
- data/spec/models/simple_group_spec.rb +71 -0
- data/spec/models/simple_user_spec.rb +65 -0
- data/spec/models/skill_spec.rb +71 -0
- data/spec/models/token_spec.rb +77 -0
- data/spec/models/user_spec.rb +125 -0
- data/spec/spec_helper.rb +122 -0
- metadata +87 -59
- data/spec/api/DefaultApi_spec.rb +0 -58
- data/spec/api/UserApi_spec.rb +0 -39
- data/spec/models/GroupToolFlags_spec.rb +0 -124
- data/spec/models/Group_spec.rb +0 -184
- data/spec/models/News_spec.rb +0 -94
- data/spec/models/Package_spec.rb +0 -84
- data/spec/models/Pong_spec.rb +0 -64
- data/spec/models/RelFile_spec.rb +0 -144
- data/spec/models/Release_spec.rb +0 -114
- data/spec/models/SimpleChamber_spec.rb +0 -64
- data/spec/models/SimpleGroup_spec.rb +0 -64
- data/spec/models/SimpleUser_spec.rb +0 -54
- data/spec/models/Skill_spec.rb +0 -64
- data/spec/models/Token_spec.rb +0 -74
- data/spec/models/User_spec.rb +0 -154
@@ -1,6 +1,30 @@
|
|
1
|
+
=begin
|
2
|
+
#OSDN REST API v0 beta
|
3
|
+
|
4
|
+
#OSDN REST API. Currently this API is experimental release. Pelase refer documentation on https://osdn.jp/projects/osdn-codes/wiki/APIGuide and you can get client libraries from https://osdn.jp/projects/osdn-codes/releases/p14859 .
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.20160304
|
7
|
+
Contact: admin@osdn.jp
|
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
|
+
|
1
24
|
require 'date'
|
2
25
|
|
3
26
|
module OSDNClient
|
27
|
+
|
4
28
|
class RelFile
|
5
29
|
attr_accessor :id
|
6
30
|
|
@@ -26,34 +50,22 @@ module OSDNClient
|
|
26
50
|
|
27
51
|
attr_accessor :download_count
|
28
52
|
|
53
|
+
|
29
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
55
|
def self.attribute_map
|
31
56
|
{
|
32
|
-
|
33
57
|
:'id' => :'id',
|
34
|
-
|
35
58
|
:'name' => :'name',
|
36
|
-
|
37
59
|
:'date' => :'date',
|
38
|
-
|
39
60
|
:'url' => :'url',
|
40
|
-
|
41
61
|
:'visibility' => :'visibility',
|
42
|
-
|
43
62
|
:'cascaded_visibility' => :'cascaded_visibility',
|
44
|
-
|
45
63
|
:'release_id' => :'release_id',
|
46
|
-
|
47
64
|
:'size' => :'size',
|
48
|
-
|
49
65
|
:'digest_md5' => :'digest_md5',
|
50
|
-
|
51
66
|
:'digest_sha1' => :'digest_sha1',
|
52
|
-
|
53
67
|
:'digest_sha256' => :'digest_sha256',
|
54
|
-
|
55
68
|
:'download_count' => :'download_count'
|
56
|
-
|
57
69
|
}
|
58
70
|
end
|
59
71
|
|
@@ -72,68 +84,82 @@ module OSDNClient
|
|
72
84
|
:'digest_sha1' => :'String',
|
73
85
|
:'digest_sha256' => :'String',
|
74
86
|
:'download_count' => :'Integer'
|
75
|
-
|
76
87
|
}
|
77
88
|
end
|
78
89
|
|
90
|
+
# Initializes the object
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
92
|
def initialize(attributes = {})
|
80
93
|
return unless attributes.is_a?(Hash)
|
81
94
|
|
82
95
|
# convert string to symbol for hash key
|
83
|
-
attributes = attributes.
|
96
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
84
97
|
|
85
|
-
|
86
|
-
if attributes[:'id']
|
98
|
+
if attributes.has_key?(:'id')
|
87
99
|
self.id = attributes[:'id']
|
88
100
|
end
|
89
|
-
|
90
|
-
if attributes
|
101
|
+
|
102
|
+
if attributes.has_key?(:'name')
|
91
103
|
self.name = attributes[:'name']
|
92
104
|
end
|
93
|
-
|
94
|
-
if attributes
|
105
|
+
|
106
|
+
if attributes.has_key?(:'date')
|
95
107
|
self.date = attributes[:'date']
|
96
108
|
end
|
97
|
-
|
98
|
-
if attributes
|
109
|
+
|
110
|
+
if attributes.has_key?(:'url')
|
99
111
|
self.url = attributes[:'url']
|
100
112
|
end
|
101
|
-
|
102
|
-
if attributes
|
113
|
+
|
114
|
+
if attributes.has_key?(:'visibility')
|
103
115
|
self.visibility = attributes[:'visibility']
|
104
116
|
end
|
105
|
-
|
106
|
-
if attributes
|
117
|
+
|
118
|
+
if attributes.has_key?(:'cascaded_visibility')
|
107
119
|
self.cascaded_visibility = attributes[:'cascaded_visibility']
|
108
120
|
end
|
109
|
-
|
110
|
-
if attributes
|
121
|
+
|
122
|
+
if attributes.has_key?(:'release_id')
|
111
123
|
self.release_id = attributes[:'release_id']
|
112
124
|
end
|
113
|
-
|
114
|
-
if attributes
|
125
|
+
|
126
|
+
if attributes.has_key?(:'size')
|
115
127
|
self.size = attributes[:'size']
|
116
128
|
end
|
117
|
-
|
118
|
-
if attributes
|
129
|
+
|
130
|
+
if attributes.has_key?(:'digest_md5')
|
119
131
|
self.digest_md5 = attributes[:'digest_md5']
|
120
132
|
end
|
121
|
-
|
122
|
-
if attributes
|
133
|
+
|
134
|
+
if attributes.has_key?(:'digest_sha1')
|
123
135
|
self.digest_sha1 = attributes[:'digest_sha1']
|
124
136
|
end
|
125
|
-
|
126
|
-
if attributes
|
137
|
+
|
138
|
+
if attributes.has_key?(:'digest_sha256')
|
127
139
|
self.digest_sha256 = attributes[:'digest_sha256']
|
128
140
|
end
|
129
|
-
|
130
|
-
if attributes
|
141
|
+
|
142
|
+
if attributes.has_key?(:'download_count')
|
131
143
|
self.download_count = attributes[:'download_count']
|
132
144
|
end
|
133
|
-
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
149
|
+
# @return Array for valid properies with the reasons
|
150
|
+
def list_invalid_properties
|
151
|
+
invalid_properties = Array.new
|
152
|
+
return invalid_properties
|
153
|
+
end
|
154
|
+
|
155
|
+
# Check to see if the all the properties in the model are valid
|
156
|
+
# @return true if the model is valid
|
157
|
+
def valid?
|
158
|
+
return true
|
134
159
|
end
|
135
160
|
|
136
|
-
#
|
161
|
+
# Checks equality by comparing each attribute.
|
162
|
+
# @param [Object] Object to be compared
|
137
163
|
def ==(o)
|
138
164
|
return true if self.equal?(o)
|
139
165
|
self.class == o.class &&
|
@@ -152,35 +178,41 @@ module OSDNClient
|
|
152
178
|
end
|
153
179
|
|
154
180
|
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
155
182
|
def eql?(o)
|
156
183
|
self == o
|
157
184
|
end
|
158
185
|
|
159
|
-
#
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Fixnum] Hash code
|
160
188
|
def hash
|
161
189
|
[id, name, date, url, visibility, cascaded_visibility, release_id, size, digest_md5, digest_sha1, digest_sha256, download_count].hash
|
162
190
|
end
|
163
191
|
|
164
|
-
#
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
165
195
|
def build_from_hash(attributes)
|
166
196
|
return nil unless attributes.is_a?(Hash)
|
167
197
|
self.class.swagger_types.each_pair do |key, type|
|
168
198
|
if type =~ /^Array<(.*)>/i
|
199
|
+
# check to ensure the input is an array given that the the attribute
|
200
|
+
# is documented as an array but the input is not
|
169
201
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
170
202
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
171
|
-
else
|
172
|
-
#TODO show warning in debug mode
|
173
203
|
end
|
174
204
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
175
205
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
176
|
-
else
|
177
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
178
|
-
end
|
206
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
179
207
|
end
|
180
208
|
|
181
209
|
self
|
182
210
|
end
|
183
211
|
|
212
|
+
# Deserializes the data based on type
|
213
|
+
# @param string type Data type
|
214
|
+
# @param string value Value to be deserialized
|
215
|
+
# @return [Object] Deserialized data
|
184
216
|
def _deserialize(type, value)
|
185
217
|
case type.to_sym
|
186
218
|
when :DateTime
|
@@ -199,6 +231,9 @@ module OSDNClient
|
|
199
231
|
else
|
200
232
|
false
|
201
233
|
end
|
234
|
+
when :Object
|
235
|
+
# generic object (usually a Hash), return directly
|
236
|
+
value
|
202
237
|
when /\AArray<(?<inner_type>.+)>\z/
|
203
238
|
inner_type = Regexp.last_match[:inner_type]
|
204
239
|
value.map { |v| _deserialize(inner_type, v) }
|
@@ -211,21 +246,25 @@ module OSDNClient
|
|
211
246
|
end
|
212
247
|
end
|
213
248
|
else # model
|
214
|
-
|
215
|
-
|
249
|
+
temp_model = OSDNClient.const_get(type).new
|
250
|
+
temp_model.build_from_hash(value)
|
216
251
|
end
|
217
252
|
end
|
218
253
|
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
219
256
|
def to_s
|
220
257
|
to_hash.to_s
|
221
258
|
end
|
222
259
|
|
223
|
-
# to_body is an alias to
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
224
262
|
def to_body
|
225
263
|
to_hash
|
226
264
|
end
|
227
265
|
|
228
|
-
#
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
229
268
|
def to_hash
|
230
269
|
hash = {}
|
231
270
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -236,8 +275,10 @@ module OSDNClient
|
|
236
275
|
hash
|
237
276
|
end
|
238
277
|
|
239
|
-
#
|
278
|
+
# Outputs non-array value in the form of hash
|
240
279
|
# For object, use to_hash. Otherwise, just return the value
|
280
|
+
# @param [Object] value Any valid value
|
281
|
+
# @return [Hash] Returns the value in the form of hash
|
241
282
|
def _to_hash(value)
|
242
283
|
if value.is_a?(Array)
|
243
284
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -253,4 +294,5 @@ module OSDNClient
|
|
253
294
|
end
|
254
295
|
|
255
296
|
end
|
297
|
+
|
256
298
|
end
|
@@ -1,6 +1,30 @@
|
|
1
|
+
=begin
|
2
|
+
#OSDN REST API v0 beta
|
3
|
+
|
4
|
+
#OSDN REST API. Currently this API is experimental release. Pelase refer documentation on https://osdn.jp/projects/osdn-codes/wiki/APIGuide and you can get client libraries from https://osdn.jp/projects/osdn-codes/releases/p14859 .
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.20160304
|
7
|
+
Contact: admin@osdn.jp
|
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
|
+
|
1
24
|
require 'date'
|
2
25
|
|
3
26
|
module OSDNClient
|
27
|
+
|
4
28
|
class Release
|
5
29
|
attr_accessor :id
|
6
30
|
|
@@ -20,28 +44,19 @@ module OSDNClient
|
|
20
44
|
|
21
45
|
attr_accessor :files
|
22
46
|
|
47
|
+
|
23
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
49
|
def self.attribute_map
|
25
50
|
{
|
26
|
-
|
27
51
|
:'id' => :'id',
|
28
|
-
|
29
52
|
:'name' => :'name',
|
30
|
-
|
31
53
|
:'url' => :'url',
|
32
|
-
|
33
54
|
:'visibility' => :'visibility',
|
34
|
-
|
35
55
|
:'cascaded_visibility' => :'cascaded_visibility',
|
36
|
-
|
37
56
|
:'package_id' => :'package_id',
|
38
|
-
|
39
57
|
:'file_count' => :'file_count',
|
40
|
-
|
41
58
|
:'is_draft' => :'is_draft',
|
42
|
-
|
43
59
|
:'files' => :'files'
|
44
|
-
|
45
60
|
}
|
46
61
|
end
|
47
62
|
|
@@ -57,58 +72,72 @@ module OSDNClient
|
|
57
72
|
:'file_count' => :'Integer',
|
58
73
|
:'is_draft' => :'BOOLEAN',
|
59
74
|
:'files' => :'Array<RelFile>'
|
60
|
-
|
61
75
|
}
|
62
76
|
end
|
63
77
|
|
78
|
+
# Initializes the object
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
80
|
def initialize(attributes = {})
|
65
81
|
return unless attributes.is_a?(Hash)
|
66
82
|
|
67
83
|
# convert string to symbol for hash key
|
68
|
-
attributes = attributes.
|
84
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
69
85
|
|
70
|
-
|
71
|
-
if attributes[:'id']
|
86
|
+
if attributes.has_key?(:'id')
|
72
87
|
self.id = attributes[:'id']
|
73
88
|
end
|
74
|
-
|
75
|
-
if attributes
|
89
|
+
|
90
|
+
if attributes.has_key?(:'name')
|
76
91
|
self.name = attributes[:'name']
|
77
92
|
end
|
78
|
-
|
79
|
-
if attributes
|
93
|
+
|
94
|
+
if attributes.has_key?(:'url')
|
80
95
|
self.url = attributes[:'url']
|
81
96
|
end
|
82
|
-
|
83
|
-
if attributes
|
97
|
+
|
98
|
+
if attributes.has_key?(:'visibility')
|
84
99
|
self.visibility = attributes[:'visibility']
|
85
100
|
end
|
86
|
-
|
87
|
-
if attributes
|
101
|
+
|
102
|
+
if attributes.has_key?(:'cascaded_visibility')
|
88
103
|
self.cascaded_visibility = attributes[:'cascaded_visibility']
|
89
104
|
end
|
90
|
-
|
91
|
-
if attributes
|
105
|
+
|
106
|
+
if attributes.has_key?(:'package_id')
|
92
107
|
self.package_id = attributes[:'package_id']
|
93
108
|
end
|
94
|
-
|
95
|
-
if attributes
|
109
|
+
|
110
|
+
if attributes.has_key?(:'file_count')
|
96
111
|
self.file_count = attributes[:'file_count']
|
97
112
|
end
|
98
|
-
|
99
|
-
if attributes
|
113
|
+
|
114
|
+
if attributes.has_key?(:'is_draft')
|
100
115
|
self.is_draft = attributes[:'is_draft']
|
101
116
|
end
|
102
|
-
|
103
|
-
if attributes
|
117
|
+
|
118
|
+
if attributes.has_key?(:'files')
|
104
119
|
if (value = attributes[:'files']).is_a?(Array)
|
105
120
|
self.files = value
|
106
121
|
end
|
107
122
|
end
|
108
|
-
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
127
|
+
# @return Array for valid properies with the reasons
|
128
|
+
def list_invalid_properties
|
129
|
+
invalid_properties = Array.new
|
130
|
+
return invalid_properties
|
109
131
|
end
|
110
132
|
|
111
|
-
# Check
|
133
|
+
# Check to see if the all the properties in the model are valid
|
134
|
+
# @return true if the model is valid
|
135
|
+
def valid?
|
136
|
+
return true
|
137
|
+
end
|
138
|
+
|
139
|
+
# Checks equality by comparing each attribute.
|
140
|
+
# @param [Object] Object to be compared
|
112
141
|
def ==(o)
|
113
142
|
return true if self.equal?(o)
|
114
143
|
self.class == o.class &&
|
@@ -124,35 +153,41 @@ module OSDNClient
|
|
124
153
|
end
|
125
154
|
|
126
155
|
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
127
157
|
def eql?(o)
|
128
158
|
self == o
|
129
159
|
end
|
130
160
|
|
131
|
-
#
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Fixnum] Hash code
|
132
163
|
def hash
|
133
164
|
[id, name, url, visibility, cascaded_visibility, package_id, file_count, is_draft, files].hash
|
134
165
|
end
|
135
166
|
|
136
|
-
#
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
137
170
|
def build_from_hash(attributes)
|
138
171
|
return nil unless attributes.is_a?(Hash)
|
139
172
|
self.class.swagger_types.each_pair do |key, type|
|
140
173
|
if type =~ /^Array<(.*)>/i
|
174
|
+
# check to ensure the input is an array given that the the attribute
|
175
|
+
# is documented as an array but the input is not
|
141
176
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
142
177
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
143
|
-
else
|
144
|
-
#TODO show warning in debug mode
|
145
178
|
end
|
146
179
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
147
180
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
148
|
-
else
|
149
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
150
|
-
end
|
181
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
151
182
|
end
|
152
183
|
|
153
184
|
self
|
154
185
|
end
|
155
186
|
|
187
|
+
# Deserializes the data based on type
|
188
|
+
# @param string type Data type
|
189
|
+
# @param string value Value to be deserialized
|
190
|
+
# @return [Object] Deserialized data
|
156
191
|
def _deserialize(type, value)
|
157
192
|
case type.to_sym
|
158
193
|
when :DateTime
|
@@ -171,6 +206,9 @@ module OSDNClient
|
|
171
206
|
else
|
172
207
|
false
|
173
208
|
end
|
209
|
+
when :Object
|
210
|
+
# generic object (usually a Hash), return directly
|
211
|
+
value
|
174
212
|
when /\AArray<(?<inner_type>.+)>\z/
|
175
213
|
inner_type = Regexp.last_match[:inner_type]
|
176
214
|
value.map { |v| _deserialize(inner_type, v) }
|
@@ -183,21 +221,25 @@ module OSDNClient
|
|
183
221
|
end
|
184
222
|
end
|
185
223
|
else # model
|
186
|
-
|
187
|
-
|
224
|
+
temp_model = OSDNClient.const_get(type).new
|
225
|
+
temp_model.build_from_hash(value)
|
188
226
|
end
|
189
227
|
end
|
190
228
|
|
229
|
+
# Returns the string representation of the object
|
230
|
+
# @return [String] String presentation of the object
|
191
231
|
def to_s
|
192
232
|
to_hash.to_s
|
193
233
|
end
|
194
234
|
|
195
|
-
# to_body is an alias to
|
235
|
+
# to_body is an alias to to_hash (backward compatibility)
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
196
237
|
def to_body
|
197
238
|
to_hash
|
198
239
|
end
|
199
240
|
|
200
|
-
#
|
241
|
+
# Returns the object in the form of hash
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
201
243
|
def to_hash
|
202
244
|
hash = {}
|
203
245
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -208,8 +250,10 @@ module OSDNClient
|
|
208
250
|
hash
|
209
251
|
end
|
210
252
|
|
211
|
-
#
|
253
|
+
# Outputs non-array value in the form of hash
|
212
254
|
# For object, use to_hash. Otherwise, just return the value
|
255
|
+
# @param [Object] value Any valid value
|
256
|
+
# @return [Hash] Returns the value in the form of hash
|
213
257
|
def _to_hash(value)
|
214
258
|
if value.is_a?(Array)
|
215
259
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -225,4 +269,5 @@ module OSDNClient
|
|
225
269
|
end
|
226
270
|
|
227
271
|
end
|
272
|
+
|
228
273
|
end
|