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