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,224 @@
1
+ =begin
2
+ #CMS Audit Logs
3
+
4
+ #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account.
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 AuditLogs
18
+ class NextPage
19
+ attr_accessor :after
20
+
21
+ attr_accessor :link
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'after' => :'after',
27
+ :'link' => :'link'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'after' => :'String',
35
+ :'link' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::AuditLogs::NextPage` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::AuditLogs::NextPage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'after')
61
+ self.after = attributes[:'after']
62
+ end
63
+
64
+ if attributes.key?(:'link')
65
+ self.link = attributes[:'link']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @after.nil?
74
+ invalid_properties.push('invalid value for "after", after cannot be nil.')
75
+ end
76
+
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ return false if @after.nil?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ after == o.after &&
93
+ link == o.link
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [after, link].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ DateTime.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :Boolean
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ Hubspot::Cms::AuditLogs.const_get(type).build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,210 @@
1
+ =begin
2
+ #CMS Audit Logs
3
+
4
+ #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account.
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 AuditLogs
18
+ class Paging
19
+ attr_accessor :_next
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'_next' => :'next'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'_next' => :'NextPage'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::AuditLogs::Paging` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::AuditLogs::Paging`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'_next')
57
+ self._next = attributes[:'_next']
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ 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
+ 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
+ _next == o._next
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 [Integer] Hash code
90
+ def hash
91
+ [_next].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 self.build_from_hash(attributes)
98
+ new.build_from_hash(attributes)
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.openapi_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ Hubspot::Cms::AuditLogs.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
210
+ end
@@ -0,0 +1,352 @@
1
+ =begin
2
+ #CMS Audit Logs
3
+
4
+ #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account.
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 AuditLogs
18
+ class PublicAuditLog
19
+ # The ID of the object.
20
+ attr_accessor :object_id
21
+
22
+ # The ID of the user who caused the event.
23
+ attr_accessor :user_id
24
+
25
+ # The timestamp at which the event occurred.
26
+ attr_accessor :timestamp
27
+
28
+ # The internal name of the object in HubSpot.
29
+ attr_accessor :object_name
30
+
31
+ # The name of the user who caused the event.
32
+ attr_accessor :full_name
33
+
34
+ # The type of event that took place (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED).
35
+ attr_accessor :event
36
+
37
+ # The type of the object (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.)
38
+ attr_accessor :object_type
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'object_id' => :'objectId',
66
+ :'user_id' => :'userId',
67
+ :'timestamp' => :'timestamp',
68
+ :'object_name' => :'objectName',
69
+ :'full_name' => :'fullName',
70
+ :'event' => :'event',
71
+ :'object_type' => :'objectType'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'object_id' => :'String',
79
+ :'user_id' => :'String',
80
+ :'timestamp' => :'DateTime',
81
+ :'object_name' => :'String',
82
+ :'full_name' => :'String',
83
+ :'event' => :'String',
84
+ :'object_type' => :'String'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::AuditLogs::PublicAuditLog` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!self.class.attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Cms::AuditLogs::PublicAuditLog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'object_id')
110
+ self.object_id = attributes[:'object_id']
111
+ end
112
+
113
+ if attributes.key?(:'user_id')
114
+ self.user_id = attributes[:'user_id']
115
+ end
116
+
117
+ if attributes.key?(:'timestamp')
118
+ self.timestamp = attributes[:'timestamp']
119
+ end
120
+
121
+ if attributes.key?(:'object_name')
122
+ self.object_name = attributes[:'object_name']
123
+ end
124
+
125
+ if attributes.key?(:'full_name')
126
+ self.full_name = attributes[:'full_name']
127
+ end
128
+
129
+ if attributes.key?(:'event')
130
+ self.event = attributes[:'event']
131
+ end
132
+
133
+ if attributes.key?(:'object_type')
134
+ self.object_type = attributes[:'object_type']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ invalid_properties = Array.new
142
+ if @object_id.nil?
143
+ invalid_properties.push('invalid value for "object_id", object_id cannot be nil.')
144
+ end
145
+
146
+ if @user_id.nil?
147
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
148
+ end
149
+
150
+ if @timestamp.nil?
151
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
152
+ end
153
+
154
+ if @object_name.nil?
155
+ invalid_properties.push('invalid value for "object_name", object_name cannot be nil.')
156
+ end
157
+
158
+ if @full_name.nil?
159
+ invalid_properties.push('invalid value for "full_name", full_name cannot be nil.')
160
+ end
161
+
162
+ if @event.nil?
163
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
164
+ end
165
+
166
+ if @object_type.nil?
167
+ invalid_properties.push('invalid value for "object_type", object_type cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ return false if @object_id.nil?
177
+ return false if @user_id.nil?
178
+ return false if @timestamp.nil?
179
+ return false if @object_name.nil?
180
+ return false if @full_name.nil?
181
+ return false if @event.nil?
182
+ event_validator = EnumAttributeValidator.new('String', ["CREATED", "UPDATED", "PUBLISHED", "DELETED", "UNPUBLISHED"])
183
+ return false unless event_validator.valid?(@event)
184
+ return false if @object_type.nil?
185
+ object_type_validator = EnumAttributeValidator.new('String', ["BLOG", "BLOG_POST", "LANDING_PAGE", "WEBSITE_PAGE", "TEMPLATE", "MODULE", "GLOBAL_MODULE", "SERVERLESS_FUNCTION", "DOMAIN", "URL_MAPPING", "EMAIL", "CONTENT_SETTINGS", "HUBDB_TABLE", "KNOWLEDGE_BASE_ARTICLE", "KNOWLEDGE_BASE", "THEME", "CSS", "JS"])
186
+ return false unless object_type_validator.valid?(@object_type)
187
+ true
188
+ end
189
+
190
+ # Custom attribute writer method checking allowed values (enum).
191
+ # @param [Object] event Object to be assigned
192
+ def event=(event)
193
+ validator = EnumAttributeValidator.new('String', ["CREATED", "UPDATED", "PUBLISHED", "DELETED", "UNPUBLISHED"])
194
+ unless validator.valid?(event)
195
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
196
+ end
197
+ @event = event
198
+ end
199
+
200
+ # Custom attribute writer method checking allowed values (enum).
201
+ # @param [Object] object_type Object to be assigned
202
+ def object_type=(object_type)
203
+ validator = EnumAttributeValidator.new('String', ["BLOG", "BLOG_POST", "LANDING_PAGE", "WEBSITE_PAGE", "TEMPLATE", "MODULE", "GLOBAL_MODULE", "SERVERLESS_FUNCTION", "DOMAIN", "URL_MAPPING", "EMAIL", "CONTENT_SETTINGS", "HUBDB_TABLE", "KNOWLEDGE_BASE_ARTICLE", "KNOWLEDGE_BASE", "THEME", "CSS", "JS"])
204
+ unless validator.valid?(object_type)
205
+ fail ArgumentError, "invalid value for \"object_type\", must be one of #{validator.allowable_values}."
206
+ end
207
+ @object_type = object_type
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ object_id == o.object_id &&
216
+ user_id == o.user_id &&
217
+ timestamp == o.timestamp &&
218
+ object_name == o.object_name &&
219
+ full_name == o.full_name &&
220
+ event == o.event &&
221
+ object_type == o.object_type
222
+ end
223
+
224
+ # @see the `==` method
225
+ # @param [Object] Object to be compared
226
+ def eql?(o)
227
+ self == o
228
+ end
229
+
230
+ # Calculates hash code according to all attributes.
231
+ # @return [Integer] Hash code
232
+ def hash
233
+ [object_id, user_id, timestamp, object_name, full_name, event, object_type].hash
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def self.build_from_hash(attributes)
240
+ new.build_from_hash(attributes)
241
+ end
242
+
243
+ # Builds the object from hash
244
+ # @param [Hash] attributes Model attributes in the form of hash
245
+ # @return [Object] Returns the model itself
246
+ def build_from_hash(attributes)
247
+ return nil unless attributes.is_a?(Hash)
248
+ self.class.openapi_types.each_pair do |key, type|
249
+ if type =~ /\AArray<(.*)>/i
250
+ # check to ensure the input is an array given that the attribute
251
+ # is documented as an array but the input is not
252
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
253
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
254
+ end
255
+ elsif !attributes[self.class.attribute_map[key]].nil?
256
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
257
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
258
+ end
259
+
260
+ self
261
+ end
262
+
263
+ # Deserializes the data based on type
264
+ # @param string type Data type
265
+ # @param string value Value to be deserialized
266
+ # @return [Object] Deserialized data
267
+ def _deserialize(type, value)
268
+ case type.to_sym
269
+ when :DateTime
270
+ DateTime.parse(value)
271
+ when :Date
272
+ Date.parse(value)
273
+ when :String
274
+ value.to_s
275
+ when :Integer
276
+ value.to_i
277
+ when :Float
278
+ value.to_f
279
+ when :Boolean
280
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
281
+ true
282
+ else
283
+ false
284
+ end
285
+ when :Object
286
+ # generic object (usually a Hash), return directly
287
+ value
288
+ when /\AArray<(?<inner_type>.+)>\z/
289
+ inner_type = Regexp.last_match[:inner_type]
290
+ value.map { |v| _deserialize(inner_type, v) }
291
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
292
+ k_type = Regexp.last_match[:k_type]
293
+ v_type = Regexp.last_match[:v_type]
294
+ {}.tap do |hash|
295
+ value.each do |k, v|
296
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
297
+ end
298
+ end
299
+ else # model
300
+ Hubspot::Cms::AuditLogs.const_get(type).build_from_hash(value)
301
+ end
302
+ end
303
+
304
+ # Returns the string representation of the object
305
+ # @return [String] String presentation of the object
306
+ def to_s
307
+ to_hash.to_s
308
+ end
309
+
310
+ # to_body is an alias to to_hash (backward compatibility)
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_body
313
+ to_hash
314
+ end
315
+
316
+ # Returns the object in the form of hash
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_hash
319
+ hash = {}
320
+ self.class.attribute_map.each_pair do |attr, param|
321
+ value = self.send(attr)
322
+ if value.nil?
323
+ is_nullable = self.class.openapi_nullable.include?(attr)
324
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
325
+ end
326
+
327
+ hash[param] = _to_hash(value)
328
+ end
329
+ hash
330
+ end
331
+
332
+ # Outputs non-array value in the form of hash
333
+ # For object, use to_hash. Otherwise, just return the value
334
+ # @param [Object] value Any valid value
335
+ # @return [Hash] Returns the value in the form of hash
336
+ def _to_hash(value)
337
+ if value.is_a?(Array)
338
+ value.compact.map { |v| _to_hash(v) }
339
+ elsif value.is_a?(Hash)
340
+ {}.tap do |hash|
341
+ value.each { |k, v| hash[k] = _to_hash(v) }
342
+ end
343
+ elsif value.respond_to? :to_hash
344
+ value.to_hash
345
+ else
346
+ value
347
+ end
348
+ end
349
+ end
350
+ end
351
+ end
352
+ end