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