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,176 @@
1
+ require 'date'
2
+
3
+ module OSDNClient
4
+ class Skill
5
+ attr_accessor :name
6
+
7
+ attr_accessor :level
8
+
9
+ attr_accessor :experience
10
+
11
+ attr_accessor :hate_like
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+
17
+ :'name' => :'name',
18
+
19
+ :'level' => :'level',
20
+
21
+ :'experience' => :'experience',
22
+
23
+ :'hate_like' => :'hate_like'
24
+
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'name' => :'String',
32
+ :'level' => :'Integer',
33
+ :'experience' => :'String',
34
+ :'hate_like' => :'Integer'
35
+
36
+ }
37
+ end
38
+
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
44
+
45
+
46
+ if attributes[:'name']
47
+ self.name = attributes[:'name']
48
+ end
49
+
50
+ if attributes[:'level']
51
+ self.level = attributes[:'level']
52
+ end
53
+
54
+ if attributes[:'experience']
55
+ self.experience = attributes[:'experience']
56
+ end
57
+
58
+ if attributes[:'hate_like']
59
+ self.hate_like = attributes[:'hate_like']
60
+ end
61
+
62
+ end
63
+
64
+ # Check equality by comparing each attribute.
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ name == o.name &&
69
+ level == o.level &&
70
+ experience == o.experience &&
71
+ hate_like == o.hate_like
72
+ end
73
+
74
+ # @see the `==` method
75
+ def eql?(o)
76
+ self == o
77
+ end
78
+
79
+ # Calculate hash code according to all attributes.
80
+ def hash
81
+ [name, level, experience, hate_like].hash
82
+ end
83
+
84
+ # build the object from hash
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /^Array<(.*)>/i
89
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
90
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
91
+ else
92
+ #TODO show warning in debug mode
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ 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
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ def _deserialize(type, value)
105
+ case type.to_sym
106
+ when :DateTime
107
+ DateTime.parse(value)
108
+ when :Date
109
+ Date.parse(value)
110
+ when :String
111
+ value.to_s
112
+ when :Integer
113
+ value.to_i
114
+ when :Float
115
+ value.to_f
116
+ when :BOOLEAN
117
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
118
+ true
119
+ else
120
+ false
121
+ end
122
+ when /\AArray<(?<inner_type>.+)>\z/
123
+ inner_type = Regexp.last_match[:inner_type]
124
+ value.map { |v| _deserialize(inner_type, v) }
125
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
126
+ k_type = Regexp.last_match[:k_type]
127
+ v_type = Regexp.last_match[:v_type]
128
+ {}.tap do |hash|
129
+ value.each do |k, v|
130
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
131
+ end
132
+ end
133
+ else # model
134
+ _model = OSDNClient.const_get(type).new
135
+ _model.build_from_hash(value)
136
+ end
137
+ end
138
+
139
+ def to_s
140
+ to_hash.to_s
141
+ end
142
+
143
+ # to_body is an alias to to_body (backward compatibility))
144
+ def to_body
145
+ to_hash
146
+ end
147
+
148
+ # return the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Method to output non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ def _to_hash(value)
162
+ if value.is_a?(Array)
163
+ value.compact.map{ |v| _to_hash(v) }
164
+ elsif value.is_a?(Hash)
165
+ {}.tap do |hash|
166
+ value.each { |k, v| hash[k] = _to_hash(v) }
167
+ end
168
+ elsif value.respond_to? :to_hash
169
+ value.to_hash
170
+ else
171
+ value
172
+ end
173
+ end
174
+
175
+ end
176
+ end
@@ -0,0 +1,186 @@
1
+ require 'date'
2
+
3
+ module OSDNClient
4
+ class Token
5
+ attr_accessor :access_token
6
+
7
+ attr_accessor :expires_in
8
+
9
+ attr_accessor :token_type
10
+
11
+ attr_accessor :scope
12
+
13
+ attr_accessor :refresh_token
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+
19
+ :'access_token' => :'access_token',
20
+
21
+ :'expires_in' => :'expires_in',
22
+
23
+ :'token_type' => :'token_type',
24
+
25
+ :'scope' => :'scope',
26
+
27
+ :'refresh_token' => :'refresh_token'
28
+
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'access_token' => :'String',
36
+ :'expires_in' => :'Integer',
37
+ :'token_type' => :'String',
38
+ :'scope' => :'String',
39
+ :'refresh_token' => :'String'
40
+
41
+ }
42
+ end
43
+
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ # convert string to symbol for hash key
48
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
49
+
50
+
51
+ if attributes[:'access_token']
52
+ self.access_token = attributes[:'access_token']
53
+ end
54
+
55
+ if attributes[:'expires_in']
56
+ self.expires_in = attributes[:'expires_in']
57
+ end
58
+
59
+ if attributes[:'token_type']
60
+ self.token_type = attributes[:'token_type']
61
+ end
62
+
63
+ if attributes[:'scope']
64
+ self.scope = attributes[:'scope']
65
+ end
66
+
67
+ if attributes[:'refresh_token']
68
+ self.refresh_token = attributes[:'refresh_token']
69
+ end
70
+
71
+ end
72
+
73
+ # Check equality by comparing each attribute.
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ access_token == o.access_token &&
78
+ expires_in == o.expires_in &&
79
+ token_type == o.token_type &&
80
+ scope == o.scope &&
81
+ refresh_token == o.refresh_token
82
+ end
83
+
84
+ # @see the `==` method
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculate hash code according to all attributes.
90
+ def hash
91
+ [access_token, expires_in, token_type, scope, refresh_token].hash
92
+ end
93
+
94
+ # build the object from hash
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /^Array<(.*)>/i
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
101
+ else
102
+ #TODO show warning in debug mode
103
+ end
104
+ elsif !attributes[self.class.attribute_map[key]].nil?
105
+ 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
109
+ end
110
+
111
+ self
112
+ end
113
+
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when /\AArray<(?<inner_type>.+)>\z/
133
+ inner_type = Regexp.last_match[:inner_type]
134
+ value.map { |v| _deserialize(inner_type, v) }
135
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
136
+ k_type = Regexp.last_match[:k_type]
137
+ v_type = Regexp.last_match[:v_type]
138
+ {}.tap do |hash|
139
+ value.each do |k, v|
140
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
141
+ end
142
+ end
143
+ else # model
144
+ _model = OSDNClient.const_get(type).new
145
+ _model.build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ def to_s
150
+ to_hash.to_s
151
+ end
152
+
153
+ # to_body is an alias to to_body (backward compatibility))
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # return the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Method to output non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map{ |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+ end
@@ -0,0 +1,272 @@
1
+ require 'date'
2
+
3
+ module OSDNClient
4
+ class User
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :display_name
10
+
11
+ attr_accessor :unix_status
12
+
13
+ attr_accessor :unix_uid
14
+
15
+ attr_accessor :authorized_keys
16
+
17
+ attr_accessor :timezone
18
+
19
+ attr_accessor :last_update
20
+
21
+ attr_accessor :add_date
22
+
23
+ attr_accessor :language
24
+
25
+ attr_accessor :groups
26
+
27
+ attr_accessor :chambers
28
+
29
+ attr_accessor :skills
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+
35
+ :'id' => :'id',
36
+
37
+ :'name' => :'name',
38
+
39
+ :'display_name' => :'display_name',
40
+
41
+ :'unix_status' => :'unix_status',
42
+
43
+ :'unix_uid' => :'unix_uid',
44
+
45
+ :'authorized_keys' => :'authorized_keys',
46
+
47
+ :'timezone' => :'timezone',
48
+
49
+ :'last_update' => :'last_update',
50
+
51
+ :'add_date' => :'add_date',
52
+
53
+ :'language' => :'language',
54
+
55
+ :'groups' => :'groups',
56
+
57
+ :'chambers' => :'chambers',
58
+
59
+ :'skills' => :'skills'
60
+
61
+ }
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ {
67
+ :'id' => :'Integer',
68
+ :'name' => :'String',
69
+ :'display_name' => :'String',
70
+ :'unix_status' => :'BOOLEAN',
71
+ :'unix_uid' => :'Integer',
72
+ :'authorized_keys' => :'String',
73
+ :'timezone' => :'String',
74
+ :'last_update' => :'DateTime',
75
+ :'add_date' => :'DateTime',
76
+ :'language' => :'String',
77
+ :'groups' => :'Array<SimpleGroup>',
78
+ :'chambers' => :'Array<SimpleChamber>',
79
+ :'skills' => :'Array<Skill>'
80
+
81
+ }
82
+ end
83
+
84
+ def initialize(attributes = {})
85
+ return unless attributes.is_a?(Hash)
86
+
87
+ # convert string to symbol for hash key
88
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
89
+
90
+
91
+ if attributes[:'id']
92
+ self.id = attributes[:'id']
93
+ end
94
+
95
+ if attributes[:'name']
96
+ self.name = attributes[:'name']
97
+ end
98
+
99
+ if attributes[:'display_name']
100
+ self.display_name = attributes[:'display_name']
101
+ end
102
+
103
+ if attributes[:'unix_status']
104
+ self.unix_status = attributes[:'unix_status']
105
+ end
106
+
107
+ if attributes[:'unix_uid']
108
+ self.unix_uid = attributes[:'unix_uid']
109
+ end
110
+
111
+ if attributes[:'authorized_keys']
112
+ self.authorized_keys = attributes[:'authorized_keys']
113
+ end
114
+
115
+ if attributes[:'timezone']
116
+ self.timezone = attributes[:'timezone']
117
+ end
118
+
119
+ if attributes[:'last_update']
120
+ self.last_update = attributes[:'last_update']
121
+ end
122
+
123
+ if attributes[:'add_date']
124
+ self.add_date = attributes[:'add_date']
125
+ end
126
+
127
+ if attributes[:'language']
128
+ self.language = attributes[:'language']
129
+ end
130
+
131
+ if attributes[:'groups']
132
+ if (value = attributes[:'groups']).is_a?(Array)
133
+ self.groups = value
134
+ end
135
+ end
136
+
137
+ if attributes[:'chambers']
138
+ if (value = attributes[:'chambers']).is_a?(Array)
139
+ self.chambers = value
140
+ end
141
+ end
142
+
143
+ if attributes[:'skills']
144
+ if (value = attributes[:'skills']).is_a?(Array)
145
+ self.skills = value
146
+ end
147
+ end
148
+
149
+ end
150
+
151
+ # Check equality by comparing each attribute.
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ id == o.id &&
156
+ name == o.name &&
157
+ display_name == o.display_name &&
158
+ unix_status == o.unix_status &&
159
+ unix_uid == o.unix_uid &&
160
+ authorized_keys == o.authorized_keys &&
161
+ timezone == o.timezone &&
162
+ last_update == o.last_update &&
163
+ add_date == o.add_date &&
164
+ language == o.language &&
165
+ groups == o.groups &&
166
+ chambers == o.chambers &&
167
+ skills == o.skills
168
+ end
169
+
170
+ # @see the `==` method
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculate hash code according to all attributes.
176
+ def hash
177
+ [id, name, display_name, unix_status, unix_uid, authorized_keys, timezone, last_update, add_date, language, groups, chambers, skills].hash
178
+ end
179
+
180
+ # build the object from hash
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ self.class.swagger_types.each_pair do |key, type|
184
+ if type =~ /^Array<(.*)>/i
185
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
186
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
187
+ else
188
+ #TODO show warning in debug mode
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ 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
195
+ end
196
+
197
+ self
198
+ end
199
+
200
+ def _deserialize(type, value)
201
+ case type.to_sym
202
+ when :DateTime
203
+ DateTime.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :BOOLEAN
213
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ _model = OSDNClient.const_get(type).new
231
+ _model.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_body (backward compatibility))
240
+ def to_body
241
+ to_hash
242
+ end
243
+
244
+ # return the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ next if value.nil?
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Method to output non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map{ |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+
271
+ end
272
+ end