parlo-sdk 1.0.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 (46) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +132 -0
  3. data/lib/parlo-sdk/api/domains_api.rb +332 -0
  4. data/lib/parlo-sdk/api/emails_api.rb +156 -0
  5. data/lib/parlo-sdk/api_client.rb +397 -0
  6. data/lib/parlo-sdk/api_error.rb +58 -0
  7. data/lib/parlo-sdk/api_model_base.rb +88 -0
  8. data/lib/parlo-sdk/configuration.rb +308 -0
  9. data/lib/parlo-sdk/models/auth_health.rb +227 -0
  10. data/lib/parlo-sdk/models/auth_health_dkim.rb +188 -0
  11. data/lib/parlo-sdk/models/auth_health_dmarc.rb +174 -0
  12. data/lib/parlo-sdk/models/auth_health_spf.rb +164 -0
  13. data/lib/parlo-sdk/models/create_domain_request.rb +164 -0
  14. data/lib/parlo-sdk/models/delete_domain200_response.rb +214 -0
  15. data/lib/parlo-sdk/models/dns_record.rb +267 -0
  16. data/lib/parlo-sdk/models/domain.rb +319 -0
  17. data/lib/parlo-sdk/models/domain_summary.rb +260 -0
  18. data/lib/parlo-sdk/models/email.rb +340 -0
  19. data/lib/parlo-sdk/models/email_created.rb +214 -0
  20. data/lib/parlo-sdk/models/error.rb +190 -0
  21. data/lib/parlo-sdk/models/list_domains200_response.rb +166 -0
  22. data/lib/parlo-sdk/models/send_email_request.rb +288 -0
  23. data/lib/parlo-sdk/models/send_email_request_cc.rb +104 -0
  24. data/lib/parlo-sdk/models/send_email_request_to.rb +105 -0
  25. data/lib/parlo-sdk/version.rb +15 -0
  26. data/lib/parlo-sdk.rb +58 -0
  27. data/spec/api/domains_api_spec.rb +92 -0
  28. data/spec/api/emails_api_spec.rb +60 -0
  29. data/spec/models/auth_health_dkim_spec.rb +40 -0
  30. data/spec/models/auth_health_dmarc_spec.rb +42 -0
  31. data/spec/models/auth_health_spec.rb +54 -0
  32. data/spec/models/auth_health_spf_spec.rb +36 -0
  33. data/spec/models/create_domain_request_spec.rb +36 -0
  34. data/spec/models/delete_domain200_response_spec.rb +46 -0
  35. data/spec/models/dns_record_spec.rb +58 -0
  36. data/spec/models/domain_spec.rb +76 -0
  37. data/spec/models/domain_summary_spec.rb +64 -0
  38. data/spec/models/email_created_spec.rb +46 -0
  39. data/spec/models/email_spec.rb +82 -0
  40. data/spec/models/error_spec.rb +42 -0
  41. data/spec/models/list_domains200_response_spec.rb +36 -0
  42. data/spec/models/send_email_request_cc_spec.rb +32 -0
  43. data/spec/models/send_email_request_spec.rb +90 -0
  44. data/spec/models/send_email_request_to_spec.rb +32 -0
  45. data/spec/spec_helper.rb +111 -0
  46. metadata +153 -0
@@ -0,0 +1,319 @@
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.0.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 Domain < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :status
23
+
24
+ attr_accessor :verified_at
25
+
26
+ attr_accessor :created_at
27
+
28
+ attr_accessor :records
29
+
30
+ attr_accessor :auth
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'name' => :'name',
59
+ :'status' => :'status',
60
+ :'verified_at' => :'verified_at',
61
+ :'created_at' => :'created_at',
62
+ :'records' => :'records',
63
+ :'auth' => :'auth'
64
+ }
65
+ end
66
+
67
+ # Returns attribute mapping this model knows about
68
+ def self.acceptable_attribute_map
69
+ attribute_map
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ acceptable_attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'id' => :'String',
81
+ :'name' => :'String',
82
+ :'status' => :'String',
83
+ :'verified_at' => :'Time',
84
+ :'created_at' => :'Time',
85
+ :'records' => :'Array<DnsRecord>',
86
+ :'auth' => :'AuthHealth'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # List of class defined in allOf (OpenAPI v3)
97
+ def self.openapi_all_of
98
+ [
99
+ :'DomainSummary'
100
+ ]
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::Domain` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ acceptable_attribute_map = self.class.acceptable_attribute_map
112
+ attributes = attributes.each_with_object({}) { |(k, v), h|
113
+ if (!acceptable_attribute_map.key?(k.to_sym))
114
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::Domain`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
115
+ end
116
+ h[k.to_sym] = v
117
+ }
118
+
119
+ if attributes.key?(:'id')
120
+ self.id = attributes[:'id']
121
+ else
122
+ self.id = nil
123
+ end
124
+
125
+ if attributes.key?(:'name')
126
+ self.name = attributes[:'name']
127
+ else
128
+ self.name = nil
129
+ end
130
+
131
+ if attributes.key?(:'status')
132
+ self.status = attributes[:'status']
133
+ else
134
+ self.status = nil
135
+ end
136
+
137
+ if attributes.key?(:'verified_at')
138
+ self.verified_at = attributes[:'verified_at']
139
+ end
140
+
141
+ if attributes.key?(:'created_at')
142
+ self.created_at = attributes[:'created_at']
143
+ end
144
+
145
+ if attributes.key?(:'records')
146
+ if (value = attributes[:'records']).is_a?(Array)
147
+ self.records = value
148
+ end
149
+ else
150
+ self.records = nil
151
+ end
152
+
153
+ if attributes.key?(:'auth')
154
+ self.auth = attributes[:'auth']
155
+ else
156
+ self.auth = nil
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
164
+ invalid_properties = Array.new
165
+ if @id.nil?
166
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
167
+ end
168
+
169
+ if @name.nil?
170
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
171
+ end
172
+
173
+ if @status.nil?
174
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
175
+ end
176
+
177
+ if @records.nil?
178
+ invalid_properties.push('invalid value for "records", records cannot be nil.')
179
+ end
180
+
181
+ if @auth.nil?
182
+ invalid_properties.push('invalid value for "auth", auth cannot be nil.')
183
+ end
184
+
185
+ invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ warn '[DEPRECATED] the `valid?` method is obsolete'
192
+ return false if @id.nil?
193
+ return false if @name.nil?
194
+ return false if @status.nil?
195
+ status_validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed"])
196
+ return false unless status_validator.valid?(@status)
197
+ return false if @records.nil?
198
+ return false if @auth.nil?
199
+ true
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] id Value to be assigned
204
+ def id=(id)
205
+ if id.nil?
206
+ fail ArgumentError, 'id cannot be nil'
207
+ end
208
+
209
+ @id = id
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] name Value to be assigned
214
+ def name=(name)
215
+ if name.nil?
216
+ fail ArgumentError, 'name cannot be nil'
217
+ end
218
+
219
+ @name = name
220
+ end
221
+
222
+ # Custom attribute writer method checking allowed values (enum).
223
+ # @param [Object] status Object to be assigned
224
+ def status=(status)
225
+ validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed"])
226
+ unless validator.valid?(status)
227
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
228
+ end
229
+ @status = status
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] records Value to be assigned
234
+ def records=(records)
235
+ if records.nil?
236
+ fail ArgumentError, 'records cannot be nil'
237
+ end
238
+
239
+ @records = records
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] auth Value to be assigned
244
+ def auth=(auth)
245
+ if auth.nil?
246
+ fail ArgumentError, 'auth cannot be nil'
247
+ end
248
+
249
+ @auth = auth
250
+ end
251
+
252
+ # Checks equality by comparing each attribute.
253
+ # @param [Object] Object to be compared
254
+ def ==(o)
255
+ return true if self.equal?(o)
256
+ self.class == o.class &&
257
+ id == o.id &&
258
+ name == o.name &&
259
+ status == o.status &&
260
+ verified_at == o.verified_at &&
261
+ created_at == o.created_at &&
262
+ records == o.records &&
263
+ auth == o.auth
264
+ end
265
+
266
+ # @see the `==` method
267
+ # @param [Object] Object to be compared
268
+ def eql?(o)
269
+ self == o
270
+ end
271
+
272
+ # Calculates hash code according to all attributes.
273
+ # @return [Integer] Hash code
274
+ def hash
275
+ [id, name, status, verified_at, created_at, records, auth].hash
276
+ end
277
+
278
+ # Builds the object from hash
279
+ # @param [Hash] attributes Model attributes in the form of hash
280
+ # @return [Object] Returns the model itself
281
+ def self.build_from_hash(attributes)
282
+ return nil unless attributes.is_a?(Hash)
283
+ attributes = attributes.transform_keys(&:to_sym)
284
+ transformed_hash = {}
285
+ openapi_types.each_pair do |key, type|
286
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
287
+ transformed_hash["#{key}"] = nil
288
+ elsif type =~ /\AArray<(.*)>/i
289
+ # check to ensure the input is an array given that the attribute
290
+ # is documented as an array but the input is not
291
+ if attributes[attribute_map[key]].is_a?(Array)
292
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
293
+ end
294
+ elsif !attributes[attribute_map[key]].nil?
295
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
296
+ end
297
+ end
298
+ new(transformed_hash)
299
+ end
300
+
301
+ # Returns the object in the form of hash
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_hash
304
+ hash = {}
305
+ self.class.attribute_map.each_pair do |attr, param|
306
+ value = self.send(attr)
307
+ if value.nil?
308
+ is_nullable = self.class.openapi_nullable.include?(attr)
309
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
310
+ end
311
+
312
+ hash[param] = _to_hash(value)
313
+ end
314
+ hash
315
+ end
316
+
317
+ end
318
+
319
+ end
@@ -0,0 +1,260 @@
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.0.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 DomainSummary < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :status
23
+
24
+ attr_accessor :verified_at
25
+
26
+ attr_accessor :created_at
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'id' => :'id',
54
+ :'name' => :'name',
55
+ :'status' => :'status',
56
+ :'verified_at' => :'verified_at',
57
+ :'created_at' => :'created_at'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'id' => :'String',
75
+ :'name' => :'String',
76
+ :'status' => :'String',
77
+ :'verified_at' => :'Time',
78
+ :'created_at' => :'Time'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ :'verified_at',
86
+ :'created_at'
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 `Parlo::DomainSummary` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::DomainSummary`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ else
109
+ self.id = nil
110
+ end
111
+
112
+ if attributes.key?(:'name')
113
+ self.name = attributes[:'name']
114
+ else
115
+ self.name = nil
116
+ end
117
+
118
+ if attributes.key?(:'status')
119
+ self.status = attributes[:'status']
120
+ else
121
+ self.status = nil
122
+ end
123
+
124
+ if attributes.key?(:'verified_at')
125
+ self.verified_at = attributes[:'verified_at']
126
+ end
127
+
128
+ if attributes.key?(:'created_at')
129
+ self.created_at = attributes[:'created_at']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
+ invalid_properties = Array.new
138
+ if @id.nil?
139
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
140
+ end
141
+
142
+ if @name.nil?
143
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
144
+ end
145
+
146
+ if @status.nil?
147
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @id.nil?
158
+ return false if @name.nil?
159
+ return false if @status.nil?
160
+ status_validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed"])
161
+ return false unless status_validator.valid?(@status)
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] id Value to be assigned
167
+ def id=(id)
168
+ if id.nil?
169
+ fail ArgumentError, 'id cannot be nil'
170
+ end
171
+
172
+ @id = id
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] name Value to be assigned
177
+ def name=(name)
178
+ if name.nil?
179
+ fail ArgumentError, 'name cannot be nil'
180
+ end
181
+
182
+ @name = name
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] status Object to be assigned
187
+ def status=(status)
188
+ validator = EnumAttributeValidator.new('String', ["pending", "verified", "failed"])
189
+ unless validator.valid?(status)
190
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @status = status
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ id == o.id &&
201
+ name == o.name &&
202
+ status == o.status &&
203
+ verified_at == o.verified_at &&
204
+ created_at == o.created_at
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [id, name, status, verified_at, created_at].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ return nil unless attributes.is_a?(Hash)
224
+ attributes = attributes.transform_keys(&:to_sym)
225
+ transformed_hash = {}
226
+ openapi_types.each_pair do |key, type|
227
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
228
+ transformed_hash["#{key}"] = nil
229
+ elsif 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[attribute_map[key]].is_a?(Array)
233
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
234
+ end
235
+ elsif !attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
237
+ end
238
+ end
239
+ new(transformed_hash)
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ end
259
+
260
+ end