osdn-client 0.0.20160304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/lib/osdn-client.rb +45 -0
  3. data/lib/osdn-client/api/default_api.rb +148 -0
  4. data/lib/osdn-client/api/project_api.rb +1752 -0
  5. data/lib/osdn-client/api/project_frs_api.rb +1033 -0
  6. data/lib/osdn-client/api/project_news_api.rb +673 -0
  7. data/lib/osdn-client/api/user_api.rb +76 -0
  8. data/lib/osdn-client/api_client.rb +318 -0
  9. data/lib/osdn-client/api_error.rb +24 -0
  10. data/lib/osdn-client/configuration.rb +177 -0
  11. data/lib/osdn-client/models/group.rb +298 -0
  12. data/lib/osdn-client/models/group_tool_flags.rb +236 -0
  13. data/lib/osdn-client/models/news.rb +206 -0
  14. data/lib/osdn-client/models/package.rb +198 -0
  15. data/lib/osdn-client/models/pong.rb +176 -0
  16. data/lib/osdn-client/models/rel_file.rb +256 -0
  17. data/lib/osdn-client/models/release.rb +228 -0
  18. data/lib/osdn-client/models/simple_chamber.rb +176 -0
  19. data/lib/osdn-client/models/simple_group.rb +176 -0
  20. data/lib/osdn-client/models/simple_user.rb +166 -0
  21. data/lib/osdn-client/models/skill.rb +176 -0
  22. data/lib/osdn-client/models/token.rb +186 -0
  23. data/lib/osdn-client/models/user.rb +272 -0
  24. data/lib/osdn-client/version.rb +3 -0
  25. data/osdn-client.gemspec +32 -0
  26. data/spec/api/DefaultApi_spec.rb +58 -0
  27. data/spec/api/ProjectApi_spec.rb +472 -0
  28. data/spec/api/ProjectFrsApi_spec.rb +285 -0
  29. data/spec/api/ProjectNewsApi_spec.rb +194 -0
  30. data/spec/api/UserApi_spec.rb +39 -0
  31. data/spec/models/GroupToolFlags_spec.rb +124 -0
  32. data/spec/models/Group_spec.rb +184 -0
  33. data/spec/models/News_spec.rb +94 -0
  34. data/spec/models/Package_spec.rb +84 -0
  35. data/spec/models/Pong_spec.rb +64 -0
  36. data/spec/models/RelFile_spec.rb +144 -0
  37. data/spec/models/Release_spec.rb +114 -0
  38. data/spec/models/SimpleChamber_spec.rb +64 -0
  39. data/spec/models/SimpleGroup_spec.rb +64 -0
  40. data/spec/models/SimpleUser_spec.rb +54 -0
  41. data/spec/models/Skill_spec.rb +64 -0
  42. data/spec/models/Token_spec.rb +74 -0
  43. data/spec/models/User_spec.rb +154 -0
  44. metadata +284 -0
@@ -0,0 +1,298 @@
1
+ require 'date'
2
+
3
+ module OSDNClient
4
+ class Group
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :display_name
10
+
11
+ attr_accessor :last_update
12
+
13
+ attr_accessor :description
14
+
15
+ attr_accessor :description_html
16
+
17
+ attr_accessor :start_date
18
+
19
+ attr_accessor :license
20
+
21
+ attr_accessor :license_other
22
+
23
+ attr_accessor :url
24
+
25
+ attr_accessor :homepage
26
+
27
+ attr_accessor :logo_image
28
+
29
+ attr_accessor :banner_image
30
+
31
+ attr_accessor :thumbnail_image
32
+
33
+ attr_accessor :tools
34
+
35
+ attr_accessor :members
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+
41
+ :'id' => :'id',
42
+
43
+ :'name' => :'name',
44
+
45
+ :'display_name' => :'display_name',
46
+
47
+ :'last_update' => :'last_update',
48
+
49
+ :'description' => :'description',
50
+
51
+ :'description_html' => :'description_html',
52
+
53
+ :'start_date' => :'start_date',
54
+
55
+ :'license' => :'license',
56
+
57
+ :'license_other' => :'license_other',
58
+
59
+ :'url' => :'url',
60
+
61
+ :'homepage' => :'homepage',
62
+
63
+ :'logo_image' => :'logo_image',
64
+
65
+ :'banner_image' => :'banner_image',
66
+
67
+ :'thumbnail_image' => :'thumbnail_image',
68
+
69
+ :'tools' => :'tools',
70
+
71
+ :'members' => :'members'
72
+
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.swagger_types
78
+ {
79
+ :'id' => :'Integer',
80
+ :'name' => :'String',
81
+ :'display_name' => :'String',
82
+ :'last_update' => :'DateTime',
83
+ :'description' => :'String',
84
+ :'description_html' => :'String',
85
+ :'start_date' => :'DateTime',
86
+ :'license' => :'String',
87
+ :'license_other' => :'String',
88
+ :'url' => :'String',
89
+ :'homepage' => :'String',
90
+ :'logo_image' => :'String',
91
+ :'banner_image' => :'String',
92
+ :'thumbnail_image' => :'String',
93
+ :'tools' => :'GroupToolFlags',
94
+ :'members' => :'Array<SimpleUser>'
95
+
96
+ }
97
+ end
98
+
99
+ def initialize(attributes = {})
100
+ return unless attributes.is_a?(Hash)
101
+
102
+ # convert string to symbol for hash key
103
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
104
+
105
+
106
+ if attributes[:'id']
107
+ self.id = attributes[:'id']
108
+ end
109
+
110
+ if attributes[:'name']
111
+ self.name = attributes[:'name']
112
+ end
113
+
114
+ if attributes[:'display_name']
115
+ self.display_name = attributes[:'display_name']
116
+ end
117
+
118
+ if attributes[:'last_update']
119
+ self.last_update = attributes[:'last_update']
120
+ end
121
+
122
+ if attributes[:'description']
123
+ self.description = attributes[:'description']
124
+ end
125
+
126
+ if attributes[:'description_html']
127
+ self.description_html = attributes[:'description_html']
128
+ end
129
+
130
+ if attributes[:'start_date']
131
+ self.start_date = attributes[:'start_date']
132
+ end
133
+
134
+ if attributes[:'license']
135
+ self.license = attributes[:'license']
136
+ end
137
+
138
+ if attributes[:'license_other']
139
+ self.license_other = attributes[:'license_other']
140
+ end
141
+
142
+ if attributes[:'url']
143
+ self.url = attributes[:'url']
144
+ end
145
+
146
+ if attributes[:'homepage']
147
+ self.homepage = attributes[:'homepage']
148
+ end
149
+
150
+ if attributes[:'logo_image']
151
+ self.logo_image = attributes[:'logo_image']
152
+ end
153
+
154
+ if attributes[:'banner_image']
155
+ self.banner_image = attributes[:'banner_image']
156
+ end
157
+
158
+ if attributes[:'thumbnail_image']
159
+ self.thumbnail_image = attributes[:'thumbnail_image']
160
+ end
161
+
162
+ if attributes[:'tools']
163
+ self.tools = attributes[:'tools']
164
+ end
165
+
166
+ if attributes[:'members']
167
+ if (value = attributes[:'members']).is_a?(Array)
168
+ self.members = value
169
+ end
170
+ end
171
+
172
+ end
173
+
174
+ # Check equality by comparing each attribute.
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ id == o.id &&
179
+ name == o.name &&
180
+ display_name == o.display_name &&
181
+ last_update == o.last_update &&
182
+ description == o.description &&
183
+ description_html == o.description_html &&
184
+ start_date == o.start_date &&
185
+ license == o.license &&
186
+ license_other == o.license_other &&
187
+ url == o.url &&
188
+ homepage == o.homepage &&
189
+ logo_image == o.logo_image &&
190
+ banner_image == o.banner_image &&
191
+ thumbnail_image == o.thumbnail_image &&
192
+ tools == o.tools &&
193
+ members == o.members
194
+ end
195
+
196
+ # @see the `==` method
197
+ def eql?(o)
198
+ self == o
199
+ end
200
+
201
+ # Calculate hash code according to all attributes.
202
+ def hash
203
+ [id, name, display_name, last_update, description, description_html, start_date, license, license_other, url, homepage, logo_image, banner_image, thumbnail_image, tools, members].hash
204
+ end
205
+
206
+ # build the object from hash
207
+ def build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ self.class.swagger_types.each_pair do |key, type|
210
+ if type =~ /^Array<(.*)>/i
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
213
+ else
214
+ #TODO show warning in debug mode
215
+ end
216
+ elsif !attributes[self.class.attribute_map[key]].nil?
217
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
218
+ else
219
+ # data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+ end
222
+
223
+ self
224
+ end
225
+
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :BOOLEAN
239
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ _model = OSDNClient.const_get(type).new
257
+ _model.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_body (backward compatibility))
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # return the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ next if value.nil?
276
+ hash[param] = _to_hash(value)
277
+ end
278
+ hash
279
+ end
280
+
281
+ # Method to output non-array value in the form of hash
282
+ # For object, use to_hash. Otherwise, just return the value
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map{ |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+ end
@@ -0,0 +1,236 @@
1
+ require 'date'
2
+
3
+ module OSDNClient
4
+ class GroupToolFlags
5
+ attr_accessor :cvs
6
+
7
+ attr_accessor :git
8
+
9
+ attr_accessor :svn
10
+
11
+ attr_accessor :bzr
12
+
13
+ attr_accessor :scm
14
+
15
+ attr_accessor :frs
16
+
17
+ attr_accessor :tikcet
18
+
19
+ attr_accessor :wiki
20
+
21
+ attr_accessor :forum
22
+
23
+ attr_accessor :ml
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+
29
+ :'cvs' => :'cvs',
30
+
31
+ :'git' => :'git',
32
+
33
+ :'svn' => :'svn',
34
+
35
+ :'bzr' => :'bzr',
36
+
37
+ :'scm' => :'scm',
38
+
39
+ :'frs' => :'frs',
40
+
41
+ :'tikcet' => :'tikcet',
42
+
43
+ :'wiki' => :'wiki',
44
+
45
+ :'forum' => :'forum',
46
+
47
+ :'ml' => :'ml'
48
+
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'cvs' => :'BOOLEAN',
56
+ :'git' => :'BOOLEAN',
57
+ :'svn' => :'BOOLEAN',
58
+ :'bzr' => :'BOOLEAN',
59
+ :'scm' => :'BOOLEAN',
60
+ :'frs' => :'BOOLEAN',
61
+ :'tikcet' => :'BOOLEAN',
62
+ :'wiki' => :'BOOLEAN',
63
+ :'forum' => :'BOOLEAN',
64
+ :'ml' => :'BOOLEAN'
65
+
66
+ }
67
+ end
68
+
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
74
+
75
+
76
+ if attributes[:'cvs']
77
+ self.cvs = attributes[:'cvs']
78
+ end
79
+
80
+ if attributes[:'git']
81
+ self.git = attributes[:'git']
82
+ end
83
+
84
+ if attributes[:'svn']
85
+ self.svn = attributes[:'svn']
86
+ end
87
+
88
+ if attributes[:'bzr']
89
+ self.bzr = attributes[:'bzr']
90
+ end
91
+
92
+ if attributes[:'scm']
93
+ self.scm = attributes[:'scm']
94
+ end
95
+
96
+ if attributes[:'frs']
97
+ self.frs = attributes[:'frs']
98
+ end
99
+
100
+ if attributes[:'tikcet']
101
+ self.tikcet = attributes[:'tikcet']
102
+ end
103
+
104
+ if attributes[:'wiki']
105
+ self.wiki = attributes[:'wiki']
106
+ end
107
+
108
+ if attributes[:'forum']
109
+ self.forum = attributes[:'forum']
110
+ end
111
+
112
+ if attributes[:'ml']
113
+ self.ml = attributes[:'ml']
114
+ end
115
+
116
+ end
117
+
118
+ # Check equality by comparing each attribute.
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ cvs == o.cvs &&
123
+ git == o.git &&
124
+ svn == o.svn &&
125
+ bzr == o.bzr &&
126
+ scm == o.scm &&
127
+ frs == o.frs &&
128
+ tikcet == o.tikcet &&
129
+ wiki == o.wiki &&
130
+ forum == o.forum &&
131
+ ml == o.ml
132
+ end
133
+
134
+ # @see the `==` method
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculate hash code according to all attributes.
140
+ def hash
141
+ [cvs, git, svn, bzr, scm, frs, tikcet, wiki, forum, ml].hash
142
+ end
143
+
144
+ # build the object from hash
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.swagger_types.each_pair do |key, type|
148
+ if type =~ /^Array<(.*)>/i
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
+ else
152
+ #TODO show warning in debug mode
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ else
157
+ # data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+ end
160
+
161
+ self
162
+ end
163
+
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 /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ _model = OSDNClient.const_get(type).new
195
+ _model.build_from_hash(value)
196
+ end
197
+ end
198
+
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_body (backward compatibility))
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # return the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Method to output non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map{ |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+ end