hubspot-api-client 7.3.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/hubspot-api-client.rb +55 -24
  4. data/lib/hubspot/codegen/cms/hubdb/api/default_api.rb +2090 -0
  5. data/lib/hubspot/codegen/cms/hubdb/api_client.rb +422 -0
  6. data/lib/hubspot/codegen/cms/hubdb/api_error.rb +61 -0
  7. data/lib/hubspot/codegen/cms/hubdb/configuration.rb +251 -0
  8. data/lib/hubspot/codegen/cms/hubdb/models/batch_input_hub_db_table_row_v3.rb +217 -0
  9. data/lib/hubspot/codegen/cms/hubdb/models/batch_input_json_node.rb +215 -0
  10. data/lib/hubspot/codegen/cms/hubdb/models/batch_input_string.rb +217 -0
  11. data/lib/hubspot/codegen/cms/hubdb/models/batch_response_hub_db_table_row_v3_with_errors.rb +333 -0
  12. data/lib/hubspot/codegen/cms/hubdb/models/collection_response_with_total_hub_db_table_row_v3.rb +240 -0
  13. data/lib/hubspot/codegen/cms/hubdb/models/collection_response_with_total_hub_db_table_v3.rb +240 -0
  14. data/lib/hubspot/codegen/cms/hubdb/models/column.rb +388 -0
  15. data/lib/hubspot/codegen/cms/hubdb/models/column_input.rb +288 -0
  16. data/lib/hubspot/codegen/cms/hubdb/models/error.rb +292 -0
  17. data/lib/hubspot/codegen/cms/hubdb/models/error_detail.rb +258 -0
  18. data/lib/hubspot/codegen/cms/hubdb/models/foreign_id.rb +243 -0
  19. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_clone_request.rb +241 -0
  20. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_row_v3.rb +291 -0
  21. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_row_v3_input.rb +243 -0
  22. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_v3.rb +383 -0
  23. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_v3_input.rb +295 -0
  24. data/lib/hubspot/codegen/cms/hubdb/models/hub_db_table_v3_live_input.rb +241 -0
  25. data/lib/hubspot/codegen/cms/hubdb/models/import_result.rb +263 -0
  26. data/lib/hubspot/codegen/cms/hubdb/models/next_page.rb +224 -0
  27. data/lib/hubspot/codegen/cms/hubdb/models/option.rb +257 -0
  28. data/lib/hubspot/codegen/cms/hubdb/models/paging.rb +219 -0
  29. data/lib/hubspot/codegen/cms/hubdb/models/previous_page.rb +224 -0
  30. data/lib/hubspot/codegen/cms/hubdb/models/simple_user.rb +257 -0
  31. data/lib/hubspot/version.rb +1 -1
  32. data/sample-apps/timeline-events-app/.env.template +1 -1
  33. data/sample-apps/timeline-events-app/Gemfile.lock +1 -1
  34. data/sample-apps/timeline-events-app/README.md +30 -0
  35. data/sample-apps/timeline-events-app/app/assets/stylesheets/application.css +78 -8
  36. data/sample-apps/timeline-events-app/app/controllers/timeline_events_controller.rb +1 -1
  37. data/sample-apps/timeline-events-app/app/views/timeline_events/index.html.erb +17 -19
  38. metadata +46 -12
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #HubDB endpoints
3
+
4
+ #HubDB is a relational data store that presents data as rows, columns, and cells in a table, much like a spreadsheet. HubDB tables can be added or modified [in the HubSpot CMS](https://knowledge.hubspot.com/cos-general/how-to-edit-hubdb-tables), but you can also use the API endpoints documented here. For more information on HubDB tables and using their data on a HubSpot site, see the [CMS developers site](https://designers.hubspot.com/docs/tools/hubdb). You can also see the [documentation for dynamic pages](https://designers.hubspot.com/docs/tutorials/how-to-build-dynamic-pages-with-hubdb) for more details about the `useForPages` field. HubDB tables now support `DRAFT` and `PUBLISHED` versions. This allows you to update data in the table, either for testing or to allow for a manual approval process, without affecting any live pages using the existing data. Draft data can be reviewed and published by a user working in HubSpot or published via the API. Draft data can also be discarded, allowing users to go back to the live version of the data without disrupting it.
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ module Hubspot
14
+ module Cms
15
+ module Hubdb
16
+ class Configuration
17
+ # Defines url scheme
18
+ attr_accessor :scheme
19
+
20
+ # Defines url host
21
+ attr_accessor :host
22
+
23
+ # Defines url base path
24
+ attr_accessor :base_path
25
+
26
+ # Defines API keys used with API Key authentications.
27
+ #
28
+ # @return [Hash] key: parameter name, value: parameter value (API key)
29
+ #
30
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
31
+ # config.api_key['api_key'] = 'xxx'
32
+ attr_accessor :api_key
33
+
34
+ # Defines API key prefixes used with API Key authentications.
35
+ #
36
+ # @return [Hash] key: parameter name, value: API key prefix
37
+ #
38
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
39
+ # config.api_key_prefix['api_key'] = 'Token'
40
+ attr_accessor :api_key_prefix
41
+
42
+ # Defines the username used with HTTP basic authentication.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :username
46
+
47
+ # Defines the password used with HTTP basic authentication.
48
+ #
49
+ # @return [String]
50
+ attr_accessor :password
51
+
52
+ # Defines the access token (Bearer) used with OAuth2.
53
+ attr_accessor :access_token
54
+
55
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
56
+ # details will be logged with `logger.debug` (see the `logger` attribute).
57
+ # Default to false.
58
+ #
59
+ # @return [true, false]
60
+ attr_accessor :debugging
61
+
62
+ # Defines the logger used for debugging.
63
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
64
+ #
65
+ # @return [#debug]
66
+ attr_accessor :logger
67
+
68
+ # Defines the temporary folder to store downloaded files
69
+ # (for API endpoints that have file response).
70
+ # Default to use `Tempfile`.
71
+ #
72
+ # @return [String]
73
+ attr_accessor :temp_folder_path
74
+
75
+ # The time limit for HTTP request in seconds.
76
+ # Default to 0 (never times out).
77
+ attr_accessor :timeout
78
+
79
+ # Set this to false to skip client side validation in the operation.
80
+ # Default to true.
81
+ # @return [true, false]
82
+ attr_accessor :client_side_validation
83
+
84
+ ### TLS/SSL setting
85
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
86
+ # Default to true.
87
+ #
88
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
89
+ #
90
+ # @return [true, false]
91
+ attr_accessor :ssl_verify
92
+
93
+ ### TLS/SSL setting
94
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
95
+ #
96
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
97
+ #
98
+ attr_accessor :ssl_verify_mode
99
+
100
+ ### TLS/SSL setting
101
+ # Set this to customize the certificate file to verify the peer.
102
+ #
103
+ # @return [String] the path to the certificate file
104
+ attr_accessor :ssl_ca_file
105
+
106
+ ### TLS/SSL setting
107
+ # Client certificate file (for client certificate)
108
+ attr_accessor :ssl_client_cert
109
+
110
+ ### TLS/SSL setting
111
+ # Client private key file (for client certificate)
112
+ attr_accessor :ssl_client_key
113
+
114
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
115
+ # Default to nil.
116
+ #
117
+ # @see The params_encoding option of Ethon. Related source code:
118
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
119
+ attr_accessor :params_encoding
120
+
121
+ attr_accessor :inject_format
122
+
123
+ attr_accessor :force_ending_format
124
+
125
+ attr_accessor :error_handler
126
+
127
+ def initialize
128
+ @scheme = 'https'
129
+ @host = 'api.hubapi.com'
130
+ @base_path = ''
131
+ @api_key = {}
132
+ @api_key_prefix = {}
133
+ @timeout = 0
134
+ @client_side_validation = true
135
+ @ssl_verify = true
136
+ @ssl_verify_mode = nil
137
+ @ssl_ca_file = nil
138
+ @ssl_client_cert = nil
139
+ @ssl_client_key = nil
140
+ @debugging = false
141
+ @inject_format = false
142
+ @force_ending_format = false
143
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
144
+ # error_handler params: { 'status_code': { max_retries: ..., seconds_delay: ... }, ... }
145
+ @error_handler = {}
146
+
147
+ yield(self) if block_given?
148
+ end
149
+
150
+ # The default Configuration object.
151
+ def self.default
152
+ @@default ||= Configuration.new
153
+ end
154
+
155
+ def configure
156
+ yield(self) if block_given?
157
+ end
158
+
159
+ def scheme=(scheme)
160
+ # remove :// from scheme
161
+ @scheme = scheme.sub(/:\/\//, '')
162
+ end
163
+
164
+ def host=(host)
165
+ # remove http(s):// and anything after a slash
166
+ @host = host.sub(/https?:\/\//, '').split('/').first
167
+ end
168
+
169
+ def base_path=(base_path)
170
+ # Add leading and trailing slashes to base_path
171
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
172
+ @base_path = '' if @base_path == '/'
173
+ end
174
+
175
+ def base_url
176
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
177
+ end
178
+
179
+ # Gets API key (with prefix if set).
180
+ # @param [String] param_name the parameter name of API key auth
181
+ def api_key_with_prefix(param_name)
182
+ if @api_key_prefix[param_name]
183
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
184
+ else
185
+ @api_key[param_name]
186
+ end
187
+ end
188
+
189
+ # Gets Basic Auth token string
190
+ def basic_auth_token
191
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
192
+ end
193
+
194
+ # Returns Auth Settings hash for api client.
195
+ def auth_settings
196
+ {
197
+ 'oauth2' =>
198
+ {
199
+ type: 'oauth2',
200
+ in: 'header',
201
+ key: 'Authorization',
202
+ value: "Bearer #{access_token}"
203
+ },
204
+ }
205
+ end
206
+
207
+ # Returns an array of Server setting
208
+ def server_settings
209
+ [
210
+ {
211
+ url: "https://api.hubapi.com/",
212
+ description: "No description provided",
213
+ }
214
+ ]
215
+ end
216
+
217
+ # Returns URL based on server settings
218
+ #
219
+ # @param index array index of the server settings
220
+ # @param variables hash of variable and the corresponding value
221
+ def server_url(index, variables = {})
222
+ servers = server_settings
223
+
224
+ # check array index out of bound
225
+ if (index < 0 || index >= servers.size)
226
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
227
+ end
228
+
229
+ server = servers[index]
230
+ url = server[:url]
231
+
232
+ # go through variable and assign a value
233
+ server[:variables].each do |name, variable|
234
+ if variables.key?(name)
235
+ if (server[:variables][name][:enum_values].include? variables[name])
236
+ url.gsub! "{" + name.to_s + "}", variables[name]
237
+ else
238
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
239
+ end
240
+ else
241
+ # use default value
242
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
243
+ end
244
+ end
245
+
246
+ url
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,217 @@
1
+ =begin
2
+ #HubDB endpoints
3
+
4
+ #HubDB is a relational data store that presents data as rows, columns, and cells in a table, much like a spreadsheet. HubDB tables can be added or modified [in the HubSpot CMS](https://knowledge.hubspot.com/cos-general/how-to-edit-hubdb-tables), but you can also use the API endpoints documented here. For more information on HubDB tables and using their data on a HubSpot site, see the [CMS developers site](https://designers.hubspot.com/docs/tools/hubdb). You can also see the [documentation for dynamic pages](https://designers.hubspot.com/docs/tutorials/how-to-build-dynamic-pages-with-hubdb) for more details about the `useForPages` field. HubDB tables now support `DRAFT` and `PUBLISHED` versions. This allows you to update data in the table, either for testing or to allow for a manual approval process, without affecting any live pages using the existing data. Draft data can be reviewed and published by a user working in HubSpot or published via the API. Draft data can also be discarded, allowing users to go back to the live version of the data without disrupting it.
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Hubspot
16
+ module Cms
17
+ module Hubdb
18
+ class BatchInputHubDbTableRowV3
19
+ attr_accessor :inputs
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'inputs' => :'inputs'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'inputs' => :'Array<HubDbTableRowV3>'
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::Hubdb::BatchInputHubDbTableRowV3` 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::Hubdb::BatchInputHubDbTableRowV3`. 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?(:'inputs')
57
+ if (value = attributes[:'inputs']).is_a?(Array)
58
+ self.inputs = value
59
+ end
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @inputs.nil?
68
+ invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
69
+ end
70
+
71
+ 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 @inputs.nil?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ inputs == o.inputs
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [inputs].hash
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 self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ Hubspot::Cms::Hubdb.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end