unsent 1.0.1 → 1.0.2

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +258 -2
  4. data/lib/unsent/analytics.rb +30 -0
  5. data/lib/unsent/api_keys.rb +21 -0
  6. data/lib/unsent/campaigns.rb +4 -0
  7. data/lib/unsent/client.rb +8 -1
  8. data/lib/unsent/contact_books.rb +29 -0
  9. data/lib/unsent/contacts.rb +11 -0
  10. data/lib/unsent/emails.rb +47 -0
  11. data/lib/unsent/errors.rb +2 -0
  12. data/lib/unsent/models/add_suppression_request.rb +223 -0
  13. data/lib/unsent/models/create_api_key_request.rb +218 -0
  14. data/lib/unsent/models/create_campaign200_response.rb +750 -0
  15. data/lib/unsent/models/create_campaign_request.rb +426 -0
  16. data/lib/unsent/models/create_campaign_request_reply_to.rb +103 -0
  17. data/lib/unsent/models/create_contact200_response.rb +147 -0
  18. data/lib/unsent/models/create_contact_book200_response.rb +304 -0
  19. data/lib/unsent/models/create_contact_book_request.rb +193 -0
  20. data/lib/unsent/models/create_contact_request.rb +202 -0
  21. data/lib/unsent/models/create_domain_request.rb +190 -0
  22. data/lib/unsent/models/create_template200_response.rb +164 -0
  23. data/lib/unsent/models/create_template_request.rb +226 -0
  24. data/lib/unsent/models/delete_contact_book200_response.rb +164 -0
  25. data/lib/unsent/models/get_api_keys200_response_inner.rb +278 -0
  26. data/lib/unsent/models/get_campaigns200_response_inner.rb +296 -0
  27. data/lib/unsent/models/get_contact_book200_response.rb +330 -0
  28. data/lib/unsent/models/get_contact_book200_response_details.rb +218 -0
  29. data/lib/unsent/models/get_domains200_response_inner.rb +482 -0
  30. data/lib/unsent/models/get_domains200_response_inner_dns_records_inner.rb +318 -0
  31. data/lib/unsent/models/get_health200_response.rb +216 -0
  32. data/lib/unsent/models/get_templates200_response_inner.rb +314 -0
  33. data/lib/unsent/models/list_emails_domain_id_parameter.rb +103 -0
  34. data/lib/unsent/models/schedule_campaign_request.rb +185 -0
  35. data/lib/unsent/models/send_email_request.rb +378 -0
  36. data/lib/unsent/models/send_email_request_to.rb +103 -0
  37. data/lib/unsent/models/update_contact_book200_response.rb +190 -0
  38. data/lib/unsent/models/update_contact_book_request.rb +167 -0
  39. data/lib/unsent/models/update_contact_request.rb +176 -0
  40. data/lib/unsent/models/update_template_request.rb +174 -0
  41. data/lib/unsent/settings.rb +13 -0
  42. data/lib/unsent/suppressions.rb +28 -0
  43. data/lib/unsent/templates.rb +29 -0
  44. data/lib/unsent/version.rb +1 -1
  45. data/lib/unsent/webhooks.rb +25 -0
  46. data/lib/unsent.rb +7 -0
  47. metadata +38 -2
@@ -0,0 +1,164 @@
1
+ =begin
2
+ #Unsent API
3
+
4
+ #API for Unsent.dev
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@unsent.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Unsent
17
+ class DeleteContactBook200Response < ApiModelBase
18
+ attr_accessor :success
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'success' => :'success'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'success' => :'Boolean'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::DeleteContactBook200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::DeleteContactBook200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'success')
67
+ self.success = attributes[:'success']
68
+ else
69
+ self.success = nil
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ if @success.nil?
79
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ warn '[DEPRECATED] the `valid?` method is obsolete'
89
+ return false if @success.nil?
90
+ true
91
+ end
92
+
93
+ # Custom attribute writer method with validation
94
+ # @param [Object] success Value to be assigned
95
+ def success=(success)
96
+ if success.nil?
97
+ fail ArgumentError, 'success cannot be nil'
98
+ end
99
+
100
+ @success = success
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ success == o.success
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [success].hash
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 self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ transformed_hash = {}
130
+ openapi_types.each_pair do |key, type|
131
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = nil
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[attribute_map[key]].is_a?(Array)
137
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
138
+ end
139
+ elsif !attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
141
+ end
142
+ end
143
+ new(transformed_hash)
144
+ end
145
+
146
+ # Returns the object in the form of hash
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_hash
149
+ hash = {}
150
+ self.class.attribute_map.each_pair do |attr, param|
151
+ value = self.send(attr)
152
+ if value.nil?
153
+ is_nullable = self.class.openapi_nullable.include?(attr)
154
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
155
+ end
156
+
157
+ hash[param] = _to_hash(value)
158
+ end
159
+ hash
160
+ end
161
+
162
+ end
163
+
164
+ end
@@ -0,0 +1,278 @@
1
+ =begin
2
+ #Unsent API
3
+
4
+ #API for Unsent.dev
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@unsent.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Unsent
17
+ class GetApiKeys200ResponseInner < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :partial_token
23
+
24
+ attr_accessor :last_used
25
+
26
+ attr_accessor :created_at
27
+
28
+ attr_accessor :permission
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'name' => :'name',
35
+ :'partial_token' => :'partialToken',
36
+ :'last_used' => :'lastUsed',
37
+ :'created_at' => :'createdAt',
38
+ :'permission' => :'permission'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'id' => :'String',
56
+ :'name' => :'String',
57
+ :'partial_token' => :'String',
58
+ :'last_used' => :'String',
59
+ :'created_at' => :'String',
60
+ :'permission' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'last_used',
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetApiKeys200ResponseInner` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetApiKeys200ResponseInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ else
90
+ self.id = nil
91
+ end
92
+
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ else
96
+ self.name = nil
97
+ end
98
+
99
+ if attributes.key?(:'partial_token')
100
+ self.partial_token = attributes[:'partial_token']
101
+ else
102
+ self.partial_token = nil
103
+ end
104
+
105
+ if attributes.key?(:'last_used')
106
+ self.last_used = attributes[:'last_used']
107
+ end
108
+
109
+ if attributes.key?(:'created_at')
110
+ self.created_at = attributes[:'created_at']
111
+ else
112
+ self.created_at = nil
113
+ end
114
+
115
+ if attributes.key?(:'permission')
116
+ self.permission = attributes[:'permission']
117
+ else
118
+ self.permission = nil
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
126
+ invalid_properties = Array.new
127
+ if @id.nil?
128
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
129
+ end
130
+
131
+ if @name.nil?
132
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
133
+ end
134
+
135
+ if @partial_token.nil?
136
+ invalid_properties.push('invalid value for "partial_token", partial_token cannot be nil.')
137
+ end
138
+
139
+ if @created_at.nil?
140
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
141
+ end
142
+
143
+ if @permission.nil?
144
+ invalid_properties.push('invalid value for "permission", permission 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 @id.nil?
155
+ return false if @name.nil?
156
+ return false if @partial_token.nil?
157
+ return false if @created_at.nil?
158
+ return false if @permission.nil?
159
+ true
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] id Value to be assigned
164
+ def id=(id)
165
+ if id.nil?
166
+ fail ArgumentError, 'id cannot be nil'
167
+ end
168
+
169
+ @id = id
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] name Value to be assigned
174
+ def name=(name)
175
+ if name.nil?
176
+ fail ArgumentError, 'name cannot be nil'
177
+ end
178
+
179
+ @name = name
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] partial_token Value to be assigned
184
+ def partial_token=(partial_token)
185
+ if partial_token.nil?
186
+ fail ArgumentError, 'partial_token cannot be nil'
187
+ end
188
+
189
+ @partial_token = partial_token
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] created_at Value to be assigned
194
+ def created_at=(created_at)
195
+ if created_at.nil?
196
+ fail ArgumentError, 'created_at cannot be nil'
197
+ end
198
+
199
+ @created_at = created_at
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] permission Value to be assigned
204
+ def permission=(permission)
205
+ if permission.nil?
206
+ fail ArgumentError, 'permission cannot be nil'
207
+ end
208
+
209
+ @permission = permission
210
+ end
211
+
212
+ # Checks equality by comparing each attribute.
213
+ # @param [Object] Object to be compared
214
+ def ==(o)
215
+ return true if self.equal?(o)
216
+ self.class == o.class &&
217
+ id == o.id &&
218
+ name == o.name &&
219
+ partial_token == o.partial_token &&
220
+ last_used == o.last_used &&
221
+ created_at == o.created_at &&
222
+ permission == o.permission
223
+ end
224
+
225
+ # @see the `==` method
226
+ # @param [Object] Object to be compared
227
+ def eql?(o)
228
+ self == o
229
+ end
230
+
231
+ # Calculates hash code according to all attributes.
232
+ # @return [Integer] Hash code
233
+ def hash
234
+ [id, name, partial_token, last_used, created_at, permission].hash
235
+ end
236
+
237
+ # Builds the object from hash
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ # @return [Object] Returns the model itself
240
+ def self.build_from_hash(attributes)
241
+ return nil unless attributes.is_a?(Hash)
242
+ attributes = attributes.transform_keys(&:to_sym)
243
+ transformed_hash = {}
244
+ openapi_types.each_pair do |key, type|
245
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = nil
247
+ elsif type =~ /\AArray<(.*)>/i
248
+ # check to ensure the input is an array given that the attribute
249
+ # is documented as an array but the input is not
250
+ if attributes[attribute_map[key]].is_a?(Array)
251
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
252
+ end
253
+ elsif !attributes[attribute_map[key]].nil?
254
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
255
+ end
256
+ end
257
+ new(transformed_hash)
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ self.class.attribute_map.each_pair do |attr, param|
265
+ value = self.send(attr)
266
+ if value.nil?
267
+ is_nullable = self.class.openapi_nullable.include?(attr)
268
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
269
+ end
270
+
271
+ hash[param] = _to_hash(value)
272
+ end
273
+ hash
274
+ end
275
+
276
+ end
277
+
278
+ end