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