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,333 @@
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
+ # A simple facet field
17
+ class RequestFacetField
18
+ # The facet field
19
+ attr_accessor :field
20
+
21
+ # A label to include in place of the facet field
22
+ attr_accessor :label
23
+
24
+ # Restricts the possible constraints to only indexed values with a specified prefix.
25
+ attr_accessor :prefix
26
+
27
+ attr_accessor :sort
28
+
29
+ attr_accessor :method
30
+
31
+ # When true, count results that match the query but which have no facet value for the field (in addition to the Term-based constraints).
32
+ attr_accessor :missing
33
+
34
+ attr_accessor :limit
35
+
36
+ attr_accessor :offset
37
+
38
+ # The minimum count required for a facet field to be included in the response.
39
+ attr_accessor :mincount
40
+
41
+ attr_accessor :facet_enum_cache_min_df
42
+
43
+ # Filter Queries with tags listed here will not be included in facet counts. This is used for multi-select facetting.
44
+ attr_accessor :exclude_filters
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'field' => :'field',
72
+ :'label' => :'label',
73
+ :'prefix' => :'prefix',
74
+ :'sort' => :'sort',
75
+ :'method' => :'method',
76
+ :'missing' => :'missing',
77
+ :'limit' => :'limit',
78
+ :'offset' => :'offset',
79
+ :'mincount' => :'mincount',
80
+ :'facet_enum_cache_min_df' => :'facetEnumCacheMinDf',
81
+ :'exclude_filters' => :'excludeFilters'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'field' => :'String',
89
+ :'label' => :'String',
90
+ :'prefix' => :'String',
91
+ :'sort' => :'String',
92
+ :'method' => :'String',
93
+ :'missing' => :'BOOLEAN',
94
+ :'limit' => :'Integer',
95
+ :'offset' => :'Integer',
96
+ :'mincount' => :'Integer',
97
+ :'facet_enum_cache_min_df' => :'Integer',
98
+ :'exclude_filters' => :'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?(:'field')
111
+ self.field = attributes[:'field']
112
+ end
113
+
114
+ if attributes.has_key?(:'label')
115
+ self.label = attributes[:'label']
116
+ end
117
+
118
+ if attributes.has_key?(:'prefix')
119
+ self.prefix = attributes[:'prefix']
120
+ end
121
+
122
+ if attributes.has_key?(:'sort')
123
+ self.sort = attributes[:'sort']
124
+ end
125
+
126
+ if attributes.has_key?(:'method')
127
+ self.method = attributes[:'method']
128
+ end
129
+
130
+ if attributes.has_key?(:'missing')
131
+ self.missing = attributes[:'missing']
132
+ else
133
+ self.missing = false
134
+ end
135
+
136
+ if attributes.has_key?(:'limit')
137
+ self.limit = attributes[:'limit']
138
+ end
139
+
140
+ if attributes.has_key?(:'offset')
141
+ self.offset = attributes[:'offset']
142
+ end
143
+
144
+ if attributes.has_key?(:'mincount')
145
+ self.mincount = attributes[:'mincount']
146
+ end
147
+
148
+ if attributes.has_key?(:'facetEnumCacheMinDf')
149
+ self.facet_enum_cache_min_df = attributes[:'facetEnumCacheMinDf']
150
+ end
151
+
152
+ if attributes.has_key?(:'excludeFilters')
153
+ if (value = attributes[:'excludeFilters']).is_a?(Array)
154
+ self.exclude_filters = value
155
+ end
156
+ end
157
+
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properies with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ return invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ sort_validator = EnumAttributeValidator.new('String', ["COUNT", "INDEX"])
171
+ return false unless sort_validator.valid?(@sort)
172
+ method_validator = EnumAttributeValidator.new('String', ["ENUM", "FC"])
173
+ return false unless method_validator.valid?(@method)
174
+ return true
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] sort Object to be assigned
179
+ def sort=(sort)
180
+ validator = EnumAttributeValidator.new('String', ["COUNT", "INDEX"])
181
+ unless validator.valid?(sort)
182
+ fail ArgumentError, "invalid value for 'sort', must be one of #{validator.allowable_values}."
183
+ end
184
+ @sort = sort
185
+ end
186
+
187
+ # Custom attribute writer method checking allowed values (enum).
188
+ # @param [Object] method Object to be assigned
189
+ def method=(method)
190
+ validator = EnumAttributeValidator.new('String', ["ENUM", "FC"])
191
+ unless validator.valid?(method)
192
+ fail ArgumentError, "invalid value for 'method', must be one of #{validator.allowable_values}."
193
+ end
194
+ @method = method
195
+ end
196
+
197
+ # Checks equality by comparing each attribute.
198
+ # @param [Object] Object to be compared
199
+ def ==(o)
200
+ return true if self.equal?(o)
201
+ self.class == o.class &&
202
+ field == o.field &&
203
+ label == o.label &&
204
+ prefix == o.prefix &&
205
+ sort == o.sort &&
206
+ method == o.method &&
207
+ missing == o.missing &&
208
+ limit == o.limit &&
209
+ offset == o.offset &&
210
+ mincount == o.mincount &&
211
+ facet_enum_cache_min_df == o.facet_enum_cache_min_df &&
212
+ exclude_filters == o.exclude_filters
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Fixnum] Hash code
223
+ def hash
224
+ [field, label, prefix, sort, method, missing, limit, offset, mincount, facet_enum_cache_min_df, exclude_filters].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ self.class.swagger_types.each_pair do |key, type|
233
+ if type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
237
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
238
+ end
239
+ elsif !attributes[self.class.attribute_map[key]].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
241
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :DateTime
254
+ DateTime.parse(value)
255
+ when :Date
256
+ Date.parse(value)
257
+ when :String
258
+ value.to_s
259
+ when :Integer
260
+ value.to_i
261
+ when :Float
262
+ value.to_f
263
+ when :BOOLEAN
264
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
265
+ true
266
+ else
267
+ false
268
+ end
269
+ when :Object
270
+ # generic object (usually a Hash), return directly
271
+ value
272
+ when /\AArray<(?<inner_type>.+)>\z/
273
+ inner_type = Regexp.last_match[:inner_type]
274
+ value.map { |v| _deserialize(inner_type, v) }
275
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
276
+ k_type = Regexp.last_match[:k_type]
277
+ v_type = Regexp.last_match[:v_type]
278
+ {}.tap do |hash|
279
+ value.each do |k, v|
280
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
281
+ end
282
+ end
283
+ else # model
284
+ temp_model = Alfresco.const_get(type).new
285
+ temp_model.build_from_hash(value)
286
+ end
287
+ end
288
+
289
+ # Returns the string representation of the object
290
+ # @return [String] String presentation of the object
291
+ def to_s
292
+ to_hash.to_s
293
+ end
294
+
295
+ # to_body is an alias to to_hash (backward compatibility)
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_body
298
+ to_hash
299
+ end
300
+
301
+ # Returns the object in the form of hash
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_hash
304
+ hash = {}
305
+ self.class.attribute_map.each_pair do |attr, param|
306
+ value = self.send(attr)
307
+ next if value.nil?
308
+ hash[param] = _to_hash(value)
309
+ end
310
+ hash
311
+ end
312
+
313
+ # Outputs non-array value in the form of hash
314
+ # For object, use to_hash. Otherwise, just return the value
315
+ # @param [Object] value Any valid value
316
+ # @return [Hash] Returns the value in the form of hash
317
+ def _to_hash(value)
318
+ if value.is_a?(Array)
319
+ value.compact.map{ |v| _to_hash(v) }
320
+ elsif value.is_a?(Hash)
321
+ {}.tap do |hash|
322
+ value.each { |k, v| hash[k] = _to_hash(v) }
323
+ end
324
+ elsif value.respond_to? :to_hash
325
+ value.to_hash
326
+ else
327
+ value
328
+ end
329
+ end
330
+
331
+ end
332
+
333
+ end
@@ -0,0 +1,191 @@
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
+ # Simple facet fields to include The Properties reflect the global properties related to field facts in SOLR. They are descripbed in detail by the SOLR documentation
17
+ class RequestFacetFields
18
+ # Define specifc fields on which to facet (adds SOLR facet.field and f.<field>.facet.* options)
19
+ attr_accessor :facets
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'facets' => :'facets'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'facets' => :'Array<RequestFacetField>'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'facets')
45
+ if (value = attributes[:'facets']).is_a?(Array)
46
+ self.facets = value
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ # Show invalid properties with the reasons. Usually used together with valid?
53
+ # @return Array for valid properies with the reasons
54
+ def list_invalid_properties
55
+ invalid_properties = Array.new
56
+ return invalid_properties
57
+ end
58
+
59
+ # Check to see if the all the properties in the model are valid
60
+ # @return true if the model is valid
61
+ def valid?
62
+ return true
63
+ end
64
+
65
+ # Checks equality by comparing each attribute.
66
+ # @param [Object] Object to be compared
67
+ def ==(o)
68
+ return true if self.equal?(o)
69
+ self.class == o.class &&
70
+ facets == o.facets
71
+ end
72
+
73
+ # @see the `==` method
74
+ # @param [Object] Object to be compared
75
+ def eql?(o)
76
+ self == o
77
+ end
78
+
79
+ # Calculates hash code according to all attributes.
80
+ # @return [Fixnum] Hash code
81
+ def hash
82
+ [facets].hash
83
+ end
84
+
85
+ # Builds the object from hash
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ # @return [Object] Returns the model itself
88
+ def build_from_hash(attributes)
89
+ return nil unless attributes.is_a?(Hash)
90
+ self.class.swagger_types.each_pair do |key, type|
91
+ if type =~ /\AArray<(.*)>/i
92
+ # check to ensure the input is an array given that the the attribute
93
+ # is documented as an array but the input is not
94
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
95
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
96
+ end
97
+ elsif !attributes[self.class.attribute_map[key]].nil?
98
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
99
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
100
+ end
101
+
102
+ self
103
+ end
104
+
105
+ # Deserializes the data based on type
106
+ # @param string type Data type
107
+ # @param string value Value to be deserialized
108
+ # @return [Object] Deserialized data
109
+ def _deserialize(type, value)
110
+ case type.to_sym
111
+ when :DateTime
112
+ DateTime.parse(value)
113
+ when :Date
114
+ Date.parse(value)
115
+ when :String
116
+ value.to_s
117
+ when :Integer
118
+ value.to_i
119
+ when :Float
120
+ value.to_f
121
+ when :BOOLEAN
122
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
123
+ true
124
+ else
125
+ false
126
+ end
127
+ when :Object
128
+ # generic object (usually a Hash), return directly
129
+ value
130
+ when /\AArray<(?<inner_type>.+)>\z/
131
+ inner_type = Regexp.last_match[:inner_type]
132
+ value.map { |v| _deserialize(inner_type, v) }
133
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
134
+ k_type = Regexp.last_match[:k_type]
135
+ v_type = Regexp.last_match[:v_type]
136
+ {}.tap do |hash|
137
+ value.each do |k, v|
138
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
139
+ end
140
+ end
141
+ else # model
142
+ temp_model = Alfresco.const_get(type).new
143
+ temp_model.build_from_hash(value)
144
+ end
145
+ end
146
+
147
+ # Returns the string representation of the object
148
+ # @return [String] String presentation of the object
149
+ def to_s
150
+ to_hash.to_s
151
+ end
152
+
153
+ # to_body is an alias to to_hash (backward compatibility)
154
+ # @return [Hash] Returns the object in the form of hash
155
+ def to_body
156
+ to_hash
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ next if value.nil?
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ # Outputs non-array value in the form of hash
172
+ # For object, use to_hash. Otherwise, just return the value
173
+ # @param [Object] value Any valid value
174
+ # @return [Hash] Returns the value in the form of hash
175
+ def _to_hash(value)
176
+ if value.is_a?(Array)
177
+ value.compact.map{ |v| _to_hash(v) }
178
+ elsif value.is_a?(Hash)
179
+ {}.tap do |hash|
180
+ value.each { |k, v| hash[k] = _to_hash(v) }
181
+ end
182
+ elsif value.respond_to? :to_hash
183
+ value.to_hash
184
+ else
185
+ value
186
+ end
187
+ end
188
+
189
+ end
190
+
191
+ end