parlo-sdk 1.0.0 → 1.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/lib/parlo-sdk/api/domains_api.rb +1 -1
  4. data/lib/parlo-sdk/api/emails_api.rb +94 -1
  5. data/lib/parlo-sdk/api_client.rb +1 -1
  6. data/lib/parlo-sdk/api_error.rb +1 -1
  7. data/lib/parlo-sdk/api_model_base.rb +1 -1
  8. data/lib/parlo-sdk/configuration.rb +1 -1
  9. data/lib/parlo-sdk/models/auth_health.rb +1 -1
  10. data/lib/parlo-sdk/models/auth_health_dkim.rb +1 -1
  11. data/lib/parlo-sdk/models/auth_health_dmarc.rb +1 -1
  12. data/lib/parlo-sdk/models/auth_health_spf.rb +1 -1
  13. data/lib/parlo-sdk/models/create_domain_request.rb +1 -1
  14. data/lib/parlo-sdk/models/delete_domain200_response.rb +1 -1
  15. data/lib/parlo-sdk/models/dns_record.rb +1 -1
  16. data/lib/parlo-sdk/models/domain.rb +1 -1
  17. data/lib/parlo-sdk/models/domain_summary.rb +1 -1
  18. data/lib/parlo-sdk/models/email.rb +106 -7
  19. data/lib/parlo-sdk/models/email_created.rb +1 -1
  20. data/lib/parlo-sdk/models/email_list.rb +192 -0
  21. data/lib/parlo-sdk/models/email_summary.rb +367 -0
  22. data/lib/parlo-sdk/models/error.rb +1 -1
  23. data/lib/parlo-sdk/models/list_domains200_response.rb +1 -1
  24. data/lib/parlo-sdk/models/list_meta.rb +240 -0
  25. data/lib/parlo-sdk/models/send_email_request.rb +2 -2
  26. data/lib/parlo-sdk/models/send_email_request_cc.rb +1 -1
  27. data/lib/parlo-sdk/models/send_email_request_to.rb +1 -1
  28. data/lib/parlo-sdk/models/webhook_event.rb +268 -0
  29. data/lib/parlo-sdk/version.rb +2 -2
  30. data/lib/parlo-sdk.rb +5 -1
  31. data/spec/models/email_list_spec.rb +42 -0
  32. data/spec/models/email_summary_spec.rb +88 -0
  33. data/spec/models/list_meta_spec.rb +60 -0
  34. data/spec/models/webhook_event_spec.rb +58 -0
  35. data/spec/spec_helper.rb +1 -1
  36. metadata +14 -2
@@ -0,0 +1,192 @@
1
+ =begin
2
+ #Parlo API
3
+
4
+ #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
+
6
+ The version of the OpenAPI document: 1.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Parlo
17
+ class EmailList < ApiModelBase
18
+ attr_accessor :emails
19
+
20
+ attr_accessor :meta
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'emails' => :'emails',
26
+ :'meta' => :'meta'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'emails' => :'Array<EmailSummary>',
44
+ :'meta' => :'ListMeta'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::EmailList` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::EmailList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'emails')
71
+ if (value = attributes[:'emails']).is_a?(Array)
72
+ self.emails = value
73
+ end
74
+ else
75
+ self.emails = nil
76
+ end
77
+
78
+ if attributes.key?(:'meta')
79
+ self.meta = attributes[:'meta']
80
+ else
81
+ self.meta = nil
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if @emails.nil?
91
+ invalid_properties.push('invalid value for "emails", emails cannot be nil.')
92
+ end
93
+
94
+ if @meta.nil?
95
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @emails.nil?
106
+ return false if @meta.nil?
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] emails Value to be assigned
112
+ def emails=(emails)
113
+ if emails.nil?
114
+ fail ArgumentError, 'emails cannot be nil'
115
+ end
116
+
117
+ @emails = emails
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] meta Value to be assigned
122
+ def meta=(meta)
123
+ if meta.nil?
124
+ fail ArgumentError, 'meta cannot be nil'
125
+ end
126
+
127
+ @meta = meta
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ emails == o.emails &&
136
+ meta == o.meta
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [emails, meta].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ end
191
+
192
+ end
@@ -0,0 +1,367 @@
1
+ =begin
2
+ #Parlo API
3
+
4
+ #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
+
6
+ The version of the OpenAPI document: 1.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Parlo
17
+ # One email as returned in a list. Parlo does not retain the body of a transactional message, so none is included here or anywhere in this API.
18
+ class EmailSummary < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :to
22
+
23
+ attr_accessor :from
24
+
25
+ attr_accessor :subject
26
+
27
+ attr_accessor :status
28
+
29
+ attr_accessor :opened
30
+
31
+ attr_accessor :clicked
32
+
33
+ attr_accessor :last_event_at
34
+
35
+ attr_accessor :created_at
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'id' => :'id',
63
+ :'to' => :'to',
64
+ :'from' => :'from',
65
+ :'subject' => :'subject',
66
+ :'status' => :'status',
67
+ :'opened' => :'opened',
68
+ :'clicked' => :'clicked',
69
+ :'last_event_at' => :'last_event_at',
70
+ :'created_at' => :'created_at'
71
+ }
72
+ end
73
+
74
+ # Returns attribute mapping this model knows about
75
+ def self.acceptable_attribute_map
76
+ attribute_map
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ acceptable_attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'id' => :'String',
88
+ :'to' => :'Array<String>',
89
+ :'from' => :'String',
90
+ :'subject' => :'String',
91
+ :'status' => :'String',
92
+ :'opened' => :'Boolean',
93
+ :'clicked' => :'Boolean',
94
+ :'last_event_at' => :'Time',
95
+ :'created_at' => :'Time'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ :'last_event_at',
103
+ :'created_at'
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::EmailSummary` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ acceptable_attribute_map = self.class.acceptable_attribute_map
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!acceptable_attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::EmailSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'id')
124
+ self.id = attributes[:'id']
125
+ else
126
+ self.id = nil
127
+ end
128
+
129
+ if attributes.key?(:'to')
130
+ if (value = attributes[:'to']).is_a?(Array)
131
+ self.to = value
132
+ end
133
+ else
134
+ self.to = nil
135
+ end
136
+
137
+ if attributes.key?(:'from')
138
+ self.from = attributes[:'from']
139
+ else
140
+ self.from = nil
141
+ end
142
+
143
+ if attributes.key?(:'subject')
144
+ self.subject = attributes[:'subject']
145
+ else
146
+ self.subject = nil
147
+ end
148
+
149
+ if attributes.key?(:'status')
150
+ self.status = attributes[:'status']
151
+ else
152
+ self.status = nil
153
+ end
154
+
155
+ if attributes.key?(:'opened')
156
+ self.opened = attributes[:'opened']
157
+ else
158
+ self.opened = nil
159
+ end
160
+
161
+ if attributes.key?(:'clicked')
162
+ self.clicked = attributes[:'clicked']
163
+ else
164
+ self.clicked = nil
165
+ end
166
+
167
+ if attributes.key?(:'last_event_at')
168
+ self.last_event_at = attributes[:'last_event_at']
169
+ end
170
+
171
+ if attributes.key?(:'created_at')
172
+ self.created_at = attributes[:'created_at']
173
+ end
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properties with the reasons
178
+ def list_invalid_properties
179
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
180
+ invalid_properties = Array.new
181
+ if @id.nil?
182
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
183
+ end
184
+
185
+ if @to.nil?
186
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
187
+ end
188
+
189
+ if @from.nil?
190
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
191
+ end
192
+
193
+ if @subject.nil?
194
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
195
+ end
196
+
197
+ if @status.nil?
198
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
199
+ end
200
+
201
+ if @opened.nil?
202
+ invalid_properties.push('invalid value for "opened", opened cannot be nil.')
203
+ end
204
+
205
+ if @clicked.nil?
206
+ invalid_properties.push('invalid value for "clicked", clicked cannot be nil.')
207
+ end
208
+
209
+ invalid_properties
210
+ end
211
+
212
+ # Check to see if the all the properties in the model are valid
213
+ # @return true if the model is valid
214
+ def valid?
215
+ warn '[DEPRECATED] the `valid?` method is obsolete'
216
+ return false if @id.nil?
217
+ return false if @to.nil?
218
+ return false if @from.nil?
219
+ return false if @subject.nil?
220
+ return false if @status.nil?
221
+ status_validator = EnumAttributeValidator.new('String', ["queued", "sent", "delivered", "bounced", "complained", "failed"])
222
+ return false unless status_validator.valid?(@status)
223
+ return false if @opened.nil?
224
+ return false if @clicked.nil?
225
+ true
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] id Value to be assigned
230
+ def id=(id)
231
+ if id.nil?
232
+ fail ArgumentError, 'id cannot be nil'
233
+ end
234
+
235
+ @id = id
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] to Value to be assigned
240
+ def to=(to)
241
+ if to.nil?
242
+ fail ArgumentError, 'to cannot be nil'
243
+ end
244
+
245
+ @to = to
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] from Value to be assigned
250
+ def from=(from)
251
+ if from.nil?
252
+ fail ArgumentError, 'from cannot be nil'
253
+ end
254
+
255
+ @from = from
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] subject Value to be assigned
260
+ def subject=(subject)
261
+ if subject.nil?
262
+ fail ArgumentError, 'subject cannot be nil'
263
+ end
264
+
265
+ @subject = subject
266
+ end
267
+
268
+ # Custom attribute writer method checking allowed values (enum).
269
+ # @param [Object] status Object to be assigned
270
+ def status=(status)
271
+ validator = EnumAttributeValidator.new('String', ["queued", "sent", "delivered", "bounced", "complained", "failed"])
272
+ unless validator.valid?(status)
273
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
274
+ end
275
+ @status = status
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] opened Value to be assigned
280
+ def opened=(opened)
281
+ if opened.nil?
282
+ fail ArgumentError, 'opened cannot be nil'
283
+ end
284
+
285
+ @opened = opened
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] clicked Value to be assigned
290
+ def clicked=(clicked)
291
+ if clicked.nil?
292
+ fail ArgumentError, 'clicked cannot be nil'
293
+ end
294
+
295
+ @clicked = clicked
296
+ end
297
+
298
+ # Checks equality by comparing each attribute.
299
+ # @param [Object] Object to be compared
300
+ def ==(o)
301
+ return true if self.equal?(o)
302
+ self.class == o.class &&
303
+ id == o.id &&
304
+ to == o.to &&
305
+ from == o.from &&
306
+ subject == o.subject &&
307
+ status == o.status &&
308
+ opened == o.opened &&
309
+ clicked == o.clicked &&
310
+ last_event_at == o.last_event_at &&
311
+ created_at == o.created_at
312
+ end
313
+
314
+ # @see the `==` method
315
+ # @param [Object] Object to be compared
316
+ def eql?(o)
317
+ self == o
318
+ end
319
+
320
+ # Calculates hash code according to all attributes.
321
+ # @return [Integer] Hash code
322
+ def hash
323
+ [id, to, from, subject, status, opened, clicked, last_event_at, created_at].hash
324
+ end
325
+
326
+ # Builds the object from hash
327
+ # @param [Hash] attributes Model attributes in the form of hash
328
+ # @return [Object] Returns the model itself
329
+ def self.build_from_hash(attributes)
330
+ return nil unless attributes.is_a?(Hash)
331
+ attributes = attributes.transform_keys(&:to_sym)
332
+ transformed_hash = {}
333
+ openapi_types.each_pair do |key, type|
334
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
335
+ transformed_hash["#{key}"] = nil
336
+ elsif type =~ /\AArray<(.*)>/i
337
+ # check to ensure the input is an array given that the attribute
338
+ # is documented as an array but the input is not
339
+ if attributes[attribute_map[key]].is_a?(Array)
340
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
341
+ end
342
+ elsif !attributes[attribute_map[key]].nil?
343
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
344
+ end
345
+ end
346
+ new(transformed_hash)
347
+ end
348
+
349
+ # Returns the object in the form of hash
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_hash
352
+ hash = {}
353
+ self.class.attribute_map.each_pair do |attr, param|
354
+ value = self.send(attr)
355
+ if value.nil?
356
+ is_nullable = self.class.openapi_nullable.include?(attr)
357
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
358
+ end
359
+
360
+ hash[param] = _to_hash(value)
361
+ end
362
+ hash
363
+ end
364
+
365
+ end
366
+
367
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ The version of the OpenAPI document: 1.1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.24.0-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ The version of the OpenAPI document: 1.1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.24.0-SNAPSHOT