hubspot-api-client 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/hubspot-api-client.rb +61 -0
  4. data/lib/hubspot/codegen/cms/audit-logs/api/default_api.rb +106 -0
  5. data/lib/hubspot/codegen/cms/audit-logs/api_client.rb +422 -0
  6. data/lib/hubspot/codegen/cms/audit-logs/api_error.rb +61 -0
  7. data/lib/hubspot/codegen/cms/audit-logs/configuration.rb +258 -0
  8. data/lib/hubspot/codegen/cms/audit-logs/models/collection_response_public_audit_log.rb +226 -0
  9. data/lib/hubspot/codegen/cms/audit-logs/models/error.rb +292 -0
  10. data/lib/hubspot/codegen/cms/audit-logs/models/error_detail.rb +258 -0
  11. data/lib/hubspot/codegen/cms/audit-logs/models/next_page.rb +224 -0
  12. data/lib/hubspot/codegen/cms/audit-logs/models/paging.rb +210 -0
  13. data/lib/hubspot/codegen/cms/audit-logs/models/public_audit_log.rb +352 -0
  14. data/lib/hubspot/codegen/cms/domains/api/domains_api.rb +183 -0
  15. data/lib/hubspot/codegen/cms/domains/api_client.rb +422 -0
  16. data/lib/hubspot/codegen/cms/domains/api_error.rb +61 -0
  17. data/lib/hubspot/codegen/cms/domains/configuration.rb +258 -0
  18. data/lib/hubspot/codegen/cms/domains/models/collection_response_with_total_domain.rb +240 -0
  19. data/lib/hubspot/codegen/cms/domains/models/domain.rb +1091 -0
  20. data/lib/hubspot/codegen/cms/domains/models/domain_cdn_config.rb +497 -0
  21. data/lib/hubspot/codegen/cms/domains/models/domain_setup_info.rb +231 -0
  22. data/lib/hubspot/codegen/cms/domains/models/error.rb +292 -0
  23. data/lib/hubspot/codegen/cms/domains/models/error_detail.rb +258 -0
  24. data/lib/hubspot/codegen/cms/domains/models/next_page.rb +224 -0
  25. data/lib/hubspot/codegen/cms/domains/models/paging.rb +210 -0
  26. data/lib/hubspot/codegen/cms/performance/api/default_api.rb +186 -0
  27. data/lib/hubspot/codegen/cms/performance/api_client.rb +422 -0
  28. data/lib/hubspot/codegen/cms/performance/api_error.rb +61 -0
  29. data/lib/hubspot/codegen/cms/performance/configuration.rb +258 -0
  30. data/lib/hubspot/codegen/cms/performance/models/error.rb +292 -0
  31. data/lib/hubspot/codegen/cms/performance/models/error_detail.rb +258 -0
  32. data/lib/hubspot/codegen/cms/performance/models/performance_view.rb +528 -0
  33. data/lib/hubspot/codegen/cms/performance/models/public_performance_response.rb +332 -0
  34. data/lib/hubspot/codegen/cms/site-search/api/default_api.rb +225 -0
  35. data/lib/hubspot/codegen/cms/site-search/api_client.rb +422 -0
  36. data/lib/hubspot/codegen/cms/site-search/api_error.rb +61 -0
  37. data/lib/hubspot/codegen/cms/site-search/configuration.rb +258 -0
  38. data/lib/hubspot/codegen/cms/site-search/models/content_search_result.rb +427 -0
  39. data/lib/hubspot/codegen/cms/site-search/models/error.rb +292 -0
  40. data/lib/hubspot/codegen/cms/site-search/models/error_detail.rb +258 -0
  41. data/lib/hubspot/codegen/cms/site-search/models/indexed_data.rb +279 -0
  42. data/lib/hubspot/codegen/cms/site-search/models/public_search_results.rb +282 -0
  43. data/lib/hubspot/codegen/cms/site-search/models/search_hit_field.rb +257 -0
  44. data/lib/hubspot/codegen/cms/url-redirects/api/redirects_api.rb +368 -0
  45. data/lib/hubspot/codegen/cms/url-redirects/api_client.rb +422 -0
  46. data/lib/hubspot/codegen/cms/url-redirects/api_error.rb +61 -0
  47. data/lib/hubspot/codegen/cms/url-redirects/configuration.rb +258 -0
  48. data/lib/hubspot/codegen/cms/url-redirects/models/collection_response_with_total_url_mapping.rb +242 -0
  49. data/lib/hubspot/codegen/cms/url-redirects/models/error.rb +292 -0
  50. data/lib/hubspot/codegen/cms/url-redirects/models/error_detail.rb +258 -0
  51. data/lib/hubspot/codegen/cms/url-redirects/models/next_page.rb +224 -0
  52. data/lib/hubspot/codegen/cms/url-redirects/models/paging.rb +210 -0
  53. data/lib/hubspot/codegen/cms/url-redirects/models/url_mapping.rb +596 -0
  54. data/lib/hubspot/codegen/cms/url-redirects/models/url_mapping_create_request_body.rb +306 -0
  55. data/lib/hubspot/version.rb +1 -1
  56. data/sample-apps/search-result-paging-app/.env.template +4 -0
  57. data/sample-apps/search-result-paging-app/.gitignore +35 -0
  58. data/sample-apps/search-result-paging-app/.rspec +1 -0
  59. data/sample-apps/search-result-paging-app/.ruby-version +1 -0
  60. data/sample-apps/search-result-paging-app/Dockerfile +22 -0
  61. data/sample-apps/search-result-paging-app/Gemfile +35 -0
  62. data/sample-apps/search-result-paging-app/Gemfile.lock +279 -0
  63. data/sample-apps/search-result-paging-app/README.md +0 -0
  64. data/sample-apps/search-result-paging-app/Rakefile +6 -0
  65. data/sample-apps/search-result-paging-app/app/assets/config/manifest.js +3 -0
  66. data/sample-apps/search-result-paging-app/app/assets/images/.keep +0 -0
  67. data/sample-apps/search-result-paging-app/app/assets/javascripts/application.js +25 -0
  68. data/sample-apps/search-result-paging-app/app/assets/javascripts/cable.js +13 -0
  69. data/sample-apps/search-result-paging-app/app/assets/javascripts/channels/.keep +0 -0
  70. data/sample-apps/search-result-paging-app/app/assets/stylesheets/application.css +77 -0
  71. data/sample-apps/search-result-paging-app/app/controllers/application_controller.rb +12 -0
  72. data/sample-apps/search-result-paging-app/app/controllers/concerns/.keep +0 -0
  73. data/sample-apps/search-result-paging-app/app/controllers/concerns/exception_handler.rb +12 -0
  74. data/sample-apps/search-result-paging-app/app/controllers/home_controller.rb +14 -0
  75. data/sample-apps/search-result-paging-app/app/controllers/oauth/authorization_controller.rb +19 -0
  76. data/sample-apps/search-result-paging-app/app/helpers/application_helper.rb +2 -0
  77. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/authorization/authorize.rb +17 -0
  78. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/authorization/get_authorization_uri.rb +35 -0
  79. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/authorization/tokens/base.rb +21 -0
  80. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/authorization/tokens/generate.rb +28 -0
  81. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/authorization/tokens/refresh.rb +35 -0
  82. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb +26 -0
  83. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/search.rb +35 -0
  84. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/properties/create.rb +23 -0
  85. data/sample-apps/search-result-paging-app/app/lib/services/hubspot/properties/destroy.rb +16 -0
  86. data/sample-apps/search-result-paging-app/app/models/application_record.rb +3 -0
  87. data/sample-apps/search-result-paging-app/app/models/concerns/.keep +0 -0
  88. data/sample-apps/search-result-paging-app/app/views/home/index.html.erb +13 -0
  89. data/sample-apps/search-result-paging-app/app/views/layouts/application.html.erb +23 -0
  90. data/sample-apps/search-result-paging-app/app/views/oauth/authorization/login.html.erb +15 -0
  91. data/sample-apps/search-result-paging-app/app/views/shared/_header.html.erb +18 -0
  92. data/sample-apps/search-result-paging-app/bin/bundle +3 -0
  93. data/sample-apps/search-result-paging-app/bin/rails +9 -0
  94. data/sample-apps/search-result-paging-app/bin/rake +9 -0
  95. data/sample-apps/search-result-paging-app/bin/setup +36 -0
  96. data/sample-apps/search-result-paging-app/bin/spring +17 -0
  97. data/sample-apps/search-result-paging-app/bin/update +31 -0
  98. data/sample-apps/search-result-paging-app/bin/yarn +11 -0
  99. data/sample-apps/search-result-paging-app/config.ru +5 -0
  100. data/sample-apps/search-result-paging-app/config/application.rb +19 -0
  101. data/sample-apps/search-result-paging-app/config/boot.rb +3 -0
  102. data/sample-apps/search-result-paging-app/config/cable.yml +10 -0
  103. data/sample-apps/search-result-paging-app/config/database.yml +25 -0
  104. data/sample-apps/search-result-paging-app/config/environment.rb +5 -0
  105. data/sample-apps/search-result-paging-app/config/environments/development.rb +61 -0
  106. data/sample-apps/search-result-paging-app/config/environments/production.rb +94 -0
  107. data/sample-apps/search-result-paging-app/config/environments/test.rb +46 -0
  108. data/sample-apps/search-result-paging-app/config/initializers/assets.rb +14 -0
  109. data/sample-apps/search-result-paging-app/config/initializers/filter_parameter_logging.rb +4 -0
  110. data/sample-apps/search-result-paging-app/config/initializers/hubspot-api-client.rb +3 -0
  111. data/sample-apps/search-result-paging-app/config/initializers/mime_types.rb +1 -0
  112. data/sample-apps/search-result-paging-app/config/initializers/wrap_parameters.rb +14 -0
  113. data/sample-apps/search-result-paging-app/config/locales/en.yml +33 -0
  114. data/sample-apps/search-result-paging-app/config/puma.rb +34 -0
  115. data/sample-apps/search-result-paging-app/config/routes.rb +7 -0
  116. data/sample-apps/search-result-paging-app/config/spring.rb +6 -0
  117. data/sample-apps/search-result-paging-app/db/seeds.rb +7 -0
  118. data/sample-apps/search-result-paging-app/docker-compose.yml +11 -0
  119. data/sample-apps/search-result-paging-app/docker-entrypoint.sh +8 -0
  120. data/sample-apps/search-result-paging-app/lib/assets/.keep +0 -0
  121. data/sample-apps/search-result-paging-app/lib/tasks/.keep +0 -0
  122. data/sample-apps/search-result-paging-app/lib/tasks/search_contacts.rake +36 -0
  123. data/sample-apps/search-result-paging-app/log/.keep +0 -0
  124. data/sample-apps/search-result-paging-app/package.json +5 -0
  125. data/sample-apps/search-result-paging-app/public/404.html +67 -0
  126. data/sample-apps/search-result-paging-app/public/422.html +67 -0
  127. data/sample-apps/search-result-paging-app/public/500.html +66 -0
  128. data/sample-apps/search-result-paging-app/public/apple-touch-icon-precomposed.png +0 -0
  129. data/sample-apps/search-result-paging-app/public/apple-touch-icon.png +0 -0
  130. data/sample-apps/search-result-paging-app/public/favicon.ico +0 -0
  131. data/sample-apps/search-result-paging-app/public/robots.txt +1 -0
  132. data/sample-apps/search-result-paging-app/tmp/.keep +0 -0
  133. metadata +309 -2
@@ -0,0 +1,279 @@
1
+ =begin
2
+ #CMS Site Search
3
+
4
+ #Use these endpoints for searching content on your HubSpot hosted CMS website(s).
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Hubspot
16
+ module Cms
17
+ module SiteSearch
18
+ class IndexedData
19
+ attr_accessor :id
20
+
21
+ attr_accessor :type
22
+
23
+ attr_accessor :fields
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'id' => :'id',
51
+ :'type' => :'type',
52
+ :'fields' => :'fields'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'id' => :'String',
60
+ :'type' => :'String',
61
+ :'fields' => :'Hash<String, SearchHitField>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::SiteSearch::IndexedData` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::SiteSearch::IndexedData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'id')
87
+ self.id = attributes[:'id']
88
+ end
89
+
90
+ if attributes.key?(:'type')
91
+ self.type = attributes[:'type']
92
+ end
93
+
94
+ if attributes.key?(:'fields')
95
+ if (value = attributes[:'fields']).is_a?(Hash)
96
+ self.fields = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @id.nil?
106
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
107
+ end
108
+
109
+ if @type.nil?
110
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
111
+ end
112
+
113
+ if @fields.nil?
114
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ return false if @id.nil?
124
+ return false if @type.nil?
125
+ type_validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "DOCUMENT", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"])
126
+ return false unless type_validator.valid?(@type)
127
+ return false if @fields.nil?
128
+ true
129
+ end
130
+
131
+ # Custom attribute writer method checking allowed values (enum).
132
+ # @param [Object] type Object to be assigned
133
+ def type=(type)
134
+ validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "DOCUMENT", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"])
135
+ unless validator.valid?(type)
136
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
137
+ end
138
+ @type = type
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ id == o.id &&
147
+ type == o.type &&
148
+ fields == o.fields
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [id, type, fields].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ new.build_from_hash(attributes)
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ self.class.openapi_types.each_pair do |key, type|
176
+ if type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
181
+ end
182
+ elsif !attributes[self.class.attribute_map[key]].nil?
183
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
184
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
185
+ end
186
+
187
+ self
188
+ end
189
+
190
+ # Deserializes the data based on type
191
+ # @param string type Data type
192
+ # @param string value Value to be deserialized
193
+ # @return [Object] Deserialized data
194
+ def _deserialize(type, value)
195
+ case type.to_sym
196
+ when :DateTime
197
+ DateTime.parse(value)
198
+ when :Date
199
+ Date.parse(value)
200
+ when :String
201
+ value.to_s
202
+ when :Integer
203
+ value.to_i
204
+ when :Float
205
+ value.to_f
206
+ when :Boolean
207
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
208
+ true
209
+ else
210
+ false
211
+ end
212
+ when :Object
213
+ # generic object (usually a Hash), return directly
214
+ value
215
+ when /\AArray<(?<inner_type>.+)>\z/
216
+ inner_type = Regexp.last_match[:inner_type]
217
+ value.map { |v| _deserialize(inner_type, v) }
218
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
219
+ k_type = Regexp.last_match[:k_type]
220
+ v_type = Regexp.last_match[:v_type]
221
+ {}.tap do |hash|
222
+ value.each do |k, v|
223
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
224
+ end
225
+ end
226
+ else # model
227
+ Hubspot::Cms::SiteSearch.const_get(type).build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ if value.nil?
250
+ is_nullable = self.class.openapi_nullable.include?(attr)
251
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
252
+ end
253
+
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Outputs non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ # @param [Object] value Any valid value
262
+ # @return [Hash] Returns the value in the form of hash
263
+ def _to_hash(value)
264
+ if value.is_a?(Array)
265
+ value.compact.map { |v| _to_hash(v) }
266
+ elsif value.is_a?(Hash)
267
+ {}.tap do |hash|
268
+ value.each { |k, v| hash[k] = _to_hash(v) }
269
+ end
270
+ elsif value.respond_to? :to_hash
271
+ value.to_hash
272
+ else
273
+ value
274
+ end
275
+ end
276
+ end
277
+ end
278
+ end
279
+ end
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #CMS Site Search
3
+
4
+ #Use these endpoints for searching content on your HubSpot hosted CMS website(s).
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Hubspot
16
+ module Cms
17
+ module SiteSearch
18
+ class PublicSearchResults
19
+ attr_accessor :total
20
+
21
+ attr_accessor :offset
22
+
23
+ attr_accessor :limit
24
+
25
+ attr_accessor :results
26
+
27
+ attr_accessor :search_term
28
+
29
+ attr_accessor :page
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'total' => :'total',
35
+ :'offset' => :'offset',
36
+ :'limit' => :'limit',
37
+ :'results' => :'results',
38
+ :'search_term' => :'searchTerm',
39
+ :'page' => :'page'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'total' => :'Integer',
47
+ :'offset' => :'Integer',
48
+ :'limit' => :'Integer',
49
+ :'results' => :'Array<ContentSearchResult>',
50
+ :'search_term' => :'String',
51
+ :'page' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::SiteSearch::PublicSearchResults` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::SiteSearch::PublicSearchResults`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'total')
77
+ self.total = attributes[:'total']
78
+ end
79
+
80
+ if attributes.key?(:'offset')
81
+ self.offset = attributes[:'offset']
82
+ end
83
+
84
+ if attributes.key?(:'limit')
85
+ self.limit = attributes[:'limit']
86
+ end
87
+
88
+ if attributes.key?(:'results')
89
+ if (value = attributes[:'results']).is_a?(Array)
90
+ self.results = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'search_term')
95
+ self.search_term = attributes[:'search_term']
96
+ end
97
+
98
+ if attributes.key?(:'page')
99
+ self.page = attributes[:'page']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @total.nil?
108
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
109
+ end
110
+
111
+ if @offset.nil?
112
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
113
+ end
114
+
115
+ if @limit.nil?
116
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
117
+ end
118
+
119
+ if @results.nil?
120
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
121
+ end
122
+
123
+ if @page.nil?
124
+ invalid_properties.push('invalid value for "page", page cannot be nil.')
125
+ end
126
+
127
+ invalid_properties
128
+ end
129
+
130
+ # Check to see if the all the properties in the model are valid
131
+ # @return true if the model is valid
132
+ def valid?
133
+ return false if @total.nil?
134
+ return false if @offset.nil?
135
+ return false if @limit.nil?
136
+ return false if @results.nil?
137
+ return false if @page.nil?
138
+ true
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ total == o.total &&
147
+ offset == o.offset &&
148
+ limit == o.limit &&
149
+ results == o.results &&
150
+ search_term == o.search_term &&
151
+ page == o.page
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [total, offset, limit, results, search_term, page].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ new.build_from_hash(attributes)
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.openapi_types.each_pair do |key, type|
179
+ if type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ DateTime.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ Hubspot::Cms::SiteSearch.const_get(type).build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+ end
280
+ end
281
+ end
282
+ end