alfresco 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/README.md +119 -0
  5. data/Rakefile +8 -0
  6. data/alfresco.gemspec +45 -0
  7. data/docs/ContentInfo.md +12 -0
  8. data/docs/Error.md +8 -0
  9. data/docs/ErrorError.md +13 -0
  10. data/docs/GenericBucket.md +13 -0
  11. data/docs/GenericBucketBucketInfo.md +11 -0
  12. data/docs/GenericFacetResponse.md +10 -0
  13. data/docs/GenericMetric.md +9 -0
  14. data/docs/Node.md +24 -0
  15. data/docs/Pagination.md +12 -0
  16. data/docs/PathElement.md +9 -0
  17. data/docs/PathInfo.md +10 -0
  18. data/docs/RequestDefaults.md +12 -0
  19. data/docs/RequestFacetField.md +18 -0
  20. data/docs/RequestFacetFields.md +8 -0
  21. data/docs/RequestFacetIntervals.md +9 -0
  22. data/docs/RequestFacetIntervalsIntervals.md +10 -0
  23. data/docs/RequestFacetQueries.md +7 -0
  24. data/docs/RequestFacetQueriesInner.md +9 -0
  25. data/docs/RequestFacetSet.md +12 -0
  26. data/docs/RequestFields.md +7 -0
  27. data/docs/RequestFilterQueries.md +7 -0
  28. data/docs/RequestFilterQueriesInner.md +9 -0
  29. data/docs/RequestHighlight.md +15 -0
  30. data/docs/RequestHighlightFields.md +13 -0
  31. data/docs/RequestInclude.md +7 -0
  32. data/docs/RequestLimits.md +9 -0
  33. data/docs/RequestLocalization.md +9 -0
  34. data/docs/RequestPagination.md +9 -0
  35. data/docs/RequestPivot.md +9 -0
  36. data/docs/RequestQuery.md +10 -0
  37. data/docs/RequestRange.md +16 -0
  38. data/docs/RequestScope.md +8 -0
  39. data/docs/RequestSortDefinition.md +7 -0
  40. data/docs/RequestSortDefinitionInner.md +10 -0
  41. data/docs/RequestSpellcheck.md +8 -0
  42. data/docs/RequestStats.md +23 -0
  43. data/docs/RequestTemplates.md +7 -0
  44. data/docs/RequestTemplatesInner.md +9 -0
  45. data/docs/ResponseConsistency.md +8 -0
  46. data/docs/ResultBuckets.md +9 -0
  47. data/docs/ResultBucketsBuckets.md +11 -0
  48. data/docs/ResultNode.md +29 -0
  49. data/docs/ResultSetContext.md +13 -0
  50. data/docs/ResultSetContextFacetQueries.md +10 -0
  51. data/docs/ResultSetContextSpellcheck.md +9 -0
  52. data/docs/ResultSetPaging.md +8 -0
  53. data/docs/ResultSetPagingList.md +10 -0
  54. data/docs/ResultSetRowEntry.md +8 -0
  55. data/docs/SearchApi.md +62 -0
  56. data/docs/SearchEntry.md +9 -0
  57. data/docs/SearchEntryHighlight.md +9 -0
  58. data/docs/SearchRequest.md +27 -0
  59. data/docs/UserInfo.md +9 -0
  60. data/git_push.sh +55 -0
  61. data/lib/alfresco.rb +92 -0
  62. data/lib/alfresco/api/search_api.rb +78 -0
  63. data/lib/alfresco/api_client.rb +389 -0
  64. data/lib/alfresco/api_error.rb +38 -0
  65. data/lib/alfresco/configuration.rb +209 -0
  66. data/lib/alfresco/models/content_info.rb +239 -0
  67. data/lib/alfresco/models/error.rb +188 -0
  68. data/lib/alfresco/models/error_error.rb +253 -0
  69. data/lib/alfresco/models/generic_bucket.rb +242 -0
  70. data/lib/alfresco/models/generic_bucket_bucket_info.rb +219 -0
  71. data/lib/alfresco/models/generic_facet_response.rb +211 -0
  72. data/lib/alfresco/models/generic_metric.rb +199 -0
  73. data/lib/alfresco/models/node.rb +403 -0
  74. data/lib/alfresco/models/pagination.rb +249 -0
  75. data/lib/alfresco/models/path_element.rb +197 -0
  76. data/lib/alfresco/models/path_info.rb +208 -0
  77. data/lib/alfresco/models/request_defaults.rb +283 -0
  78. data/lib/alfresco/models/request_facet_field.rb +333 -0
  79. data/lib/alfresco/models/request_facet_fields.rb +191 -0
  80. data/lib/alfresco/models/request_facet_intervals.rb +203 -0
  81. data/lib/alfresco/models/request_facet_intervals_intervals.rb +211 -0
  82. data/lib/alfresco/models/request_facet_queries.rb +179 -0
  83. data/lib/alfresco/models/request_facet_queries_inner.rb +199 -0
  84. data/lib/alfresco/models/request_facet_set.rb +233 -0
  85. data/lib/alfresco/models/request_fields.rb +179 -0
  86. data/lib/alfresco/models/request_filter_queries.rb +179 -0
  87. data/lib/alfresco/models/request_filter_queries_inner.rb +201 -0
  88. data/lib/alfresco/models/request_highlight.rb +261 -0
  89. data/lib/alfresco/models/request_highlight_fields.rb +234 -0
  90. data/lib/alfresco/models/request_include.rb +179 -0
  91. data/lib/alfresco/models/request_limits.rb +199 -0
  92. data/lib/alfresco/models/request_localization.rb +201 -0
  93. data/lib/alfresco/models/request_pagination.rb +231 -0
  94. data/lib/alfresco/models/request_pivot.rb +200 -0
  95. data/lib/alfresco/models/request_query.rb +249 -0
  96. data/lib/alfresco/models/request_range.rb +275 -0
  97. data/lib/alfresco/models/request_scope.rb +222 -0
  98. data/lib/alfresco/models/request_sort_definition.rb +179 -0
  99. data/lib/alfresco/models/request_sort_definition_inner.rb +246 -0
  100. data/lib/alfresco/models/request_spellcheck.rb +188 -0
  101. data/lib/alfresco/models/request_stats.rb +367 -0
  102. data/lib/alfresco/models/request_templates.rb +179 -0
  103. data/lib/alfresco/models/request_templates_inner.rb +199 -0
  104. data/lib/alfresco/models/response_consistency.rb +189 -0
  105. data/lib/alfresco/models/result_buckets.rb +201 -0
  106. data/lib/alfresco/models/result_buckets_buckets.rb +219 -0
  107. data/lib/alfresco/models/result_node.rb +448 -0
  108. data/lib/alfresco/models/result_set_context.rb +245 -0
  109. data/lib/alfresco/models/result_set_context_facet_queries.rb +207 -0
  110. data/lib/alfresco/models/result_set_context_spellcheck.rb +233 -0
  111. data/lib/alfresco/models/result_set_paging.rb +188 -0
  112. data/lib/alfresco/models/result_set_paging_list.rb +208 -0
  113. data/lib/alfresco/models/result_set_row_entry.rb +193 -0
  114. data/lib/alfresco/models/search_entry.rb +201 -0
  115. data/lib/alfresco/models/search_entry_highlight.rb +201 -0
  116. data/lib/alfresco/models/search_request.rb +373 -0
  117. data/lib/alfresco/models/user_info.rb +207 -0
  118. data/lib/alfresco/version.rb +15 -0
  119. data/spec/api/search_api_spec.rb +47 -0
  120. data/spec/api_client_spec.rb +226 -0
  121. data/spec/configuration_spec.rb +39 -0
  122. data/spec/models/content_info_spec.rb +66 -0
  123. data/spec/models/error_error_spec.rb +72 -0
  124. data/spec/models/error_spec.rb +42 -0
  125. data/spec/models/generic_bucket_bucket_info_spec.rb +60 -0
  126. data/spec/models/generic_bucket_spec.rb +72 -0
  127. data/spec/models/generic_facet_response_spec.rb +54 -0
  128. data/spec/models/generic_metric_spec.rb +48 -0
  129. data/spec/models/node_spec.rb +138 -0
  130. data/spec/models/pagination_spec.rb +66 -0
  131. data/spec/models/path_element_spec.rb +48 -0
  132. data/spec/models/path_info_spec.rb +54 -0
  133. data/spec/models/request_defaults_spec.rb +74 -0
  134. data/spec/models/request_facet_field_spec.rb +110 -0
  135. data/spec/models/request_facet_fields_spec.rb +42 -0
  136. data/spec/models/request_facet_intervals_intervals_spec.rb +54 -0
  137. data/spec/models/request_facet_intervals_spec.rb +48 -0
  138. data/spec/models/request_facet_queries_inner_spec.rb +48 -0
  139. data/spec/models/request_facet_queries_spec.rb +36 -0
  140. data/spec/models/request_facet_set_spec.rb +66 -0
  141. data/spec/models/request_fields_spec.rb +36 -0
  142. data/spec/models/request_filter_queries_inner_spec.rb +48 -0
  143. data/spec/models/request_filter_queries_spec.rb +36 -0
  144. data/spec/models/request_highlight_fields_spec.rb +72 -0
  145. data/spec/models/request_highlight_spec.rb +84 -0
  146. data/spec/models/request_include_spec.rb +36 -0
  147. data/spec/models/request_limits_spec.rb +48 -0
  148. data/spec/models/request_localization_spec.rb +48 -0
  149. data/spec/models/request_pagination_spec.rb +48 -0
  150. data/spec/models/request_pivot_spec.rb +48 -0
  151. data/spec/models/request_query_spec.rb +58 -0
  152. data/spec/models/request_range_spec.rb +90 -0
  153. data/spec/models/request_scope_spec.rb +46 -0
  154. data/spec/models/request_sort_definition_inner_spec.rb +58 -0
  155. data/spec/models/request_sort_definition_spec.rb +36 -0
  156. data/spec/models/request_spellcheck_spec.rb +42 -0
  157. data/spec/models/request_stats_spec.rb +132 -0
  158. data/spec/models/request_templates_inner_spec.rb +48 -0
  159. data/spec/models/request_templates_spec.rb +36 -0
  160. data/spec/models/response_consistency_spec.rb +42 -0
  161. data/spec/models/result_buckets_buckets_spec.rb +60 -0
  162. data/spec/models/result_buckets_spec.rb +48 -0
  163. data/spec/models/result_node_spec.rb +168 -0
  164. data/spec/models/result_set_context_facet_queries_spec.rb +54 -0
  165. data/spec/models/result_set_context_spec.rb +72 -0
  166. data/spec/models/result_set_context_spellcheck_spec.rb +52 -0
  167. data/spec/models/result_set_paging_list_spec.rb +54 -0
  168. data/spec/models/result_set_paging_spec.rb +42 -0
  169. data/spec/models/result_set_row_entry_spec.rb +42 -0
  170. data/spec/models/search_entry_highlight_spec.rb +48 -0
  171. data/spec/models/search_entry_spec.rb +48 -0
  172. data/spec/models/search_request_spec.rb +156 -0
  173. data/spec/models/user_info_spec.rb +48 -0
  174. data/spec/spec_helper.rb +111 -0
  175. metadata +455 -0
@@ -0,0 +1,373 @@
1
+ =begin
2
+ #Alfresco Content Services REST API
3
+
4
+ #**Search API** Provides access to the search features of Alfresco Content Services.
5
+
6
+ OpenAPI spec version: 1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Alfresco
16
+
17
+ class SearchRequest
18
+ attr_accessor :query
19
+
20
+ attr_accessor :paging
21
+
22
+ attr_accessor :include
23
+
24
+ # When true, include the original request in the response
25
+ attr_accessor :include_request
26
+
27
+ attr_accessor :fields
28
+
29
+ attr_accessor :sort
30
+
31
+ attr_accessor :templates
32
+
33
+ attr_accessor :defaults
34
+
35
+ attr_accessor :localization
36
+
37
+ attr_accessor :filter_queries
38
+
39
+ attr_accessor :facet_queries
40
+
41
+ attr_accessor :facet_fields
42
+
43
+ attr_accessor :facet_intervals
44
+
45
+ attr_accessor :pivots
46
+
47
+ attr_accessor :stats
48
+
49
+ attr_accessor :spellcheck
50
+
51
+ attr_accessor :scope
52
+
53
+ attr_accessor :limits
54
+
55
+ attr_accessor :highlight
56
+
57
+ attr_accessor :ranges
58
+
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'query' => :'query',
64
+ :'paging' => :'paging',
65
+ :'include' => :'include',
66
+ :'include_request' => :'includeRequest',
67
+ :'fields' => :'fields',
68
+ :'sort' => :'sort',
69
+ :'templates' => :'templates',
70
+ :'defaults' => :'defaults',
71
+ :'localization' => :'localization',
72
+ :'filter_queries' => :'filterQueries',
73
+ :'facet_queries' => :'facetQueries',
74
+ :'facet_fields' => :'facetFields',
75
+ :'facet_intervals' => :'facetIntervals',
76
+ :'pivots' => :'pivots',
77
+ :'stats' => :'stats',
78
+ :'spellcheck' => :'spellcheck',
79
+ :'scope' => :'scope',
80
+ :'limits' => :'limits',
81
+ :'highlight' => :'highlight',
82
+ :'ranges' => :'ranges'
83
+ }
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.swagger_types
88
+ {
89
+ :'query' => :'RequestQuery',
90
+ :'paging' => :'RequestPagination',
91
+ :'include' => :'RequestInclude',
92
+ :'include_request' => :'BOOLEAN',
93
+ :'fields' => :'RequestFields',
94
+ :'sort' => :'RequestSortDefinition',
95
+ :'templates' => :'RequestTemplates',
96
+ :'defaults' => :'RequestDefaults',
97
+ :'localization' => :'RequestLocalization',
98
+ :'filter_queries' => :'RequestFilterQueries',
99
+ :'facet_queries' => :'RequestFacetQueries',
100
+ :'facet_fields' => :'RequestFacetFields',
101
+ :'facet_intervals' => :'RequestFacetIntervals',
102
+ :'pivots' => :'Array<RequestPivot>',
103
+ :'stats' => :'Array<RequestStats>',
104
+ :'spellcheck' => :'RequestSpellcheck',
105
+ :'scope' => :'RequestScope',
106
+ :'limits' => :'RequestLimits',
107
+ :'highlight' => :'RequestHighlight',
108
+ :'ranges' => :'Array<RequestRange>'
109
+ }
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ return unless attributes.is_a?(Hash)
116
+
117
+ # convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
119
+
120
+ if attributes.has_key?(:'query')
121
+ self.query = attributes[:'query']
122
+ end
123
+
124
+ if attributes.has_key?(:'paging')
125
+ self.paging = attributes[:'paging']
126
+ end
127
+
128
+ if attributes.has_key?(:'include')
129
+ self.include = attributes[:'include']
130
+ end
131
+
132
+ if attributes.has_key?(:'includeRequest')
133
+ self.include_request = attributes[:'includeRequest']
134
+ else
135
+ self.include_request = false
136
+ end
137
+
138
+ if attributes.has_key?(:'fields')
139
+ self.fields = attributes[:'fields']
140
+ end
141
+
142
+ if attributes.has_key?(:'sort')
143
+ self.sort = attributes[:'sort']
144
+ end
145
+
146
+ if attributes.has_key?(:'templates')
147
+ self.templates = attributes[:'templates']
148
+ end
149
+
150
+ if attributes.has_key?(:'defaults')
151
+ self.defaults = attributes[:'defaults']
152
+ end
153
+
154
+ if attributes.has_key?(:'localization')
155
+ self.localization = attributes[:'localization']
156
+ end
157
+
158
+ if attributes.has_key?(:'filterQueries')
159
+ self.filter_queries = attributes[:'filterQueries']
160
+ end
161
+
162
+ if attributes.has_key?(:'facetQueries')
163
+ self.facet_queries = attributes[:'facetQueries']
164
+ end
165
+
166
+ if attributes.has_key?(:'facetFields')
167
+ self.facet_fields = attributes[:'facetFields']
168
+ end
169
+
170
+ if attributes.has_key?(:'facetIntervals')
171
+ self.facet_intervals = attributes[:'facetIntervals']
172
+ end
173
+
174
+ if attributes.has_key?(:'pivots')
175
+ if (value = attributes[:'pivots']).is_a?(Array)
176
+ self.pivots = value
177
+ end
178
+ end
179
+
180
+ if attributes.has_key?(:'stats')
181
+ if (value = attributes[:'stats']).is_a?(Array)
182
+ self.stats = value
183
+ end
184
+ end
185
+
186
+ if attributes.has_key?(:'spellcheck')
187
+ self.spellcheck = attributes[:'spellcheck']
188
+ end
189
+
190
+ if attributes.has_key?(:'scope')
191
+ self.scope = attributes[:'scope']
192
+ end
193
+
194
+ if attributes.has_key?(:'limits')
195
+ self.limits = attributes[:'limits']
196
+ end
197
+
198
+ if attributes.has_key?(:'highlight')
199
+ self.highlight = attributes[:'highlight']
200
+ end
201
+
202
+ if attributes.has_key?(:'ranges')
203
+ if (value = attributes[:'ranges']).is_a?(Array)
204
+ self.ranges = value
205
+ end
206
+ end
207
+
208
+ end
209
+
210
+ # Show invalid properties with the reasons. Usually used together with valid?
211
+ # @return Array for valid properies with the reasons
212
+ def list_invalid_properties
213
+ invalid_properties = Array.new
214
+ if @query.nil?
215
+ invalid_properties.push("invalid value for 'query', query cannot be nil.")
216
+ end
217
+
218
+ return invalid_properties
219
+ end
220
+
221
+ # Check to see if the all the properties in the model are valid
222
+ # @return true if the model is valid
223
+ def valid?
224
+ return false if @query.nil?
225
+ return true
226
+ end
227
+
228
+ # Checks equality by comparing each attribute.
229
+ # @param [Object] Object to be compared
230
+ def ==(o)
231
+ return true if self.equal?(o)
232
+ self.class == o.class &&
233
+ query == o.query &&
234
+ paging == o.paging &&
235
+ include == o.include &&
236
+ include_request == o.include_request &&
237
+ fields == o.fields &&
238
+ sort == o.sort &&
239
+ templates == o.templates &&
240
+ defaults == o.defaults &&
241
+ localization == o.localization &&
242
+ filter_queries == o.filter_queries &&
243
+ facet_queries == o.facet_queries &&
244
+ facet_fields == o.facet_fields &&
245
+ facet_intervals == o.facet_intervals &&
246
+ pivots == o.pivots &&
247
+ stats == o.stats &&
248
+ spellcheck == o.spellcheck &&
249
+ scope == o.scope &&
250
+ limits == o.limits &&
251
+ highlight == o.highlight &&
252
+ ranges == o.ranges
253
+ end
254
+
255
+ # @see the `==` method
256
+ # @param [Object] Object to be compared
257
+ def eql?(o)
258
+ self == o
259
+ end
260
+
261
+ # Calculates hash code according to all attributes.
262
+ # @return [Fixnum] Hash code
263
+ def hash
264
+ [query, paging, include, include_request, fields, sort, templates, defaults, localization, filter_queries, facet_queries, facet_fields, facet_intervals, pivots, stats, spellcheck, scope, limits, highlight, ranges].hash
265
+ end
266
+
267
+ # Builds the object from hash
268
+ # @param [Hash] attributes Model attributes in the form of hash
269
+ # @return [Object] Returns the model itself
270
+ def build_from_hash(attributes)
271
+ return nil unless attributes.is_a?(Hash)
272
+ self.class.swagger_types.each_pair do |key, type|
273
+ if type =~ /\AArray<(.*)>/i
274
+ # check to ensure the input is an array given that the the attribute
275
+ # is documented as an array but the input is not
276
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
277
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
278
+ end
279
+ elsif !attributes[self.class.attribute_map[key]].nil?
280
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
281
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
282
+ end
283
+
284
+ self
285
+ end
286
+
287
+ # Deserializes the data based on type
288
+ # @param string type Data type
289
+ # @param string value Value to be deserialized
290
+ # @return [Object] Deserialized data
291
+ def _deserialize(type, value)
292
+ case type.to_sym
293
+ when :DateTime
294
+ DateTime.parse(value)
295
+ when :Date
296
+ Date.parse(value)
297
+ when :String
298
+ value.to_s
299
+ when :Integer
300
+ value.to_i
301
+ when :Float
302
+ value.to_f
303
+ when :BOOLEAN
304
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
305
+ true
306
+ else
307
+ false
308
+ end
309
+ when :Object
310
+ # generic object (usually a Hash), return directly
311
+ value
312
+ when /\AArray<(?<inner_type>.+)>\z/
313
+ inner_type = Regexp.last_match[:inner_type]
314
+ value.map { |v| _deserialize(inner_type, v) }
315
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
316
+ k_type = Regexp.last_match[:k_type]
317
+ v_type = Regexp.last_match[:v_type]
318
+ {}.tap do |hash|
319
+ value.each do |k, v|
320
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
321
+ end
322
+ end
323
+ else # model
324
+ temp_model = Alfresco.const_get(type).new
325
+ temp_model.build_from_hash(value)
326
+ end
327
+ end
328
+
329
+ # Returns the string representation of the object
330
+ # @return [String] String presentation of the object
331
+ def to_s
332
+ to_hash.to_s
333
+ end
334
+
335
+ # to_body is an alias to to_hash (backward compatibility)
336
+ # @return [Hash] Returns the object in the form of hash
337
+ def to_body
338
+ to_hash
339
+ end
340
+
341
+ # Returns the object in the form of hash
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_hash
344
+ hash = {}
345
+ self.class.attribute_map.each_pair do |attr, param|
346
+ value = self.send(attr)
347
+ next if value.nil?
348
+ hash[param] = _to_hash(value)
349
+ end
350
+ hash
351
+ end
352
+
353
+ # Outputs non-array value in the form of hash
354
+ # For object, use to_hash. Otherwise, just return the value
355
+ # @param [Object] value Any valid value
356
+ # @return [Hash] Returns the value in the form of hash
357
+ def _to_hash(value)
358
+ if value.is_a?(Array)
359
+ value.compact.map{ |v| _to_hash(v) }
360
+ elsif value.is_a?(Hash)
361
+ {}.tap do |hash|
362
+ value.each { |k, v| hash[k] = _to_hash(v) }
363
+ end
364
+ elsif value.respond_to? :to_hash
365
+ value.to_hash
366
+ else
367
+ value
368
+ end
369
+ end
370
+
371
+ end
372
+
373
+ end
@@ -0,0 +1,207 @@
1
+ =begin
2
+ #Alfresco Content Services REST API
3
+
4
+ #**Search API** Provides access to the search features of Alfresco Content Services.
5
+
6
+ OpenAPI spec version: 1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Alfresco
16
+
17
+ class UserInfo
18
+ attr_accessor :display_name
19
+
20
+ attr_accessor :id
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'display_name' => :'displayName',
27
+ :'id' => :'id'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'display_name' => :'String',
35
+ :'id' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'displayName')
48
+ self.display_name = attributes[:'displayName']
49
+ end
50
+
51
+ if attributes.has_key?(:'id')
52
+ self.id = attributes[:'id']
53
+ end
54
+
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properies with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @display_name.nil?
62
+ invalid_properties.push("invalid value for 'display_name', display_name cannot be nil.")
63
+ end
64
+
65
+ if @id.nil?
66
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
67
+ end
68
+
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @display_name.nil?
76
+ return false if @id.nil?
77
+ return true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ display_name == o.display_name &&
86
+ id == o.id
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Fixnum] Hash code
97
+ def hash
98
+ [display_name, id].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ temp_model = Alfresco.const_get(type).new
159
+ temp_model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map{ |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+
205
+ end
206
+
207
+ end