hubspot-api-client 9.4.0 → 9.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/hubspot/codegen/conversations/visitor-identification/api/generate_api.rb +90 -0
  5. data/lib/hubspot/codegen/conversations/visitor-identification/api_client.rb +392 -0
  6. data/lib/hubspot/codegen/conversations/visitor-identification/api_error.rb +61 -0
  7. data/lib/hubspot/codegen/conversations/visitor-identification/configuration.rb +263 -0
  8. data/lib/hubspot/codegen/conversations/visitor-identification/models/error.rb +292 -0
  9. data/lib/hubspot/codegen/conversations/visitor-identification/models/error_detail.rb +258 -0
  10. data/lib/hubspot/codegen/conversations/visitor-identification/models/identification_token_generation_request.rb +236 -0
  11. data/lib/hubspot/codegen/conversations/visitor-identification/models/identification_token_response.rb +215 -0
  12. data/lib/hubspot/codegen/events/api/events_api.rb +105 -0
  13. data/lib/hubspot/codegen/events/api_client.rb +390 -0
  14. data/lib/hubspot/codegen/events/api_error.rb +59 -0
  15. data/lib/hubspot/codegen/events/configuration.rb +261 -0
  16. data/lib/hubspot/codegen/events/models/collection_response_external_unified_event.rb +224 -0
  17. data/lib/hubspot/codegen/events/models/error.rb +290 -0
  18. data/lib/hubspot/codegen/events/models/error_detail.rb +256 -0
  19. data/lib/hubspot/codegen/events/models/external_unified_event.rb +290 -0
  20. data/lib/hubspot/codegen/events/models/next_page.rb +222 -0
  21. data/lib/hubspot/codegen/events/models/paging.rb +208 -0
  22. data/lib/hubspot/version.rb +1 -1
  23. data/spec/codegen/conversations/visitor-identification/api/generate_api_spec.rb +47 -0
  24. data/spec/codegen/conversations/visitor-identification/models/error_detail_spec.rb +65 -0
  25. data/spec/codegen/conversations/visitor-identification/models/error_spec.rb +77 -0
  26. data/spec/codegen/conversations/visitor-identification/models/identification_token_generation_request_spec.rb +53 -0
  27. data/spec/codegen/conversations/visitor-identification/models/identification_token_response_spec.rb +41 -0
  28. data/spec/codegen/events/api/events_api_spec.rb +54 -0
  29. data/spec/codegen/events/models/collection_response_external_unified_event_spec.rb +47 -0
  30. data/spec/codegen/events/models/error_detail_spec.rb +65 -0
  31. data/spec/codegen/events/models/error_spec.rb +77 -0
  32. data/spec/codegen/events/models/external_unified_event_spec.rb +71 -0
  33. data/spec/codegen/events/models/next_page_spec.rb +47 -0
  34. data/spec/codegen/events/models/paging_spec.rb +41 -0
  35. data/spec/features/conversations/visitor-identification/generate_api_spec.rb +7 -0
  36. data/spec/features/events/events_api_spec.rb +7 -0
  37. metadata +48 -2
@@ -0,0 +1,61 @@
1
+ =begin
2
+ #Visitor Identification
3
+
4
+ #The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system.
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 Conversations
15
+ module VisitorIdentification
16
+ class ApiError < StandardError
17
+ attr_reader :code, :response_headers, :response_body
18
+
19
+ # Usage examples:
20
+ # ApiError.new
21
+ # ApiError.new("message")
22
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
23
+ # ApiError.new(:code => 404, :message => "Not Found")
24
+ def initialize(arg = nil)
25
+ if arg.is_a? Hash
26
+ if arg.key?(:message) || arg.key?('message')
27
+ super(arg[:message] || arg['message'])
28
+ else
29
+ super arg
30
+ end
31
+
32
+ arg.each do |k, v|
33
+ instance_variable_set "@#{k}", v
34
+ end
35
+ else
36
+ super arg
37
+ end
38
+ end
39
+
40
+ # Override to_s to display a friendly error message
41
+ def to_s
42
+ message
43
+ end
44
+
45
+ def message
46
+ if @message.nil?
47
+ msg = "Error message: the server returns an error"
48
+ else
49
+ msg = @message
50
+ end
51
+
52
+ msg += "\nHTTP status code: #{code}" if code
53
+ msg += "\nResponse headers: #{response_headers}" if response_headers
54
+ msg += "\nResponse body: #{response_body}" if response_body
55
+
56
+ msg
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,263 @@
1
+ =begin
2
+ #Visitor Identification
3
+
4
+ #The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system.
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 Conversations
15
+ module VisitorIdentification
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 :verify_ssl
92
+
93
+ ### TLS/SSL setting
94
+ # Set this to false to skip verifying SSL host name
95
+ # Default to true.
96
+ #
97
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
98
+ #
99
+ # @return [true, false]
100
+ attr_accessor :verify_ssl_host
101
+
102
+ ### TLS/SSL setting
103
+ # Set this to customize the certificate file to verify the peer.
104
+ #
105
+ # @return [String] the path to the certificate file
106
+ #
107
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
108
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
109
+ attr_accessor :ssl_ca_cert
110
+
111
+ ### TLS/SSL setting
112
+ # Client certificate file (for client certificate)
113
+ attr_accessor :cert_file
114
+
115
+ ### TLS/SSL setting
116
+ # Client private key file (for client certificate)
117
+ attr_accessor :key_file
118
+
119
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
120
+ # Default to nil.
121
+ #
122
+ # @see The params_encoding option of Ethon. Related source code:
123
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
124
+ attr_accessor :params_encoding
125
+
126
+ attr_accessor :inject_format
127
+
128
+ attr_accessor :force_ending_format
129
+
130
+ attr_accessor :error_handler
131
+
132
+ def initialize
133
+ @scheme = 'https'
134
+ @host = 'api.hubapi.com'
135
+ @base_path = ''
136
+ @api_key = {}
137
+ @api_key_prefix = {}
138
+ @timeout = 0
139
+ @client_side_validation = true
140
+ @verify_ssl = true
141
+ @verify_ssl_host = true
142
+ @params_encoding = nil
143
+ @cert_file = nil
144
+ @key_file = nil
145
+ @debugging = false
146
+ @inject_format = false
147
+ @force_ending_format = false
148
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
149
+ # error_handler params: { 'status_code': { max_retries: ..., seconds_delay: ... }, ... }
150
+ @error_handler = {}
151
+
152
+ yield(self) if block_given?
153
+ end
154
+
155
+ # The default Configuration object.
156
+ def self.default
157
+ @@default ||= Configuration.new
158
+ end
159
+
160
+ def configure
161
+ yield(self) if block_given?
162
+ end
163
+
164
+ def scheme=(scheme)
165
+ # remove :// from scheme
166
+ @scheme = scheme.sub(/:\/\//, '')
167
+ end
168
+
169
+ def host=(host)
170
+ # remove http(s):// and anything after a slash
171
+ @host = host.sub(/https?:\/\//, '').split('/').first
172
+ end
173
+
174
+ def base_path=(base_path)
175
+ # Add leading and trailing slashes to base_path
176
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
177
+ @base_path = '' if @base_path == '/'
178
+ end
179
+
180
+ def base_url
181
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
182
+ end
183
+
184
+ # Gets API key (with prefix if set).
185
+ # @param [String] param_name the parameter name of API key auth
186
+ def api_key_with_prefix(param_name)
187
+ if @api_key_prefix[param_name]
188
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
189
+ else
190
+ @api_key[param_name]
191
+ end
192
+ end
193
+
194
+ # Gets Basic Auth token string
195
+ def basic_auth_token
196
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
197
+ end
198
+
199
+ # Returns Auth Settings hash for api client.
200
+ def auth_settings
201
+ {
202
+ 'hapikey' =>
203
+ {
204
+ type: 'api_key',
205
+ in: 'query',
206
+ key: 'hapikey',
207
+ value: api_key_with_prefix('hapikey')
208
+ },
209
+ 'oauth2' =>
210
+ {
211
+ type: 'oauth2',
212
+ in: 'header',
213
+ key: 'Authorization',
214
+ value: "Bearer #{access_token}"
215
+ },
216
+ }
217
+ end
218
+
219
+ # Returns an array of Server setting
220
+ def server_settings
221
+ [
222
+ {
223
+ url: "https://api.hubapi.com/",
224
+ description: "No description provided",
225
+ }
226
+ ]
227
+ end
228
+
229
+ # Returns URL based on server settings
230
+ #
231
+ # @param index array index of the server settings
232
+ # @param variables hash of variable and the corresponding value
233
+ def server_url(index, variables = {})
234
+ servers = server_settings
235
+
236
+ # check array index out of bound
237
+ if (index < 0 || index >= servers.size)
238
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
239
+ end
240
+
241
+ server = servers[index]
242
+ url = server[:url]
243
+
244
+ # go through variable and assign a value
245
+ server[:variables].each do |name, variable|
246
+ if variables.key?(name)
247
+ if (server[:variables][name][:enum_values].include? variables[name])
248
+ url.gsub! "{" + name.to_s + "}", variables[name]
249
+ else
250
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
251
+ end
252
+ else
253
+ # use default value
254
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
255
+ end
256
+ end
257
+
258
+ url
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end
@@ -0,0 +1,292 @@
1
+ =begin
2
+ #Visitor Identification
3
+
4
+ #The Visitor Identification API allows you to pass identification information to the HubSpot chat widget for otherwise unknown visitors that were verified by your own authentication system.
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 Conversations
17
+ module VisitorIdentification
18
+ class Error
19
+ # A human readable message describing the error along with remediation steps where appropriate
20
+ attr_accessor :message
21
+
22
+ # A unique identifier for the request. Include this value with any error reports or support tickets
23
+ attr_accessor :correlation_id
24
+
25
+ # The error category
26
+ attr_accessor :category
27
+
28
+ # A specific category that contains more specific detail about the error
29
+ attr_accessor :sub_category
30
+
31
+ # further information about the error
32
+ attr_accessor :errors
33
+
34
+ # Context about the error condition
35
+ attr_accessor :context
36
+
37
+ # A map of link names to associated URIs containing documentation about the error or recommended remediation steps
38
+ attr_accessor :links
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'message' => :'message',
44
+ :'correlation_id' => :'correlationId',
45
+ :'category' => :'category',
46
+ :'sub_category' => :'subCategory',
47
+ :'errors' => :'errors',
48
+ :'context' => :'context',
49
+ :'links' => :'links'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'message' => :'String',
57
+ :'correlation_id' => :'String',
58
+ :'category' => :'String',
59
+ :'sub_category' => :'String',
60
+ :'errors' => :'Array<ErrorDetail>',
61
+ :'context' => :'Hash<String, Array<String>>',
62
+ :'links' => :'Hash<String, String>'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Conversations::VisitorIdentification::Error` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Conversations::VisitorIdentification::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'message')
88
+ self.message = attributes[:'message']
89
+ end
90
+
91
+ if attributes.key?(:'correlation_id')
92
+ self.correlation_id = attributes[:'correlation_id']
93
+ end
94
+
95
+ if attributes.key?(:'category')
96
+ self.category = attributes[:'category']
97
+ end
98
+
99
+ if attributes.key?(:'sub_category')
100
+ self.sub_category = attributes[:'sub_category']
101
+ end
102
+
103
+ if attributes.key?(:'errors')
104
+ if (value = attributes[:'errors']).is_a?(Array)
105
+ self.errors = value
106
+ end
107
+ end
108
+
109
+ if attributes.key?(:'context')
110
+ if (value = attributes[:'context']).is_a?(Hash)
111
+ self.context = value
112
+ end
113
+ end
114
+
115
+ if attributes.key?(:'links')
116
+ if (value = attributes[:'links']).is_a?(Hash)
117
+ self.links = value
118
+ end
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ if @message.nil?
127
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
128
+ end
129
+
130
+ if @correlation_id.nil?
131
+ invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.')
132
+ end
133
+
134
+ if @category.nil?
135
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ return false if @message.nil?
145
+ return false if @correlation_id.nil?
146
+ return false if @category.nil?
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ message == o.message &&
156
+ correlation_id == o.correlation_id &&
157
+ category == o.category &&
158
+ sub_category == o.sub_category &&
159
+ errors == o.errors &&
160
+ context == o.context &&
161
+ links == o.links
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [message, correlation_id, category, sub_category, errors, context, links].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ new.build_from_hash(attributes)
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def build_from_hash(attributes)
187
+ return nil unless attributes.is_a?(Hash)
188
+ self.class.openapi_types.each_pair do |key, type|
189
+ if type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
193
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
198
+ end
199
+
200
+ self
201
+ end
202
+
203
+ # Deserializes the data based on type
204
+ # @param string type Data type
205
+ # @param string value Value to be deserialized
206
+ # @return [Object] Deserialized data
207
+ def _deserialize(type, value)
208
+ case type.to_sym
209
+ when :DateTime
210
+ DateTime.parse(value)
211
+ when :Date
212
+ Date.parse(value)
213
+ when :String
214
+ value.to_s
215
+ when :Integer
216
+ value.to_i
217
+ when :Float
218
+ value.to_f
219
+ when :Boolean
220
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
+ true
222
+ else
223
+ false
224
+ end
225
+ when :Object
226
+ # generic object (usually a Hash), return directly
227
+ value
228
+ when /\AArray<(?<inner_type>.+)>\z/
229
+ inner_type = Regexp.last_match[:inner_type]
230
+ value.map { |v| _deserialize(inner_type, v) }
231
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
+ k_type = Regexp.last_match[:k_type]
233
+ v_type = Regexp.last_match[:v_type]
234
+ {}.tap do |hash|
235
+ value.each do |k, v|
236
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
+ end
238
+ end
239
+ else # model
240
+ Hubspot::Conversations::VisitorIdentification.const_get(type).build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+ end
290
+ end
291
+ end
292
+ end