hubspot-api-client 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7c8fa41edef712ea11678118f9dbabc7cae5e2e60631e88d71c33b92fd8a4a8
4
- data.tar.gz: 2165bf3bd75421e0e26be06597dbc297d822c4a391cd0d73ac01dcea4c3760b9
3
+ metadata.gz: 2be582cb04c97f51227502c99c87b197d0fbfdb2ab7f4b1b8da6efaa0c9ee059
4
+ data.tar.gz: 7460b8e1c2f0669168fc120e810b439c2ed145e3ccee51cff501a4701d055ace
5
5
  SHA512:
6
- metadata.gz: 16c4f85559b1d262624e746f07e96007d1175041be127f362cd4d82f84d70c98fe4f6e1081b192bce07536478f708738bad0831560571a8027ac3acf9f0e7d2e
7
- data.tar.gz: 238c6af4df62a4607fca121252de8cbdae30d37df1801bc89fd0cf4dde74da147d48a95c55087dfa5a7a7d29555cb62b42bd17d6fbcccc708a2aebdc0bd67e2d
6
+ metadata.gz: f439e5b8db3299ebaddfcd39bdba84846dc069eb2c871f64480736e9c1c628413635507a751964cfa3265d8a712f9261d8d983425f16cff83cd9b11111129c0b
7
+ data.tar.gz: '006007924401ab0cd47c612efd7960453fa045c6fdd9550846750d6e21672c9439e4840ef4d81cedc950e393bc57bcc4da46ebae8c5308323274ff15e308567c'
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0] - 2020-05-06
9
+
10
+ - Rename imports#get_all to get_page method
11
+ - Update Webhooks client
12
+
8
13
  ## [3.1.1] - 2020-05-04
9
14
 
10
15
  - Add Imports api client to common configuration
@@ -372,10 +372,13 @@ require 'hubspot/codegen/webhooks/api_error'
372
372
  require 'hubspot/codegen/webhooks/configuration'
373
373
  require 'hubspot/codegen/webhooks/api/settings_api'
374
374
  require 'hubspot/codegen/webhooks/api/subscriptions_api'
375
+ require 'hubspot/codegen/webhooks/models/batch_input_subscription_batch_update_request'
376
+ require 'hubspot/codegen/webhooks/models/batch_response_subscription_response'
375
377
  require 'hubspot/codegen/webhooks/models/error'
376
378
  require 'hubspot/codegen/webhooks/models/error_detail'
377
379
  require 'hubspot/codegen/webhooks/models/settings_change_request'
378
380
  require 'hubspot/codegen/webhooks/models/settings_response'
381
+ require 'hubspot/codegen/webhooks/models/subscription_batch_update_request'
379
382
  require 'hubspot/codegen/webhooks/models/subscription_create_request'
380
383
  require 'hubspot/codegen/webhooks/models/subscription_list_response'
381
384
  require 'hubspot/codegen/webhooks/models/subscription_patch_request'
@@ -383,7 +386,6 @@ require 'hubspot/codegen/webhooks/models/subscription_response'
383
386
  require 'hubspot/codegen/webhooks/models/throttling_settings'
384
387
 
385
388
 
386
-
387
389
  module Hubspot
388
390
  class << self
389
391
  CLIENTS = [
@@ -147,37 +147,34 @@ module Hubspot
147
147
  return data, status_code, headers
148
148
  end
149
149
 
150
- # Get active imports
151
- # Returns a paged list of active imports for this account.
150
+ # Get the information on any import
151
+ # A complete summary of an import record, including any updates.
152
+ # @param import_id [Integer]
152
153
  # @param [Hash] opts the optional parameters
153
- # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.
154
- # @option opts [String] :before
155
- # @option opts [Integer] :limit The maximum number of results to display per page.
156
- # @return [CollectionResponsePublicImportResponse]
157
- def get_all(opts = {})
158
- data, _status_code, _headers = get_all_with_http_info(opts)
154
+ # @return [PublicImportResponse]
155
+ def get_by_id(import_id, opts = {})
156
+ data, _status_code, _headers = get_by_id_with_http_info(import_id, opts)
159
157
  data
160
158
  end
161
159
 
162
- # Get active imports
163
- # Returns a paged list of active imports for this account.
160
+ # Get the information on any import
161
+ # A complete summary of an import record, including any updates.
162
+ # @param import_id [Integer]
164
163
  # @param [Hash] opts the optional parameters
165
- # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.
166
- # @option opts [String] :before
167
- # @option opts [Integer] :limit The maximum number of results to display per page.
168
- # @return [Array<(CollectionResponsePublicImportResponse, Integer, Hash)>] CollectionResponsePublicImportResponse data, response status code and response headers
169
- def get_all_with_http_info(opts = {})
164
+ # @return [Array<(PublicImportResponse, Integer, Hash)>] PublicImportResponse data, response status code and response headers
165
+ def get_by_id_with_http_info(import_id, opts = {})
170
166
  if @api_client.config.debugging
171
- @api_client.config.logger.debug 'Calling API: CoreApi.get_all ...'
167
+ @api_client.config.logger.debug 'Calling API: CoreApi.get_by_id ...'
168
+ end
169
+ # verify the required parameter 'import_id' is set
170
+ if @api_client.config.client_side_validation && import_id.nil?
171
+ fail ArgumentError, "Missing the required parameter 'import_id' when calling CoreApi.get_by_id"
172
172
  end
173
173
  # resource path
174
- local_var_path = '/crm/v3/imports/'
174
+ local_var_path = '/crm/v3/imports/{importId}'.sub('{' + 'importId' + '}', CGI.escape(import_id.to_s))
175
175
 
176
176
  # query parameters
177
177
  query_params = opts[:query_params] || {}
178
- query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
179
- query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
180
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
181
178
 
182
179
  # header parameters
183
180
  header_params = opts[:header_params] || {}
@@ -191,7 +188,7 @@ module Hubspot
191
188
  post_body = opts[:body]
192
189
 
193
190
  # return_type
194
- return_type = opts[:return_type] || 'CollectionResponsePublicImportResponse'
191
+ return_type = opts[:return_type] || 'PublicImportResponse'
195
192
 
196
193
  # auth_names
197
194
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']
@@ -207,39 +204,42 @@ module Hubspot
207
204
 
208
205
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
209
206
  if @api_client.config.debugging
210
- @api_client.config.logger.debug "API called: CoreApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
207
+ @api_client.config.logger.debug "API called: CoreApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
211
208
  end
212
209
  return data, status_code, headers
213
210
  end
214
211
 
215
- # Get the information on any import
216
- # A complete summary of an import record, including any updates.
217
- # @param import_id [Integer]
212
+ # Get active imports
213
+ # Returns a paged list of active imports for this account.
218
214
  # @param [Hash] opts the optional parameters
219
- # @return [PublicImportResponse]
220
- def get_by_id(import_id, opts = {})
221
- data, _status_code, _headers = get_by_id_with_http_info(import_id, opts)
215
+ # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.
216
+ # @option opts [String] :before
217
+ # @option opts [Integer] :limit The maximum number of results to display per page.
218
+ # @return [CollectionResponsePublicImportResponse]
219
+ def get_page(opts = {})
220
+ data, _status_code, _headers = get_page_with_http_info(opts)
222
221
  data
223
222
  end
224
223
 
225
- # Get the information on any import
226
- # A complete summary of an import record, including any updates.
227
- # @param import_id [Integer]
224
+ # Get active imports
225
+ # Returns a paged list of active imports for this account.
228
226
  # @param [Hash] opts the optional parameters
229
- # @return [Array<(PublicImportResponse, Integer, Hash)>] PublicImportResponse data, response status code and response headers
230
- def get_by_id_with_http_info(import_id, opts = {})
227
+ # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.
228
+ # @option opts [String] :before
229
+ # @option opts [Integer] :limit The maximum number of results to display per page.
230
+ # @return [Array<(CollectionResponsePublicImportResponse, Integer, Hash)>] CollectionResponsePublicImportResponse data, response status code and response headers
231
+ def get_page_with_http_info(opts = {})
231
232
  if @api_client.config.debugging
232
- @api_client.config.logger.debug 'Calling API: CoreApi.get_by_id ...'
233
- end
234
- # verify the required parameter 'import_id' is set
235
- if @api_client.config.client_side_validation && import_id.nil?
236
- fail ArgumentError, "Missing the required parameter 'import_id' when calling CoreApi.get_by_id"
233
+ @api_client.config.logger.debug 'Calling API: CoreApi.get_page ...'
237
234
  end
238
235
  # resource path
239
- local_var_path = '/crm/v3/imports/{importId}'.sub('{' + 'importId' + '}', CGI.escape(import_id.to_s))
236
+ local_var_path = '/crm/v3/imports/'
240
237
 
241
238
  # query parameters
242
239
  query_params = opts[:query_params] || {}
240
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
241
+ query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
242
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
243
243
 
244
244
  # header parameters
245
245
  header_params = opts[:header_params] || {}
@@ -253,7 +253,7 @@ module Hubspot
253
253
  post_body = opts[:body]
254
254
 
255
255
  # return_type
256
- return_type = opts[:return_type] || 'PublicImportResponse'
256
+ return_type = opts[:return_type] || 'CollectionResponsePublicImportResponse'
257
257
 
258
258
  # auth_names
259
259
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']
@@ -269,7 +269,7 @@ module Hubspot
269
269
 
270
270
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
271
271
  if @api_client.config.debugging
272
- @api_client.config.logger.debug "API called: CoreApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
272
+ @api_client.config.logger.debug "API called: CoreApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
273
273
  end
274
274
  return data, status_code, headers
275
275
  end
@@ -359,6 +359,76 @@ module Hubspot
359
359
  end
360
360
  return data, status_code, headers
361
361
  end
362
+
363
+ # Batch update subscriptions
364
+ # Activates or deactivates specified subscriptions for the given app.
365
+ # @param app_id [Integer] The ID of the target app.
366
+ # @param batch_input_subscription_batch_update_request [BatchInputSubscriptionBatchUpdateRequest] Collection of updated details for the specified subscription.
367
+ # @param [Hash] opts the optional parameters
368
+ # @return [BatchResponseSubscriptionResponse]
369
+ def update_batch(app_id, batch_input_subscription_batch_update_request, opts = {})
370
+ data, _status_code, _headers = update_batch_with_http_info(app_id, batch_input_subscription_batch_update_request, opts)
371
+ data
372
+ end
373
+
374
+ # Batch update subscriptions
375
+ # Activates or deactivates specified subscriptions for the given app.
376
+ # @param app_id [Integer] The ID of the target app.
377
+ # @param batch_input_subscription_batch_update_request [BatchInputSubscriptionBatchUpdateRequest] Collection of updated details for the specified subscription.
378
+ # @param [Hash] opts the optional parameters
379
+ # @return [Array<(BatchResponseSubscriptionResponse, Integer, Hash)>] BatchResponseSubscriptionResponse data, response status code and response headers
380
+ def update_batch_with_http_info(app_id, batch_input_subscription_batch_update_request, opts = {})
381
+ if @api_client.config.debugging
382
+ @api_client.config.logger.debug 'Calling API: SubscriptionsApi.update_batch ...'
383
+ end
384
+ # verify the required parameter 'app_id' is set
385
+ if @api_client.config.client_side_validation && app_id.nil?
386
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling SubscriptionsApi.update_batch"
387
+ end
388
+ # verify the required parameter 'batch_input_subscription_batch_update_request' is set
389
+ if @api_client.config.client_side_validation && batch_input_subscription_batch_update_request.nil?
390
+ fail ArgumentError, "Missing the required parameter 'batch_input_subscription_batch_update_request' when calling SubscriptionsApi.update_batch"
391
+ end
392
+ # resource path
393
+ local_var_path = '/webhooks/v3/{appId}/subscriptions/batch/update'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))
394
+
395
+ # query parameters
396
+ query_params = opts[:query_params] || {}
397
+
398
+ # header parameters
399
+ header_params = opts[:header_params] || {}
400
+ # HTTP header 'Accept' (if needed)
401
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
402
+ # HTTP header 'Content-Type'
403
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
404
+
405
+ # form parameters
406
+ form_params = opts[:form_params] || {}
407
+
408
+ # http body (model)
409
+ post_body = opts[:body] || @api_client.object_to_http_body(batch_input_subscription_batch_update_request)
410
+
411
+ # return_type
412
+ return_type = opts[:return_type] || 'BatchResponseSubscriptionResponse'
413
+
414
+ # auth_names
415
+ auth_names = opts[:auth_names] || ['hapikey']
416
+
417
+ new_options = opts.merge(
418
+ :header_params => header_params,
419
+ :query_params => query_params,
420
+ :form_params => form_params,
421
+ :body => post_body,
422
+ :auth_names => auth_names,
423
+ :return_type => return_type
424
+ )
425
+
426
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
427
+ if @api_client.config.debugging
428
+ @api_client.config.logger.debug "API called: SubscriptionsApi#update_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
429
+ end
430
+ return data, status_code, headers
431
+ end
362
432
  end
363
433
  end
364
434
  end
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #Webhooks API
3
+
4
+ #Provides a way for apps to subscribe to certain change events in HubSpot. Once configured, apps will receive event payloads containing details about the changes at a specified target URL. There can only be one target URL for receiving event notifications per app.
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 Webhooks
17
+ class BatchInputSubscriptionBatchUpdateRequest
18
+ attr_accessor :inputs
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'inputs' => :'inputs'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'inputs' => :'Array<SubscriptionBatchUpdateRequest>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Webhooks::BatchInputSubscriptionBatchUpdateRequest` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Webhooks::BatchInputSubscriptionBatchUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'inputs')
56
+ if (value = attributes[:'inputs']).is_a?(Array)
57
+ self.inputs = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @inputs.nil?
67
+ invalid_properties.push('invalid value for "inputs", inputs cannot be nil.')
68
+ end
69
+
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @inputs.nil?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ inputs == o.inputs
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [inputs].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ Hubspot::Webhooks.const_get(type).build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end
215
+ end
@@ -0,0 +1,331 @@
1
+ =begin
2
+ #Webhooks API
3
+
4
+ #Provides a way for apps to subscribe to certain change events in HubSpot. Once configured, apps will receive event payloads containing details about the changes at a specified target URL. There can only be one target URL for receiving event notifications per app.
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 Webhooks
17
+ class BatchResponseSubscriptionResponse
18
+ attr_accessor :status
19
+
20
+ attr_accessor :results
21
+
22
+ attr_accessor :num_errors
23
+
24
+ attr_accessor :errors
25
+
26
+ attr_accessor :requested_at
27
+
28
+ attr_accessor :started_at
29
+
30
+ attr_accessor :completed_at
31
+
32
+ attr_accessor :links
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'status' => :'status',
60
+ :'results' => :'results',
61
+ :'num_errors' => :'numErrors',
62
+ :'errors' => :'errors',
63
+ :'requested_at' => :'requestedAt',
64
+ :'started_at' => :'startedAt',
65
+ :'completed_at' => :'completedAt',
66
+ :'links' => :'links'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'status' => :'String',
74
+ :'results' => :'Array<SubscriptionResponse>',
75
+ :'num_errors' => :'Integer',
76
+ :'errors' => :'Array<Error>',
77
+ :'requested_at' => :'DateTime',
78
+ :'started_at' => :'DateTime',
79
+ :'completed_at' => :'DateTime',
80
+ :'links' => :'Hash<String, String>'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Webhooks::BatchResponseSubscriptionResponse` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Webhooks::BatchResponseSubscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ if attributes.key?(:'status')
106
+ self.status = attributes[:'status']
107
+ end
108
+
109
+ if attributes.key?(:'results')
110
+ if (value = attributes[:'results']).is_a?(Array)
111
+ self.results = value
112
+ end
113
+ end
114
+
115
+ if attributes.key?(:'num_errors')
116
+ self.num_errors = attributes[:'num_errors']
117
+ end
118
+
119
+ if attributes.key?(:'errors')
120
+ if (value = attributes[:'errors']).is_a?(Array)
121
+ self.errors = value
122
+ end
123
+ end
124
+
125
+ if attributes.key?(:'requested_at')
126
+ self.requested_at = attributes[:'requested_at']
127
+ end
128
+
129
+ if attributes.key?(:'started_at')
130
+ self.started_at = attributes[:'started_at']
131
+ end
132
+
133
+ if attributes.key?(:'completed_at')
134
+ self.completed_at = attributes[:'completed_at']
135
+ end
136
+
137
+ if attributes.key?(:'links')
138
+ if (value = attributes[:'links']).is_a?(Hash)
139
+ self.links = value
140
+ end
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ invalid_properties = Array.new
148
+ if @status.nil?
149
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
150
+ end
151
+
152
+ if @results.nil?
153
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
154
+ end
155
+
156
+ if @started_at.nil?
157
+ invalid_properties.push('invalid value for "started_at", started_at cannot be nil.')
158
+ end
159
+
160
+ if @completed_at.nil?
161
+ invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.')
162
+ end
163
+
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ return false if @status.nil?
171
+ status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"])
172
+ return false unless status_validator.valid?(@status)
173
+ return false if @results.nil?
174
+ return false if @started_at.nil?
175
+ return false if @completed_at.nil?
176
+ true
177
+ end
178
+
179
+ # Custom attribute writer method checking allowed values (enum).
180
+ # @param [Object] status Object to be assigned
181
+ def status=(status)
182
+ validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"])
183
+ unless validator.valid?(status)
184
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
185
+ end
186
+ @status = status
187
+ end
188
+
189
+ # Checks equality by comparing each attribute.
190
+ # @param [Object] Object to be compared
191
+ def ==(o)
192
+ return true if self.equal?(o)
193
+ self.class == o.class &&
194
+ status == o.status &&
195
+ results == o.results &&
196
+ num_errors == o.num_errors &&
197
+ errors == o.errors &&
198
+ requested_at == o.requested_at &&
199
+ started_at == o.started_at &&
200
+ completed_at == o.completed_at &&
201
+ links == o.links
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Integer] Hash code
212
+ def hash
213
+ [status, results, num_errors, errors, requested_at, started_at, completed_at, links].hash
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def self.build_from_hash(attributes)
220
+ new.build_from_hash(attributes)
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def build_from_hash(attributes)
227
+ return nil unless attributes.is_a?(Hash)
228
+ self.class.openapi_types.each_pair do |key, type|
229
+ if type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :DateTime
250
+ DateTime.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ Hubspot::Webhooks.const_get(type).build_from_hash(value)
281
+ end
282
+ end
283
+
284
+ # Returns the string representation of the object
285
+ # @return [String] String presentation of the object
286
+ def to_s
287
+ to_hash.to_s
288
+ end
289
+
290
+ # to_body is an alias to to_hash (backward compatibility)
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_body
293
+ to_hash
294
+ end
295
+
296
+ # Returns the object in the form of hash
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_hash
299
+ hash = {}
300
+ self.class.attribute_map.each_pair do |attr, param|
301
+ value = self.send(attr)
302
+ if value.nil?
303
+ is_nullable = self.class.openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ # Outputs non-array value in the form of hash
313
+ # For object, use to_hash. Otherwise, just return the value
314
+ # @param [Object] value Any valid value
315
+ # @return [Hash] Returns the value in the form of hash
316
+ def _to_hash(value)
317
+ if value.is_a?(Array)
318
+ value.compact.map { |v| _to_hash(v) }
319
+ elsif value.is_a?(Hash)
320
+ {}.tap do |hash|
321
+ value.each { |k, v| hash[k] = _to_hash(v) }
322
+ end
323
+ elsif value.respond_to? :to_hash
324
+ value.to_hash
325
+ else
326
+ value
327
+ end
328
+ end
329
+ end
330
+ end
331
+ end
@@ -0,0 +1,227 @@
1
+ =begin
2
+ #Webhooks API
3
+
4
+ #Provides a way for apps to subscribe to certain change events in HubSpot. Once configured, apps will receive event payloads containing details about the changes at a specified target URL. There can only be one target URL for receiving event notifications per app.
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 Webhooks
17
+ class SubscriptionBatchUpdateRequest
18
+ attr_accessor :id
19
+
20
+ attr_accessor :active
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'id' => :'id',
26
+ :'active' => :'active'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'id' => :'Integer',
34
+ :'active' => :'Boolean'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Webhooks::SubscriptionBatchUpdateRequest` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Webhooks::SubscriptionBatchUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'id')
60
+ self.id = attributes[:'id']
61
+ end
62
+
63
+ if attributes.key?(:'active')
64
+ self.active = attributes[:'active']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @id.nil?
73
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
74
+ end
75
+
76
+ if @active.nil?
77
+ invalid_properties.push('invalid value for "active", active cannot be nil.')
78
+ end
79
+
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ return false if @id.nil?
87
+ return false if @active.nil?
88
+ true
89
+ end
90
+
91
+ # Checks equality by comparing each attribute.
92
+ # @param [Object] Object to be compared
93
+ def ==(o)
94
+ return true if self.equal?(o)
95
+ self.class == o.class &&
96
+ id == o.id &&
97
+ active == o.active
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(o)
103
+ self == o
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Integer] Hash code
108
+ def hash
109
+ [id, active].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def self.build_from_hash(attributes)
116
+ new.build_from_hash(attributes)
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.openapi_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ Hubspot::Webhooks.const_get(type).build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
@@ -1,3 +1,3 @@
1
1
  module Hubspot
2
- VERSION = '3.1.1'
2
+ VERSION = '3.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubspot-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HubSpot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-04 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -536,10 +536,13 @@ files:
536
536
  - lib/hubspot/codegen/webhooks/api_client.rb
537
537
  - lib/hubspot/codegen/webhooks/api_error.rb
538
538
  - lib/hubspot/codegen/webhooks/configuration.rb
539
+ - lib/hubspot/codegen/webhooks/models/batch_input_subscription_batch_update_request.rb
540
+ - lib/hubspot/codegen/webhooks/models/batch_response_subscription_response.rb
539
541
  - lib/hubspot/codegen/webhooks/models/error.rb
540
542
  - lib/hubspot/codegen/webhooks/models/error_detail.rb
541
543
  - lib/hubspot/codegen/webhooks/models/settings_change_request.rb
542
544
  - lib/hubspot/codegen/webhooks/models/settings_response.rb
545
+ - lib/hubspot/codegen/webhooks/models/subscription_batch_update_request.rb
543
546
  - lib/hubspot/codegen/webhooks/models/subscription_create_request.rb
544
547
  - lib/hubspot/codegen/webhooks/models/subscription_list_response.rb
545
548
  - lib/hubspot/codegen/webhooks/models/subscription_patch_request.rb