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,214 @@
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 DeleteDomain200Response < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :deleted
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'id' => :'id',
48
+ :'deleted' => :'deleted'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'id' => :'String',
66
+ :'deleted' => :'Boolean'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::DeleteDomain200Response` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::DeleteDomain200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'id')
93
+ self.id = attributes[:'id']
94
+ else
95
+ self.id = nil
96
+ end
97
+
98
+ if attributes.key?(:'deleted')
99
+ self.deleted = attributes[:'deleted']
100
+ else
101
+ self.deleted = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @id.nil?
111
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
112
+ end
113
+
114
+ if @deleted.nil?
115
+ invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @id.nil?
126
+ return false if @deleted.nil?
127
+ deleted_validator = EnumAttributeValidator.new('Boolean', ["true"])
128
+ return false unless deleted_validator.valid?(@deleted)
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] id Value to be assigned
134
+ def id=(id)
135
+ if id.nil?
136
+ fail ArgumentError, 'id cannot be nil'
137
+ end
138
+
139
+ @id = id
140
+ end
141
+
142
+ # Custom attribute writer method checking allowed values (enum).
143
+ # @param [Object] deleted Object to be assigned
144
+ def deleted=(deleted)
145
+ validator = EnumAttributeValidator.new('Boolean', ["true"])
146
+ unless validator.valid?(deleted)
147
+ fail ArgumentError, "invalid value for \"deleted\", must be one of #{validator.allowable_values}."
148
+ end
149
+ @deleted = deleted
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(o)
155
+ return true if self.equal?(o)
156
+ self.class == o.class &&
157
+ id == o.id &&
158
+ deleted == o.deleted
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [id, deleted].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ attributes = attributes.transform_keys(&:to_sym)
179
+ transformed_hash = {}
180
+ openapi_types.each_pair do |key, type|
181
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = nil
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[attribute_map[key]].is_a?(Array)
187
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
188
+ end
189
+ elsif !attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
191
+ end
192
+ end
193
+ new(transformed_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
+ end
213
+
214
+ end
@@ -0,0 +1,267 @@
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 DnsRecord < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :value
23
+
24
+ # True for the DKIM CNAMEs needed to verify; false for recommended SPF/DMARC.
25
+ attr_accessor :required
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'type' => :'type',
53
+ :'name' => :'name',
54
+ :'value' => :'value',
55
+ :'required' => :'required'
56
+ }
57
+ end
58
+
59
+ # Returns attribute mapping this model knows about
60
+ def self.acceptable_attribute_map
61
+ attribute_map
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ acceptable_attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'type' => :'String',
73
+ :'name' => :'String',
74
+ :'value' => :'String',
75
+ :'required' => :'Boolean'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::DnsRecord` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ acceptable_attribute_map = self.class.acceptable_attribute_map
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!acceptable_attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::DnsRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'type')
102
+ self.type = attributes[:'type']
103
+ else
104
+ self.type = nil
105
+ end
106
+
107
+ if attributes.key?(:'name')
108
+ self.name = attributes[:'name']
109
+ else
110
+ self.name = nil
111
+ end
112
+
113
+ if attributes.key?(:'value')
114
+ self.value = attributes[:'value']
115
+ else
116
+ self.value = nil
117
+ end
118
+
119
+ if attributes.key?(:'required')
120
+ self.required = attributes[:'required']
121
+ else
122
+ self.required = nil
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ if @type.nil?
132
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
133
+ end
134
+
135
+ if @name.nil?
136
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
137
+ end
138
+
139
+ if @value.nil?
140
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
141
+ end
142
+
143
+ if @required.nil?
144
+ invalid_properties.push('invalid value for "required", required cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @type.nil?
155
+ type_validator = EnumAttributeValidator.new('String', ["CNAME", "TXT"])
156
+ return false unless type_validator.valid?(@type)
157
+ return false if @name.nil?
158
+ return false if @value.nil?
159
+ return false if @required.nil?
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] type Object to be assigned
165
+ def type=(type)
166
+ validator = EnumAttributeValidator.new('String', ["CNAME", "TXT"])
167
+ unless validator.valid?(type)
168
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @type = type
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] name Value to be assigned
175
+ def name=(name)
176
+ if name.nil?
177
+ fail ArgumentError, 'name cannot be nil'
178
+ end
179
+
180
+ @name = name
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] value Value to be assigned
185
+ def value=(value)
186
+ if value.nil?
187
+ fail ArgumentError, 'value cannot be nil'
188
+ end
189
+
190
+ @value = value
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] required Value to be assigned
195
+ def required=(required)
196
+ if required.nil?
197
+ fail ArgumentError, 'required cannot be nil'
198
+ end
199
+
200
+ @required = required
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ type == o.type &&
209
+ name == o.name &&
210
+ value == o.value &&
211
+ required == o.required
212
+ end
213
+
214
+ # @see the `==` method
215
+ # @param [Object] Object to be compared
216
+ def eql?(o)
217
+ self == o
218
+ end
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Integer] Hash code
222
+ def hash
223
+ [type, name, value, required].hash
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def self.build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ attributes = attributes.transform_keys(&:to_sym)
232
+ transformed_hash = {}
233
+ openapi_types.each_pair do |key, type|
234
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = nil
236
+ elsif type =~ /\AArray<(.*)>/i
237
+ # check to ensure the input is an array given that the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[attribute_map[key]].is_a?(Array)
240
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
241
+ end
242
+ elsif !attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
244
+ end
245
+ end
246
+ new(transformed_hash)
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ end
266
+
267
+ end