hubspot-api-client 10.0.1 → 10.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +3 -3
  4. data/lib/hubspot/codegen/communication_preferences/api/definition_api.rb +80 -0
  5. data/lib/hubspot/codegen/communication_preferences/api/status_api.rb +214 -0
  6. data/lib/hubspot/codegen/communication_preferences/api_client.rb +404 -0
  7. data/lib/hubspot/codegen/communication_preferences/api_error.rb +59 -0
  8. data/lib/hubspot/codegen/communication_preferences/configuration.rb +254 -0
  9. data/lib/hubspot/codegen/communication_preferences/models/error.rb +290 -0
  10. data/lib/hubspot/codegen/communication_preferences/models/error_detail.rb +256 -0
  11. data/lib/hubspot/codegen/communication_preferences/models/public_subscription_status.rb +372 -0
  12. data/lib/hubspot/codegen/communication_preferences/models/public_subscription_statuses_response.rb +231 -0
  13. data/lib/hubspot/codegen/communication_preferences/models/public_update_subscription_status_request.rb +283 -0
  14. data/lib/hubspot/codegen/communication_preferences/models/subscription_definition.rb +339 -0
  15. data/lib/hubspot/codegen/communication_preferences/models/subscription_definitions_response.rb +216 -0
  16. data/lib/hubspot/version.rb +1 -1
  17. data/spec/codegen/communication_preferences/api/definition_api_spec.rb +46 -0
  18. data/spec/codegen/communication_preferences/api/status_api_spec.rb +71 -0
  19. data/spec/codegen/communication_preferences/models/error_detail_spec.rb +65 -0
  20. data/spec/codegen/communication_preferences/models/error_spec.rb +77 -0
  21. data/spec/codegen/communication_preferences/models/public_subscription_status_spec.rb +101 -0
  22. data/spec/codegen/communication_preferences/models/public_subscription_statuses_response_spec.rb +47 -0
  23. data/spec/codegen/communication_preferences/models/public_update_subscription_status_request_spec.rb +63 -0
  24. data/spec/codegen/communication_preferences/models/subscription_definition_spec.rb +95 -0
  25. data/spec/codegen/communication_preferences/models/subscription_definitions_response_spec.rb +41 -0
  26. data/spec/codegen/crm/extensions/calling/api/settings_api_spec.rb +2 -2
  27. data/spec/codegen/crm/extensions/calling/models/settings_patch_request_spec.rb +6 -0
  28. data/spec/codegen/crm/extensions/calling/models/settings_request_spec.rb +6 -0
  29. data/spec/codegen/crm/extensions/calling/models/settings_response_spec.rb +6 -0
  30. data/spec/codegen/crm/extensions/cards/api/cards_api_spec.rb +2 -2
  31. data/spec/features/communication_preferences/definition_api_spec.rb +7 -0
  32. data/spec/features/communication_preferences/status_api_spec.rb +9 -0
  33. metadata +36 -2
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Subscriptions
3
+
4
+ #Subscriptions allow contacts to control what forms of communications they receive. Contacts can decide whether they want to receive communication pertaining to a specific topic, brand, or an entire HubSpot account.
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 CommunicationPreferences
17
+ class PublicSubscriptionStatusesResponse
18
+ # Email address of the contact.
19
+ attr_accessor :recipient
20
+
21
+ # A list of all of the contact's subscriptions statuses.
22
+ attr_accessor :subscription_statuses
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'recipient' => :'recipient',
28
+ :'subscription_statuses' => :'subscriptionStatuses'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'recipient' => :'String',
36
+ :'subscription_statuses' => :'Array<PublicSubscriptionStatus>'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::CommunicationPreferences::PublicSubscriptionStatusesResponse` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::CommunicationPreferences::PublicSubscriptionStatusesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'recipient')
62
+ self.recipient = attributes[:'recipient']
63
+ end
64
+
65
+ if attributes.key?(:'subscription_statuses')
66
+ if (value = attributes[:'subscription_statuses']).is_a?(Array)
67
+ self.subscription_statuses = value
68
+ end
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @recipient.nil?
77
+ invalid_properties.push('invalid value for "recipient", recipient cannot be nil.')
78
+ end
79
+
80
+ if @subscription_statuses.nil?
81
+ invalid_properties.push('invalid value for "subscription_statuses", subscription_statuses cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @recipient.nil?
91
+ return false if @subscription_statuses.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ recipient == o.recipient &&
101
+ subscription_statuses == o.subscription_statuses
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [recipient, subscription_statuses].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ Hubspot::CommunicationPreferences.const_get(type).build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #Subscriptions
3
+
4
+ #Subscriptions allow contacts to control what forms of communications they receive. Contacts can decide whether they want to receive communication pertaining to a specific topic, brand, or an entire HubSpot account.
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 CommunicationPreferences
17
+ class PublicUpdateSubscriptionStatusRequest
18
+ # Contact's email address.
19
+ attr_accessor :email_address
20
+
21
+ # ID of the subscription the contact is being resubscribed to.
22
+ attr_accessor :subscription_id
23
+
24
+ # Legal basis for resubscribing the contact (required for GDPR enabled portals).
25
+ attr_accessor :legal_basis
26
+
27
+ # A more detailed explanation to go with the legal basis (required for GDPR enabled portals).
28
+ attr_accessor :legal_basis_explanation
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'email_address' => :'emailAddress',
56
+ :'subscription_id' => :'subscriptionId',
57
+ :'legal_basis' => :'legalBasis',
58
+ :'legal_basis_explanation' => :'legalBasisExplanation'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'email_address' => :'String',
66
+ :'subscription_id' => :'String',
67
+ :'legal_basis' => :'String',
68
+ :'legal_basis_explanation' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::CommunicationPreferences::PublicUpdateSubscriptionStatusRequest` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::CommunicationPreferences::PublicUpdateSubscriptionStatusRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'email_address')
94
+ self.email_address = attributes[:'email_address']
95
+ end
96
+
97
+ if attributes.key?(:'subscription_id')
98
+ self.subscription_id = attributes[:'subscription_id']
99
+ end
100
+
101
+ if attributes.key?(:'legal_basis')
102
+ self.legal_basis = attributes[:'legal_basis']
103
+ end
104
+
105
+ if attributes.key?(:'legal_basis_explanation')
106
+ self.legal_basis_explanation = attributes[:'legal_basis_explanation']
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ invalid_properties = Array.new
114
+ if @email_address.nil?
115
+ invalid_properties.push('invalid value for "email_address", email_address cannot be nil.')
116
+ end
117
+
118
+ if @subscription_id.nil?
119
+ invalid_properties.push('invalid value for "subscription_id", subscription_id cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ return false if @email_address.nil?
129
+ return false if @subscription_id.nil?
130
+ legal_basis_validator = EnumAttributeValidator.new('String', ["LEGITIMATE_INTEREST_PQL", "LEGITIMATE_INTEREST_CLIENT", "PERFORMANCE_OF_CONTRACT", "CONSENT_WITH_NOTICE", "NON_GDPR", "PROCESS_AND_STORE", "LEGITIMATE_INTEREST_OTHER"])
131
+ return false unless legal_basis_validator.valid?(@legal_basis)
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method checking allowed values (enum).
136
+ # @param [Object] legal_basis Object to be assigned
137
+ def legal_basis=(legal_basis)
138
+ validator = EnumAttributeValidator.new('String', ["LEGITIMATE_INTEREST_PQL", "LEGITIMATE_INTEREST_CLIENT", "PERFORMANCE_OF_CONTRACT", "CONSENT_WITH_NOTICE", "NON_GDPR", "PROCESS_AND_STORE", "LEGITIMATE_INTEREST_OTHER"])
139
+ unless validator.valid?(legal_basis)
140
+ fail ArgumentError, "invalid value for \"legal_basis\", must be one of #{validator.allowable_values}."
141
+ end
142
+ @legal_basis = legal_basis
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ email_address == o.email_address &&
151
+ subscription_id == o.subscription_id &&
152
+ legal_basis == o.legal_basis &&
153
+ legal_basis_explanation == o.legal_basis_explanation
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [email_address, subscription_id, legal_basis, legal_basis_explanation].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ new.build_from_hash(attributes)
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ self.class.openapi_types.each_pair do |key, type|
181
+ if type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
190
+ end
191
+
192
+ self
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def _deserialize(type, value)
200
+ case type.to_sym
201
+ when :DateTime
202
+ DateTime.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ Hubspot::CommunicationPreferences.const_get(type).build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end