osdn-client 0.0.20160304 → 0.0.20160711

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