osdn-client 0.0.20161003 → 0.0.20171120

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +168 -6
  3. data/docs/FrsAdminPrefs.md +9 -0
  4. data/docs/Group.md +1 -3
  5. data/docs/GroupProfile.md +10 -0
  6. data/docs/GroupProfilePerLanguage.md +10 -0
  7. data/docs/GroupToolFlags.md +1 -2
  8. data/docs/History.md +15 -0
  9. data/docs/I18NText.md +9 -0
  10. data/docs/ProjectApi.md +4021 -209
  11. data/docs/ProjectBzr.md +22 -0
  12. data/docs/ProjectFrsApi.md +118 -4
  13. data/docs/ProjectGit.md +27 -0
  14. data/docs/ProjectHg.md +22 -0
  15. data/docs/ProjectSCM.md +22 -0
  16. data/docs/ProjectSCMApi.md +1214 -0
  17. data/docs/ProjectSCMLastCommit.md +11 -0
  18. data/docs/ProjectSvn.md +25 -0
  19. data/docs/ProjectTicketApi.md +1847 -0
  20. data/docs/ProjectTicketComment.md +13 -0
  21. data/docs/ProjectTicketComponent.md +14 -0
  22. data/docs/ProjectTicketComponentSummary.md +10 -0
  23. data/docs/ProjectTicketComponentSummarySummarizedBy.md +12 -0
  24. data/docs/ProjectTicketHistory.md +14 -0
  25. data/docs/ProjectTicketItem.md +25 -0
  26. data/docs/ProjectTicketMilestone.md +14 -0
  27. data/docs/ProjectTicketMilestoneSummary.md +10 -0
  28. data/docs/ProjectTicketMilestoneSummarySummarizedBy.md +12 -0
  29. data/docs/ProjectTicketPrefs.md +13 -0
  30. data/docs/ProjectTicketType.md +15 -0
  31. data/docs/ProjectTicketTypeInstructionPerLanguage.md +9 -0
  32. data/docs/ProjectTicketTypeInstructions.md +9 -0
  33. data/docs/ProjectTicketTypeSummary.md +10 -0
  34. data/docs/ProjectTicketTypeSummarySummarizedBy.md +12 -0
  35. data/docs/ProjectWeb.md +8 -0
  36. data/docs/ScmHook.md +18 -0
  37. data/docs/SummariadByComponent.md +7 -0
  38. data/docs/SummariadByComponentInner.md +10 -0
  39. data/docs/SummariadByMilestone.md +7 -0
  40. data/docs/SummariadByMilestoneInner.md +10 -0
  41. data/docs/SummariadByOwner.md +7 -0
  42. data/docs/SummariadByOwnerInner.md +10 -0
  43. data/docs/SummariadByPriority.md +7 -0
  44. data/docs/SummariadByPriorityInner.md +10 -0
  45. data/docs/SummariadBySeverity.md +7 -0
  46. data/docs/SummariadBySeverityInner.md +10 -0
  47. data/docs/SummariadByType.md +7 -0
  48. data/docs/SummariadByTypeInner.md +10 -0
  49. data/docs/User.md +5 -3
  50. data/docs/UserApi.md +279 -0
  51. data/docs/UserImages.md +12 -0
  52. data/docs/UserStats.md +33 -0
  53. data/lib/osdn-client.rb +45 -1
  54. data/lib/osdn-client/api/default_api.rb +1 -1
  55. data/lib/osdn-client/api/project_api.rb +4574 -396
  56. data/lib/osdn-client/api/project_frs_api.rb +122 -5
  57. data/lib/osdn-client/api/project_news_api.rb +1 -1
  58. data/lib/osdn-client/api/project_scm_api.rb +1310 -0
  59. data/lib/osdn-client/api/project_ticket_api.rb +2124 -0
  60. data/lib/osdn-client/api/user_api.rb +294 -1
  61. data/lib/osdn-client/api_client.rb +1 -1
  62. data/lib/osdn-client/api_error.rb +1 -1
  63. data/lib/osdn-client/configuration.rb +1 -1
  64. data/lib/osdn-client/models/frs_admin_prefs.rb +208 -0
  65. data/lib/osdn-client/models/group.rb +8 -26
  66. data/lib/osdn-client/models/group_profile.rb +223 -0
  67. data/lib/osdn-client/models/group_profile_per_language.rb +217 -0
  68. data/lib/osdn-client/models/group_tool_flags.rb +11 -20
  69. data/lib/osdn-client/models/history.rb +262 -0
  70. data/lib/osdn-client/models/i18_n_text.rb +208 -0
  71. data/lib/osdn-client/models/news.rb +1 -1
  72. data/lib/osdn-client/models/package.rb +1 -1
  73. data/lib/osdn-client/models/pong.rb +1 -1
  74. data/lib/osdn-client/models/project_bzr.rb +329 -0
  75. data/lib/osdn-client/models/project_git.rb +374 -0
  76. data/lib/osdn-client/models/project_hg.rb +329 -0
  77. data/lib/osdn-client/models/project_scm.rb +329 -0
  78. data/lib/osdn-client/models/project_scm_last_commit.rb +226 -0
  79. data/lib/osdn-client/models/project_svn.rb +356 -0
  80. data/lib/osdn-client/models/project_ticket_comment.rb +244 -0
  81. data/lib/osdn-client/models/project_ticket_component.rb +253 -0
  82. data/lib/osdn-client/models/project_ticket_component_summary.rb +217 -0
  83. data/lib/osdn-client/models/project_ticket_component_summary_summarized_by.rb +235 -0
  84. data/lib/osdn-client/models/project_ticket_history.rb +253 -0
  85. data/lib/osdn-client/models/project_ticket_item.rb +356 -0
  86. data/lib/osdn-client/models/project_ticket_milestone.rb +253 -0
  87. data/lib/osdn-client/models/project_ticket_milestone_summary.rb +217 -0
  88. data/lib/osdn-client/models/project_ticket_milestone_summary_summarized_by.rb +235 -0
  89. data/lib/osdn-client/models/project_ticket_prefs.rb +244 -0
  90. data/lib/osdn-client/models/project_ticket_type.rb +266 -0
  91. data/lib/osdn-client/models/project_ticket_type_instruction_per_language.rb +208 -0
  92. data/lib/osdn-client/models/project_ticket_type_instructions.rb +212 -0
  93. data/lib/osdn-client/models/project_ticket_type_summary.rb +217 -0
  94. data/lib/osdn-client/models/project_ticket_type_summary_summarized_by.rb +235 -0
  95. data/lib/osdn-client/models/project_web.rb +199 -0
  96. data/lib/osdn-client/models/rel_file.rb +1 -1
  97. data/lib/osdn-client/models/release.rb +1 -1
  98. data/lib/osdn-client/models/scm_hook.rb +289 -0
  99. data/lib/osdn-client/models/simple_chamber.rb +1 -1
  100. data/lib/osdn-client/models/simple_group.rb +1 -1
  101. data/lib/osdn-client/models/simple_user.rb +1 -1
  102. data/lib/osdn-client/models/skill.rb +1 -1
  103. data/lib/osdn-client/models/summariad_by_component.rb +190 -0
  104. data/lib/osdn-client/models/summariad_by_component_inner.rb +217 -0
  105. data/lib/osdn-client/models/summariad_by_milestone.rb +190 -0
  106. data/lib/osdn-client/models/summariad_by_milestone_inner.rb +217 -0
  107. data/lib/osdn-client/models/summariad_by_owner.rb +190 -0
  108. data/lib/osdn-client/models/summariad_by_owner_inner.rb +217 -0
  109. data/lib/osdn-client/models/summariad_by_priority.rb +190 -0
  110. data/lib/osdn-client/models/summariad_by_priority_inner.rb +217 -0
  111. data/lib/osdn-client/models/summariad_by_severity.rb +190 -0
  112. data/lib/osdn-client/models/summariad_by_severity_inner.rb +217 -0
  113. data/lib/osdn-client/models/summariad_by_type.rb +190 -0
  114. data/lib/osdn-client/models/summariad_by_type_inner.rb +217 -0
  115. data/lib/osdn-client/models/token.rb +1 -1
  116. data/lib/osdn-client/models/user.rb +38 -18
  117. data/lib/osdn-client/models/user_images.rb +235 -0
  118. data/lib/osdn-client/models/user_stats.rb +424 -0
  119. data/lib/osdn-client/version.rb +2 -2
  120. data/osdn-client.gemspec +1 -1
  121. data/spec/api/default_api_spec.rb +1 -1
  122. data/spec/api/project_api_spec.rb +899 -3
  123. data/spec/api/project_frs_api_spec.rb +28 -3
  124. data/spec/api/project_news_api_spec.rb +1 -1
  125. data/spec/api/project_scm_api_spec.rb +324 -0
  126. data/spec/api/project_ticket_api_spec.rb +488 -0
  127. data/spec/api/user_api_spec.rb +63 -1
  128. data/spec/api_client_spec.rb +1 -1
  129. data/spec/configuration_spec.rb +1 -1
  130. data/spec/models/frs_admin_prefs_spec.rb +59 -0
  131. data/spec/models/group_profile_per_language_spec.rb +65 -0
  132. data/spec/models/group_profile_spec.rb +65 -0
  133. data/spec/models/group_spec.rb +2 -14
  134. data/spec/models/group_tool_flags_spec.rb +3 -9
  135. data/spec/models/history_spec.rb +95 -0
  136. data/spec/models/i18_n_text_spec.rb +59 -0
  137. data/spec/models/news_spec.rb +1 -1
  138. data/spec/models/package_spec.rb +1 -1
  139. data/spec/models/pong_spec.rb +1 -1
  140. data/spec/models/project_bzr_spec.rb +137 -0
  141. data/spec/models/project_git_spec.rb +167 -0
  142. data/spec/models/project_hg_spec.rb +137 -0
  143. data/spec/models/project_scm_last_commit_spec.rb +71 -0
  144. data/spec/models/project_scm_spec.rb +137 -0
  145. data/spec/models/project_svn_spec.rb +155 -0
  146. data/spec/models/project_ticket_comment_spec.rb +83 -0
  147. data/spec/models/project_ticket_component_spec.rb +89 -0
  148. data/spec/models/project_ticket_component_summary_spec.rb +65 -0
  149. data/spec/models/project_ticket_component_summary_summarized_by_spec.rb +77 -0
  150. data/spec/models/project_ticket_history_spec.rb +89 -0
  151. data/spec/models/project_ticket_item_spec.rb +155 -0
  152. data/spec/models/project_ticket_milestone_spec.rb +89 -0
  153. data/spec/models/project_ticket_milestone_summary_spec.rb +65 -0
  154. data/spec/models/project_ticket_milestone_summary_summarized_by_spec.rb +77 -0
  155. data/spec/models/project_ticket_prefs_spec.rb +83 -0
  156. data/spec/models/project_ticket_type_instruction_per_language_spec.rb +59 -0
  157. data/spec/models/project_ticket_type_instructions_spec.rb +59 -0
  158. data/spec/models/project_ticket_type_spec.rb +95 -0
  159. data/spec/models/project_ticket_type_summary_spec.rb +65 -0
  160. data/spec/models/project_ticket_type_summary_summarized_by_spec.rb +77 -0
  161. data/spec/models/project_web_spec.rb +53 -0
  162. data/spec/models/rel_file_spec.rb +1 -1
  163. data/spec/models/release_spec.rb +1 -1
  164. data/spec/models/scm_hook_spec.rb +113 -0
  165. data/spec/models/simple_chamber_spec.rb +1 -1
  166. data/spec/models/simple_group_spec.rb +1 -1
  167. data/spec/models/simple_user_spec.rb +1 -1
  168. data/spec/models/skill_spec.rb +1 -1
  169. data/spec/models/summariad_by_component_inner_spec.rb +65 -0
  170. data/spec/models/summariad_by_component_spec.rb +47 -0
  171. data/spec/models/summariad_by_milestone_inner_spec.rb +65 -0
  172. data/spec/models/summariad_by_milestone_spec.rb +47 -0
  173. data/spec/models/summariad_by_owner_inner_spec.rb +65 -0
  174. data/spec/models/summariad_by_owner_spec.rb +47 -0
  175. data/spec/models/summariad_by_priority_inner_spec.rb +65 -0
  176. data/spec/models/summariad_by_priority_spec.rb +47 -0
  177. data/spec/models/summariad_by_severity_inner_spec.rb +65 -0
  178. data/spec/models/summariad_by_severity_spec.rb +47 -0
  179. data/spec/models/summariad_by_type_inner_spec.rb +65 -0
  180. data/spec/models/summariad_by_type_spec.rb +47 -0
  181. data/spec/models/token_spec.rb +1 -1
  182. data/spec/models/user_images_spec.rb +77 -0
  183. data/spec/models/user_spec.rb +16 -4
  184. data/spec/models/user_stats_spec.rb +203 -0
  185. data/spec/spec_helper.rb +1 -1
  186. metadata +179 -3
@@ -0,0 +1,329 @@
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.net/projects/osdn-codes/wiki/APIGuide and you can get client libraries from https://osdn.net/projects/osdn-codes/releases/p14859 .
5
+
6
+ OpenAPI spec version: 0.0.20171120
7
+ Contact: admin@osdn.net
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
+
24
+ require 'date'
25
+
26
+ module OSDNClient
27
+
28
+ class ProjectHg
29
+ attr_accessor :id
30
+
31
+ attr_accessor :created
32
+
33
+ attr_accessor :active
34
+
35
+ attr_accessor :setting_applied
36
+
37
+ attr_accessor :name
38
+
39
+ attr_accessor :description
40
+
41
+ attr_accessor :type
42
+
43
+ attr_accessor :mail_enabled
44
+
45
+ attr_accessor :mail_recipients
46
+
47
+ attr_accessor :url_viewer
48
+
49
+ attr_accessor :url_rw
50
+
51
+ attr_accessor :url_ro
52
+
53
+ attr_accessor :last_commit
54
+
55
+ attr_accessor :branches
56
+
57
+ attr_accessor :tags
58
+
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'created' => :'created',
65
+ :'active' => :'active',
66
+ :'setting_applied' => :'setting_applied',
67
+ :'name' => :'name',
68
+ :'description' => :'description',
69
+ :'type' => :'type',
70
+ :'mail_enabled' => :'mail_enabled',
71
+ :'mail_recipients' => :'mail_recipients',
72
+ :'url_viewer' => :'url_viewer',
73
+ :'url_rw' => :'url_rw',
74
+ :'url_ro' => :'url_ro',
75
+ :'last_commit' => :'last_commit',
76
+ :'branches' => :'branches',
77
+ :'tags' => :'tags'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'id' => :'Integer',
85
+ :'created' => :'BOOLEAN',
86
+ :'active' => :'BOOLEAN',
87
+ :'setting_applied' => :'BOOLEAN',
88
+ :'name' => :'String',
89
+ :'description' => :'String',
90
+ :'type' => :'String',
91
+ :'mail_enabled' => :'BOOLEAN',
92
+ :'mail_recipients' => :'String',
93
+ :'url_viewer' => :'String',
94
+ :'url_rw' => :'String',
95
+ :'url_ro' => :'String',
96
+ :'last_commit' => :'ProjectSCMLastCommit',
97
+ :'branches' => :'Array<String>',
98
+ :'tags' => :'Array<String>'
99
+ }
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ return unless attributes.is_a?(Hash)
106
+
107
+ # convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
109
+
110
+ if attributes.has_key?(:'id')
111
+ self.id = attributes[:'id']
112
+ end
113
+
114
+ if attributes.has_key?(:'created')
115
+ self.created = attributes[:'created']
116
+ end
117
+
118
+ if attributes.has_key?(:'active')
119
+ self.active = attributes[:'active']
120
+ end
121
+
122
+ if attributes.has_key?(:'setting_applied')
123
+ self.setting_applied = attributes[:'setting_applied']
124
+ end
125
+
126
+ if attributes.has_key?(:'name')
127
+ self.name = attributes[:'name']
128
+ end
129
+
130
+ if attributes.has_key?(:'description')
131
+ self.description = attributes[:'description']
132
+ end
133
+
134
+ if attributes.has_key?(:'type')
135
+ self.type = attributes[:'type']
136
+ end
137
+
138
+ if attributes.has_key?(:'mail_enabled')
139
+ self.mail_enabled = attributes[:'mail_enabled']
140
+ end
141
+
142
+ if attributes.has_key?(:'mail_recipients')
143
+ self.mail_recipients = attributes[:'mail_recipients']
144
+ end
145
+
146
+ if attributes.has_key?(:'url_viewer')
147
+ self.url_viewer = attributes[:'url_viewer']
148
+ end
149
+
150
+ if attributes.has_key?(:'url_rw')
151
+ self.url_rw = attributes[:'url_rw']
152
+ end
153
+
154
+ if attributes.has_key?(:'url_ro')
155
+ self.url_ro = attributes[:'url_ro']
156
+ end
157
+
158
+ if attributes.has_key?(:'last_commit')
159
+ self.last_commit = attributes[:'last_commit']
160
+ end
161
+
162
+ if attributes.has_key?(:'branches')
163
+ if (value = attributes[:'branches']).is_a?(Array)
164
+ self.branches = value
165
+ end
166
+ end
167
+
168
+ if attributes.has_key?(:'tags')
169
+ if (value = attributes[:'tags']).is_a?(Array)
170
+ self.tags = value
171
+ end
172
+ end
173
+
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properies with the reasons
178
+ def list_invalid_properties
179
+ invalid_properties = Array.new
180
+ return invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ return true
187
+ end
188
+
189
+ # Checks equality by comparing each attribute.
190
+ # @param [Object] Object to be compared
191
+ def ==(o)
192
+ return true if self.equal?(o)
193
+ self.class == o.class &&
194
+ id == o.id &&
195
+ created == o.created &&
196
+ active == o.active &&
197
+ setting_applied == o.setting_applied &&
198
+ name == o.name &&
199
+ description == o.description &&
200
+ type == o.type &&
201
+ mail_enabled == o.mail_enabled &&
202
+ mail_recipients == o.mail_recipients &&
203
+ url_viewer == o.url_viewer &&
204
+ url_rw == o.url_rw &&
205
+ url_ro == o.url_ro &&
206
+ last_commit == o.last_commit &&
207
+ branches == o.branches &&
208
+ tags == o.tags
209
+ end
210
+
211
+ # @see the `==` method
212
+ # @param [Object] Object to be compared
213
+ def eql?(o)
214
+ self == o
215
+ end
216
+
217
+ # Calculates hash code according to all attributes.
218
+ # @return [Fixnum] Hash code
219
+ def hash
220
+ [id, created, active, setting_applied, name, description, type, mail_enabled, mail_recipients, url_viewer, url_rw, url_ro, last_commit, branches, tags].hash
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def build_from_hash(attributes)
227
+ return nil unless attributes.is_a?(Hash)
228
+ self.class.swagger_types.each_pair do |key, type|
229
+ if type =~ /^Array<(.*)>/i
230
+ # check to ensure the input is an array given that the the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :DateTime
250
+ DateTime.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :BOOLEAN
260
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ temp_model = OSDNClient.const_get(type).new
281
+ temp_model.build_from_hash(value)
282
+ end
283
+ end
284
+
285
+ # Returns the string representation of the object
286
+ # @return [String] String presentation of the object
287
+ def to_s
288
+ to_hash.to_s
289
+ end
290
+
291
+ # to_body is an alias to to_hash (backward compatibility)
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_body
294
+ to_hash
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ next if value.nil?
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map{ |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -0,0 +1,329 @@
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.net/projects/osdn-codes/wiki/APIGuide and you can get client libraries from https://osdn.net/projects/osdn-codes/releases/p14859 .
5
+
6
+ OpenAPI spec version: 0.0.20171120
7
+ Contact: admin@osdn.net
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
+
24
+ require 'date'
25
+
26
+ module OSDNClient
27
+
28
+ class ProjectSCM
29
+ attr_accessor :id
30
+
31
+ attr_accessor :created
32
+
33
+ attr_accessor :active
34
+
35
+ attr_accessor :setting_applied
36
+
37
+ attr_accessor :name
38
+
39
+ attr_accessor :description
40
+
41
+ attr_accessor :type
42
+
43
+ attr_accessor :mail_enabled
44
+
45
+ attr_accessor :mail_recipients
46
+
47
+ attr_accessor :url_viewer
48
+
49
+ attr_accessor :url_rw
50
+
51
+ attr_accessor :url_ro
52
+
53
+ attr_accessor :last_commit
54
+
55
+ attr_accessor :branches
56
+
57
+ attr_accessor :tags
58
+
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'created' => :'created',
65
+ :'active' => :'active',
66
+ :'setting_applied' => :'setting_applied',
67
+ :'name' => :'name',
68
+ :'description' => :'description',
69
+ :'type' => :'type',
70
+ :'mail_enabled' => :'mail_enabled',
71
+ :'mail_recipients' => :'mail_recipients',
72
+ :'url_viewer' => :'url_viewer',
73
+ :'url_rw' => :'url_rw',
74
+ :'url_ro' => :'url_ro',
75
+ :'last_commit' => :'last_commit',
76
+ :'branches' => :'branches',
77
+ :'tags' => :'tags'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'id' => :'Integer',
85
+ :'created' => :'BOOLEAN',
86
+ :'active' => :'BOOLEAN',
87
+ :'setting_applied' => :'BOOLEAN',
88
+ :'name' => :'String',
89
+ :'description' => :'String',
90
+ :'type' => :'String',
91
+ :'mail_enabled' => :'BOOLEAN',
92
+ :'mail_recipients' => :'String',
93
+ :'url_viewer' => :'String',
94
+ :'url_rw' => :'String',
95
+ :'url_ro' => :'String',
96
+ :'last_commit' => :'ProjectSCMLastCommit',
97
+ :'branches' => :'Array<String>',
98
+ :'tags' => :'Array<String>'
99
+ }
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ return unless attributes.is_a?(Hash)
106
+
107
+ # convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
109
+
110
+ if attributes.has_key?(:'id')
111
+ self.id = attributes[:'id']
112
+ end
113
+
114
+ if attributes.has_key?(:'created')
115
+ self.created = attributes[:'created']
116
+ end
117
+
118
+ if attributes.has_key?(:'active')
119
+ self.active = attributes[:'active']
120
+ end
121
+
122
+ if attributes.has_key?(:'setting_applied')
123
+ self.setting_applied = attributes[:'setting_applied']
124
+ end
125
+
126
+ if attributes.has_key?(:'name')
127
+ self.name = attributes[:'name']
128
+ end
129
+
130
+ if attributes.has_key?(:'description')
131
+ self.description = attributes[:'description']
132
+ end
133
+
134
+ if attributes.has_key?(:'type')
135
+ self.type = attributes[:'type']
136
+ end
137
+
138
+ if attributes.has_key?(:'mail_enabled')
139
+ self.mail_enabled = attributes[:'mail_enabled']
140
+ end
141
+
142
+ if attributes.has_key?(:'mail_recipients')
143
+ self.mail_recipients = attributes[:'mail_recipients']
144
+ end
145
+
146
+ if attributes.has_key?(:'url_viewer')
147
+ self.url_viewer = attributes[:'url_viewer']
148
+ end
149
+
150
+ if attributes.has_key?(:'url_rw')
151
+ self.url_rw = attributes[:'url_rw']
152
+ end
153
+
154
+ if attributes.has_key?(:'url_ro')
155
+ self.url_ro = attributes[:'url_ro']
156
+ end
157
+
158
+ if attributes.has_key?(:'last_commit')
159
+ self.last_commit = attributes[:'last_commit']
160
+ end
161
+
162
+ if attributes.has_key?(:'branches')
163
+ if (value = attributes[:'branches']).is_a?(Array)
164
+ self.branches = value
165
+ end
166
+ end
167
+
168
+ if attributes.has_key?(:'tags')
169
+ if (value = attributes[:'tags']).is_a?(Array)
170
+ self.tags = value
171
+ end
172
+ end
173
+
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properies with the reasons
178
+ def list_invalid_properties
179
+ invalid_properties = Array.new
180
+ return invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ return true
187
+ end
188
+
189
+ # Checks equality by comparing each attribute.
190
+ # @param [Object] Object to be compared
191
+ def ==(o)
192
+ return true if self.equal?(o)
193
+ self.class == o.class &&
194
+ id == o.id &&
195
+ created == o.created &&
196
+ active == o.active &&
197
+ setting_applied == o.setting_applied &&
198
+ name == o.name &&
199
+ description == o.description &&
200
+ type == o.type &&
201
+ mail_enabled == o.mail_enabled &&
202
+ mail_recipients == o.mail_recipients &&
203
+ url_viewer == o.url_viewer &&
204
+ url_rw == o.url_rw &&
205
+ url_ro == o.url_ro &&
206
+ last_commit == o.last_commit &&
207
+ branches == o.branches &&
208
+ tags == o.tags
209
+ end
210
+
211
+ # @see the `==` method
212
+ # @param [Object] Object to be compared
213
+ def eql?(o)
214
+ self == o
215
+ end
216
+
217
+ # Calculates hash code according to all attributes.
218
+ # @return [Fixnum] Hash code
219
+ def hash
220
+ [id, created, active, setting_applied, name, description, type, mail_enabled, mail_recipients, url_viewer, url_rw, url_ro, last_commit, branches, tags].hash
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def build_from_hash(attributes)
227
+ return nil unless attributes.is_a?(Hash)
228
+ self.class.swagger_types.each_pair do |key, type|
229
+ if type =~ /^Array<(.*)>/i
230
+ # check to ensure the input is an array given that the the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :DateTime
250
+ DateTime.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :BOOLEAN
260
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ temp_model = OSDNClient.const_get(type).new
281
+ temp_model.build_from_hash(value)
282
+ end
283
+ end
284
+
285
+ # Returns the string representation of the object
286
+ # @return [String] String presentation of the object
287
+ def to_s
288
+ to_hash.to_s
289
+ end
290
+
291
+ # to_body is an alias to to_hash (backward compatibility)
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_body
294
+ to_hash
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ next if value.nil?
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map{ |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end