hubspot-api-client 20.0.0 → 20.1.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.
@@ -0,0 +1,452 @@
1
+ =begin
2
+ #Auth Oauth
3
+
4
+ #Basepom for all HubSpot Projects
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Oauth
18
+ module V3
19
+ class SignedAccessToken
20
+ attr_accessor :app_id
21
+
22
+ attr_accessor :app_install_id
23
+
24
+ attr_accessor :audience
25
+
26
+ attr_accessor :expires_at
27
+
28
+ attr_accessor :hub_id
29
+
30
+ attr_accessor :hublet
31
+
32
+ attr_accessor :installing_user_id
33
+
34
+ attr_accessor :is_private_distribution
35
+
36
+ attr_accessor :is_service_account
37
+
38
+ attr_accessor :is_user_level
39
+
40
+ attr_accessor :new_signature
41
+
42
+ attr_accessor :scope_to_scope_group_pks
43
+
44
+ attr_accessor :scopes
45
+
46
+ attr_accessor :signature
47
+
48
+ attr_accessor :trial_scope_to_scope_group_pks
49
+
50
+ attr_accessor :trial_scopes
51
+
52
+ attr_accessor :user_id
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'app_id' => :'appId',
58
+ :'app_install_id' => :'appInstallId',
59
+ :'audience' => :'audience',
60
+ :'expires_at' => :'expiresAt',
61
+ :'hub_id' => :'hubId',
62
+ :'hublet' => :'hublet',
63
+ :'installing_user_id' => :'installingUserId',
64
+ :'is_private_distribution' => :'isPrivateDistribution',
65
+ :'is_service_account' => :'isServiceAccount',
66
+ :'is_user_level' => :'isUserLevel',
67
+ :'new_signature' => :'newSignature',
68
+ :'scope_to_scope_group_pks' => :'scopeToScopeGroupPks',
69
+ :'scopes' => :'scopes',
70
+ :'signature' => :'signature',
71
+ :'trial_scope_to_scope_group_pks' => :'trialScopeToScopeGroupPks',
72
+ :'trial_scopes' => :'trialScopes',
73
+ :'user_id' => :'userId'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'app_id' => :'Integer',
86
+ :'app_install_id' => :'String',
87
+ :'audience' => :'String',
88
+ :'expires_at' => :'Integer',
89
+ :'hub_id' => :'Integer',
90
+ :'hublet' => :'String',
91
+ :'installing_user_id' => :'Integer',
92
+ :'is_private_distribution' => :'Boolean',
93
+ :'is_service_account' => :'Boolean',
94
+ :'is_user_level' => :'Boolean',
95
+ :'new_signature' => :'String',
96
+ :'scope_to_scope_group_pks' => :'String',
97
+ :'scopes' => :'String',
98
+ :'signature' => :'String',
99
+ :'trial_scope_to_scope_group_pks' => :'String',
100
+ :'trial_scopes' => :'String',
101
+ :'user_id' => :'Integer'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Oauth::V3::SignedAccessToken` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ attributes = attributes.each_with_object({}) { |(k, v), h|
120
+ if (!self.class.attribute_map.key?(k.to_sym))
121
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Oauth::V3::SignedAccessToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
122
+ end
123
+ h[k.to_sym] = v
124
+ }
125
+
126
+ if attributes.key?(:'app_id')
127
+ self.app_id = attributes[:'app_id']
128
+ end
129
+
130
+ if attributes.key?(:'app_install_id')
131
+ self.app_install_id = attributes[:'app_install_id']
132
+ end
133
+
134
+ if attributes.key?(:'audience')
135
+ self.audience = attributes[:'audience']
136
+ end
137
+
138
+ if attributes.key?(:'expires_at')
139
+ self.expires_at = attributes[:'expires_at']
140
+ end
141
+
142
+ if attributes.key?(:'hub_id')
143
+ self.hub_id = attributes[:'hub_id']
144
+ end
145
+
146
+ if attributes.key?(:'hublet')
147
+ self.hublet = attributes[:'hublet']
148
+ end
149
+
150
+ if attributes.key?(:'installing_user_id')
151
+ self.installing_user_id = attributes[:'installing_user_id']
152
+ end
153
+
154
+ if attributes.key?(:'is_private_distribution')
155
+ self.is_private_distribution = attributes[:'is_private_distribution']
156
+ end
157
+
158
+ if attributes.key?(:'is_service_account')
159
+ self.is_service_account = attributes[:'is_service_account']
160
+ end
161
+
162
+ if attributes.key?(:'is_user_level')
163
+ self.is_user_level = attributes[:'is_user_level']
164
+ end
165
+
166
+ if attributes.key?(:'new_signature')
167
+ self.new_signature = attributes[:'new_signature']
168
+ end
169
+
170
+ if attributes.key?(:'scope_to_scope_group_pks')
171
+ self.scope_to_scope_group_pks = attributes[:'scope_to_scope_group_pks']
172
+ end
173
+
174
+ if attributes.key?(:'scopes')
175
+ self.scopes = attributes[:'scopes']
176
+ end
177
+
178
+ if attributes.key?(:'signature')
179
+ self.signature = attributes[:'signature']
180
+ end
181
+
182
+ if attributes.key?(:'trial_scope_to_scope_group_pks')
183
+ self.trial_scope_to_scope_group_pks = attributes[:'trial_scope_to_scope_group_pks']
184
+ end
185
+
186
+ if attributes.key?(:'trial_scopes')
187
+ self.trial_scopes = attributes[:'trial_scopes']
188
+ end
189
+
190
+ if attributes.key?(:'user_id')
191
+ self.user_id = attributes[:'user_id']
192
+ end
193
+ end
194
+
195
+ # Show invalid properties with the reasons. Usually used together with valid?
196
+ # @return Array for valid properties with the reasons
197
+ def list_invalid_properties
198
+ invalid_properties = Array.new
199
+ if @app_id.nil?
200
+ invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
201
+ end
202
+
203
+ if @app_install_id.nil?
204
+ invalid_properties.push('invalid value for "app_install_id", app_install_id cannot be nil.')
205
+ end
206
+
207
+ if @audience.nil?
208
+ invalid_properties.push('invalid value for "audience", audience cannot be nil.')
209
+ end
210
+
211
+ if @expires_at.nil?
212
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
213
+ end
214
+
215
+ if @hub_id.nil?
216
+ invalid_properties.push('invalid value for "hub_id", hub_id cannot be nil.')
217
+ end
218
+
219
+ if @hublet.nil?
220
+ invalid_properties.push('invalid value for "hublet", hublet cannot be nil.')
221
+ end
222
+
223
+ if @installing_user_id.nil?
224
+ invalid_properties.push('invalid value for "installing_user_id", installing_user_id cannot be nil.')
225
+ end
226
+
227
+ if @is_private_distribution.nil?
228
+ invalid_properties.push('invalid value for "is_private_distribution", is_private_distribution cannot be nil.')
229
+ end
230
+
231
+ if @is_service_account.nil?
232
+ invalid_properties.push('invalid value for "is_service_account", is_service_account cannot be nil.')
233
+ end
234
+
235
+ if @is_user_level.nil?
236
+ invalid_properties.push('invalid value for "is_user_level", is_user_level cannot be nil.')
237
+ end
238
+
239
+ if @new_signature.nil?
240
+ invalid_properties.push('invalid value for "new_signature", new_signature cannot be nil.')
241
+ end
242
+
243
+ if @scope_to_scope_group_pks.nil?
244
+ invalid_properties.push('invalid value for "scope_to_scope_group_pks", scope_to_scope_group_pks cannot be nil.')
245
+ end
246
+
247
+ if @scopes.nil?
248
+ invalid_properties.push('invalid value for "scopes", scopes cannot be nil.')
249
+ end
250
+
251
+ if @signature.nil?
252
+ invalid_properties.push('invalid value for "signature", signature cannot be nil.')
253
+ end
254
+
255
+ if @trial_scope_to_scope_group_pks.nil?
256
+ invalid_properties.push('invalid value for "trial_scope_to_scope_group_pks", trial_scope_to_scope_group_pks cannot be nil.')
257
+ end
258
+
259
+ if @trial_scopes.nil?
260
+ invalid_properties.push('invalid value for "trial_scopes", trial_scopes cannot be nil.')
261
+ end
262
+
263
+ if @user_id.nil?
264
+ invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
265
+ end
266
+
267
+ invalid_properties
268
+ end
269
+
270
+ # Check to see if the all the properties in the model are valid
271
+ # @return true if the model is valid
272
+ def valid?
273
+ return false if @app_id.nil?
274
+ return false if @app_install_id.nil?
275
+ return false if @audience.nil?
276
+ return false if @expires_at.nil?
277
+ return false if @hub_id.nil?
278
+ return false if @hublet.nil?
279
+ return false if @installing_user_id.nil?
280
+ return false if @is_private_distribution.nil?
281
+ return false if @is_service_account.nil?
282
+ return false if @is_user_level.nil?
283
+ return false if @new_signature.nil?
284
+ return false if @scope_to_scope_group_pks.nil?
285
+ return false if @scopes.nil?
286
+ return false if @signature.nil?
287
+ return false if @trial_scope_to_scope_group_pks.nil?
288
+ return false if @trial_scopes.nil?
289
+ return false if @user_id.nil?
290
+ true
291
+ end
292
+
293
+ # Checks equality by comparing each attribute.
294
+ # @param [Object] Object to be compared
295
+ def ==(o)
296
+ return true if self.equal?(o)
297
+ self.class == o.class &&
298
+ app_id == o.app_id &&
299
+ app_install_id == o.app_install_id &&
300
+ audience == o.audience &&
301
+ expires_at == o.expires_at &&
302
+ hub_id == o.hub_id &&
303
+ hublet == o.hublet &&
304
+ installing_user_id == o.installing_user_id &&
305
+ is_private_distribution == o.is_private_distribution &&
306
+ is_service_account == o.is_service_account &&
307
+ is_user_level == o.is_user_level &&
308
+ new_signature == o.new_signature &&
309
+ scope_to_scope_group_pks == o.scope_to_scope_group_pks &&
310
+ scopes == o.scopes &&
311
+ signature == o.signature &&
312
+ trial_scope_to_scope_group_pks == o.trial_scope_to_scope_group_pks &&
313
+ trial_scopes == o.trial_scopes &&
314
+ user_id == o.user_id
315
+ end
316
+
317
+ # @see the `==` method
318
+ # @param [Object] Object to be compared
319
+ def eql?(o)
320
+ self == o
321
+ end
322
+
323
+ # Calculates hash code according to all attributes.
324
+ # @return [Integer] Hash code
325
+ def hash
326
+ [app_id, app_install_id, audience, expires_at, hub_id, hublet, installing_user_id, is_private_distribution, is_service_account, is_user_level, new_signature, scope_to_scope_group_pks, scopes, signature, trial_scope_to_scope_group_pks, trial_scopes, user_id].hash
327
+ end
328
+
329
+ # Builds the object from hash
330
+ # @param [Hash] attributes Model attributes in the form of hash
331
+ # @return [Object] Returns the model itself
332
+ def self.build_from_hash(attributes)
333
+ new.build_from_hash(attributes)
334
+ end
335
+
336
+ # Builds the object from hash
337
+ # @param [Hash] attributes Model attributes in the form of hash
338
+ # @return [Object] Returns the model itself
339
+ def build_from_hash(attributes)
340
+ return nil unless attributes.is_a?(Hash)
341
+ attributes = attributes.transform_keys(&:to_sym)
342
+ self.class.openapi_types.each_pair do |key, type|
343
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
344
+ self.send("#{key}=", nil)
345
+ elsif type =~ /\AArray<(.*)>/i
346
+ # check to ensure the input is an array given that the attribute
347
+ # is documented as an array but the input is not
348
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
349
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
350
+ end
351
+ elsif !attributes[self.class.attribute_map[key]].nil?
352
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
353
+ end
354
+ end
355
+
356
+ self
357
+ end
358
+
359
+ # Deserializes the data based on type
360
+ # @param string type Data type
361
+ # @param string value Value to be deserialized
362
+ # @return [Object] Deserialized data
363
+ def _deserialize(type, value)
364
+ case type.to_sym
365
+ when :Time
366
+ Time.parse(value)
367
+ when :Date
368
+ Date.parse(value)
369
+ when :String
370
+ value.to_s
371
+ when :Integer
372
+ value.to_i
373
+ when :Float
374
+ value.to_f
375
+ when :Boolean
376
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
377
+ true
378
+ else
379
+ false
380
+ end
381
+ when :Object
382
+ # generic object (usually a Hash), return directly
383
+ value
384
+ when /\AArray<(?<inner_type>.+)>\z/
385
+ inner_type = Regexp.last_match[:inner_type]
386
+ value.map { |v| _deserialize(inner_type, v) }
387
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
388
+ k_type = Regexp.last_match[:k_type]
389
+ v_type = Regexp.last_match[:v_type]
390
+ {}.tap do |hash|
391
+ value.each do |k, v|
392
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
393
+ end
394
+ end
395
+ else # model
396
+ # models (e.g. Pet) or oneOf
397
+ klass = Hubspot::Oauth::V3.const_get(type)
398
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
399
+ end
400
+ end
401
+
402
+ # Returns the string representation of the object
403
+ # @return [String] String presentation of the object
404
+ def to_s
405
+ to_hash.to_s
406
+ end
407
+
408
+ # to_body is an alias to to_hash (backward compatibility)
409
+ # @return [Hash] Returns the object in the form of hash
410
+ def to_body
411
+ to_hash
412
+ end
413
+
414
+ # Returns the object in the form of hash
415
+ # @return [Hash] Returns the object in the form of hash
416
+ def to_hash
417
+ hash = {}
418
+ self.class.attribute_map.each_pair do |attr, param|
419
+ value = self.send(attr)
420
+ if value.nil?
421
+ is_nullable = self.class.openapi_nullable.include?(attr)
422
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
423
+ end
424
+
425
+ hash[param] = _to_hash(value)
426
+ end
427
+ hash
428
+ end
429
+
430
+ # Outputs non-array value in the form of hash
431
+ # For object, use to_hash. Otherwise, just return the value
432
+ # @param [Object] value Any valid value
433
+ # @return [Hash] Returns the value in the form of hash
434
+ def _to_hash(value)
435
+ if value.is_a?(Array)
436
+ value.compact.map { |v| _to_hash(v) }
437
+ elsif value.is_a?(Hash)
438
+ {}.tap do |hash|
439
+ value.each { |k, v| hash[k] = _to_hash(v) }
440
+ end
441
+ elsif value.respond_to? :to_hash
442
+ value.to_hash
443
+ else
444
+ value
445
+ end
446
+ end
447
+
448
+ end
449
+
450
+ end
451
+ end
452
+ end
@@ -0,0 +1,59 @@
1
+ =begin
2
+ #Auth Oauth
3
+
4
+ #Basepom for all HubSpot Projects
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Oauth
18
+ module V3
19
+ module TokenInfoResponseBaseIF
20
+ class << self
21
+ # List of class defined in oneOf (OpenAPI v3)
22
+ def openapi_one_of
23
+ [
24
+ :'PublicAccessTokenInfoResponse',
25
+ :'PublicRefreshTokenInfoResponse'
26
+ ]
27
+ end
28
+
29
+ # Discriminator's property name (OpenAPI v3)
30
+ def openapi_discriminator_name
31
+ :'token_use'
32
+ end
33
+
34
+ # Discriminator's mapping (OpenAPI v3)
35
+ def openapi_discriminator_mapping
36
+ {
37
+ :'access_token' => :'PublicAccessTokenInfoResponse',
38
+ :'refresh_token' => :'PublicRefreshTokenInfoResponse'
39
+ }
40
+ end
41
+
42
+ # Builds the object
43
+ # @param [Mixed] Data to be matched against the list of oneOf items
44
+ # @return [Object] Returns the model or the data itself
45
+ def build(data)
46
+ discriminator_value = data[openapi_discriminator_name]
47
+ return nil if discriminator_value.nil?
48
+
49
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
50
+ return nil unless klass
51
+
52
+ Hubspot::Oauth::V3.const_get(klass).build_from_hash(data)
53
+ end
54
+ end
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,59 @@
1
+ =begin
2
+ #Auth Oauth
3
+
4
+ #Basepom for all HubSpot Projects
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Oauth
18
+ module V3
19
+ module TokenResponseIF
20
+ class << self
21
+ # List of class defined in oneOf (OpenAPI v3)
22
+ def openapi_one_of
23
+ [
24
+ :'AccessTokenResponse',
25
+ :'ClientCredentialsTokenResponse'
26
+ ]
27
+ end
28
+
29
+ # Discriminator's property name (OpenAPI v3)
30
+ def openapi_discriminator_name
31
+ :'token_use'
32
+ end
33
+
34
+ # Discriminator's mapping (OpenAPI v3)
35
+ def openapi_discriminator_mapping
36
+ {
37
+ :'access_token' => :'AccessTokenResponse',
38
+ :'client_credentials' => :'ClientCredentialsTokenResponse'
39
+ }
40
+ end
41
+
42
+ # Builds the object
43
+ # @param [Mixed] Data to be matched against the list of oneOf items
44
+ # @return [Object] Returns the model or the data itself
45
+ def build(data)
46
+ discriminator_value = data[openapi_discriminator_name]
47
+ return nil if discriminator_value.nil?
48
+
49
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
50
+ return nil unless klass
51
+
52
+ Hubspot::Oauth::V3.const_get(klass).build_from_hash(data)
53
+ end
54
+ end
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -55,7 +55,7 @@ module Hubspot
55
55
  end
56
56
 
57
57
  def require_api_models
58
- def (Kernel.const_get(codegen_module_name)).const_get(const)
58
+ def (Kernel.const_get(codegen_module_name)).const_get(const, *)
59
59
  require 'hubspot/helpers/path'
60
60
  codegen_module_path = Hubspot::Helpers::Path.new.format(self.name).gsub('hubspot/', 'hubspot/codegen/')
61
61
  codegen_model = Hubspot::Helpers::Path.new.format(const)
@@ -6,6 +6,12 @@ module Hubspot
6
6
  class Client
7
7
  include Hubspot::Discovery::BaseModuleClient
8
8
 
9
+ def api_modules
10
+ %i[
11
+ v3
12
+ ].freeze
13
+ end
14
+
9
15
  def api_classes
10
16
  %i[
11
17
  access_tokens
@@ -0,0 +1,13 @@
1
+ require_relative '../../../base_api_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Oauth
6
+ module V3
7
+ class AdvancedApi
8
+ include Hubspot::Discovery::BaseApiClient
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../base_module_client'
2
+
3
+ module Hubspot
4
+ module Discovery
5
+ module Oauth
6
+ module V3
7
+ class Client
8
+ include Hubspot::Discovery::BaseModuleClient
9
+
10
+ def api_classes
11
+ %i[
12
+ advanced
13
+ ].freeze
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end