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,217 @@
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 ProjectTicketComponentSummary
29
+ attr_accessor :open
30
+
31
+ attr_accessor :closed
32
+
33
+ attr_accessor :summarized_by
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'open' => :'open',
40
+ :'closed' => :'closed',
41
+ :'summarized_by' => :'summarized_by'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'open' => :'Integer',
49
+ :'closed' => :'Integer',
50
+ :'summarized_by' => :'ProjectTicketComponentSummarySummarizedBy'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
+
62
+ if attributes.has_key?(:'open')
63
+ self.open = attributes[:'open']
64
+ end
65
+
66
+ if attributes.has_key?(:'closed')
67
+ self.closed = attributes[:'closed']
68
+ end
69
+
70
+ if attributes.has_key?(:'summarized_by')
71
+ self.summarized_by = attributes[:'summarized_by']
72
+ end
73
+
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properies with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ return invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ return true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ open == o.open &&
95
+ closed == o.closed &&
96
+ summarized_by == o.summarized_by
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [open, closed, summarized_by].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /^Array<(.*)>/i
118
+ # check to ensure the input is an array given that the the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = OSDNClient.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map{ |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,235 @@
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 ProjectTicketComponentSummarySummarizedBy
29
+ attr_accessor :owner
30
+
31
+ attr_accessor :component
32
+
33
+ attr_accessor :milestone
34
+
35
+ attr_accessor :priority
36
+
37
+ attr_accessor :severity
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'owner' => :'owner',
44
+ :'component' => :'component',
45
+ :'milestone' => :'milestone',
46
+ :'priority' => :'priority',
47
+ :'severity' => :'severity'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'owner' => :'SummariadByOwner',
55
+ :'component' => :'SummariadByType',
56
+ :'milestone' => :'SummariadByMilestone',
57
+ :'priority' => :'SummariadByPriority',
58
+ :'severity' => :'SummariadBySeverity'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
69
+
70
+ if attributes.has_key?(:'owner')
71
+ self.owner = attributes[:'owner']
72
+ end
73
+
74
+ if attributes.has_key?(:'component')
75
+ self.component = attributes[:'component']
76
+ end
77
+
78
+ if attributes.has_key?(:'milestone')
79
+ self.milestone = attributes[:'milestone']
80
+ end
81
+
82
+ if attributes.has_key?(:'priority')
83
+ self.priority = attributes[:'priority']
84
+ end
85
+
86
+ if attributes.has_key?(:'severity')
87
+ self.severity = attributes[:'severity']
88
+ end
89
+
90
+ end
91
+
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
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ owner == o.owner &&
111
+ component == o.component &&
112
+ milestone == o.milestone &&
113
+ priority == o.priority &&
114
+ severity == o.severity
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Fixnum] Hash code
125
+ def hash
126
+ [owner, component, milestone, priority, severity].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
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
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
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
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
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
+ temp_model = OSDNClient.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
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
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end