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,296 @@
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 GetCampaigns200ResponseInner < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :subject
23
+
24
+ attr_accessor :status
25
+
26
+ attr_accessor :created_at
27
+
28
+ attr_accessor :sent
29
+
30
+ attr_accessor :delivered
31
+
32
+ attr_accessor :opened
33
+
34
+ attr_accessor :clicked
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'name' => :'name',
41
+ :'subject' => :'subject',
42
+ :'status' => :'status',
43
+ :'created_at' => :'created_at',
44
+ :'sent' => :'sent',
45
+ :'delivered' => :'delivered',
46
+ :'opened' => :'opened',
47
+ :'clicked' => :'clicked'
48
+ }
49
+ end
50
+
51
+ # Returns attribute mapping this model knows about
52
+ def self.acceptable_attribute_map
53
+ attribute_map
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ acceptable_attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'id' => :'String',
65
+ :'name' => :'String',
66
+ :'subject' => :'String',
67
+ :'status' => :'String',
68
+ :'created_at' => :'String',
69
+ :'sent' => :'Float',
70
+ :'delivered' => :'Float',
71
+ :'opened' => :'Float',
72
+ :'clicked' => :'Float'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'status',
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetCampaigns200ResponseInner` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!acceptable_attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetCampaigns200ResponseInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'id')
100
+ self.id = attributes[:'id']
101
+ else
102
+ self.id = nil
103
+ end
104
+
105
+ if attributes.key?(:'name')
106
+ self.name = attributes[:'name']
107
+ else
108
+ self.name = nil
109
+ end
110
+
111
+ if attributes.key?(:'subject')
112
+ self.subject = attributes[:'subject']
113
+ else
114
+ self.subject = nil
115
+ end
116
+
117
+ if attributes.key?(:'status')
118
+ self.status = attributes[:'status']
119
+ end
120
+
121
+ if attributes.key?(:'created_at')
122
+ self.created_at = attributes[:'created_at']
123
+ else
124
+ self.created_at = nil
125
+ end
126
+
127
+ if attributes.key?(:'sent')
128
+ self.sent = attributes[:'sent']
129
+ else
130
+ self.sent = 0
131
+ end
132
+
133
+ if attributes.key?(:'delivered')
134
+ self.delivered = attributes[:'delivered']
135
+ else
136
+ self.delivered = 0
137
+ end
138
+
139
+ if attributes.key?(:'opened')
140
+ self.opened = attributes[:'opened']
141
+ else
142
+ self.opened = 0
143
+ end
144
+
145
+ if attributes.key?(:'clicked')
146
+ self.clicked = attributes[:'clicked']
147
+ else
148
+ self.clicked = 0
149
+ end
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properties with the reasons
154
+ def list_invalid_properties
155
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
156
+ invalid_properties = Array.new
157
+ if @id.nil?
158
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
159
+ end
160
+
161
+ if @name.nil?
162
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
163
+ end
164
+
165
+ if @subject.nil?
166
+ invalid_properties.push('invalid value for "subject", subject cannot be nil.')
167
+ end
168
+
169
+ if @created_at.nil?
170
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
171
+ end
172
+
173
+ invalid_properties
174
+ end
175
+
176
+ # Check to see if the all the properties in the model are valid
177
+ # @return true if the model is valid
178
+ def valid?
179
+ warn '[DEPRECATED] the `valid?` method is obsolete'
180
+ return false if @id.nil?
181
+ return false if @name.nil?
182
+ return false if @subject.nil?
183
+ return false if @created_at.nil?
184
+ true
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] id Value to be assigned
189
+ def id=(id)
190
+ if id.nil?
191
+ fail ArgumentError, 'id cannot be nil'
192
+ end
193
+
194
+ @id = id
195
+ end
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] name Value to be assigned
199
+ def name=(name)
200
+ if name.nil?
201
+ fail ArgumentError, 'name cannot be nil'
202
+ end
203
+
204
+ @name = name
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] subject Value to be assigned
209
+ def subject=(subject)
210
+ if subject.nil?
211
+ fail ArgumentError, 'subject cannot be nil'
212
+ end
213
+
214
+ @subject = subject
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] created_at Value to be assigned
219
+ def created_at=(created_at)
220
+ if created_at.nil?
221
+ fail ArgumentError, 'created_at cannot be nil'
222
+ end
223
+
224
+ @created_at = created_at
225
+ end
226
+
227
+ # Checks equality by comparing each attribute.
228
+ # @param [Object] Object to be compared
229
+ def ==(o)
230
+ return true if self.equal?(o)
231
+ self.class == o.class &&
232
+ id == o.id &&
233
+ name == o.name &&
234
+ subject == o.subject &&
235
+ status == o.status &&
236
+ created_at == o.created_at &&
237
+ sent == o.sent &&
238
+ delivered == o.delivered &&
239
+ opened == o.opened &&
240
+ clicked == o.clicked
241
+ end
242
+
243
+ # @see the `==` method
244
+ # @param [Object] Object to be compared
245
+ def eql?(o)
246
+ self == o
247
+ end
248
+
249
+ # Calculates hash code according to all attributes.
250
+ # @return [Integer] Hash code
251
+ def hash
252
+ [id, name, subject, status, created_at, sent, delivered, opened, clicked].hash
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def self.build_from_hash(attributes)
259
+ return nil unless attributes.is_a?(Hash)
260
+ attributes = attributes.transform_keys(&:to_sym)
261
+ transformed_hash = {}
262
+ openapi_types.each_pair do |key, type|
263
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
264
+ transformed_hash["#{key}"] = nil
265
+ elsif type =~ /\AArray<(.*)>/i
266
+ # check to ensure the input is an array given that the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[attribute_map[key]].is_a?(Array)
269
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
270
+ end
271
+ elsif !attributes[attribute_map[key]].nil?
272
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
273
+ end
274
+ end
275
+ new(transformed_hash)
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ end
295
+
296
+ end
@@ -0,0 +1,330 @@
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 GetContactBook200Response < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :emoji
23
+
24
+ attr_accessor :properties
25
+
26
+ attr_accessor :team_id
27
+
28
+ attr_accessor :created_at
29
+
30
+ attr_accessor :updated_at
31
+
32
+ attr_accessor :details
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'id' => :'id',
38
+ :'name' => :'name',
39
+ :'emoji' => :'emoji',
40
+ :'properties' => :'properties',
41
+ :'team_id' => :'teamId',
42
+ :'created_at' => :'createdAt',
43
+ :'updated_at' => :'updatedAt',
44
+ :'details' => :'details'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'name' => :'String',
63
+ :'emoji' => :'String',
64
+ :'properties' => :'Object',
65
+ :'team_id' => :'String',
66
+ :'created_at' => :'String',
67
+ :'updated_at' => :'String',
68
+ :'details' => :'GetContactBook200ResponseDetails'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :'properties',
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetContactBook200Response` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ acceptable_attribute_map = self.class.acceptable_attribute_map
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!acceptable_attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetContactBook200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'id')
96
+ self.id = attributes[:'id']
97
+ else
98
+ self.id = nil
99
+ end
100
+
101
+ if attributes.key?(:'name')
102
+ self.name = attributes[:'name']
103
+ else
104
+ self.name = nil
105
+ end
106
+
107
+ if attributes.key?(:'emoji')
108
+ self.emoji = attributes[:'emoji']
109
+ else
110
+ self.emoji = nil
111
+ end
112
+
113
+ if attributes.key?(:'properties')
114
+ self.properties = attributes[:'properties']
115
+ end
116
+
117
+ if attributes.key?(:'team_id')
118
+ self.team_id = attributes[:'team_id']
119
+ else
120
+ self.team_id = nil
121
+ end
122
+
123
+ if attributes.key?(:'created_at')
124
+ self.created_at = attributes[:'created_at']
125
+ else
126
+ self.created_at = nil
127
+ end
128
+
129
+ if attributes.key?(:'updated_at')
130
+ self.updated_at = attributes[:'updated_at']
131
+ else
132
+ self.updated_at = nil
133
+ end
134
+
135
+ if attributes.key?(:'details')
136
+ self.details = attributes[:'details']
137
+ else
138
+ self.details = nil
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
146
+ invalid_properties = Array.new
147
+ if @id.nil?
148
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
149
+ end
150
+
151
+ if @name.nil?
152
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
153
+ end
154
+
155
+ if @emoji.nil?
156
+ invalid_properties.push('invalid value for "emoji", emoji cannot be nil.')
157
+ end
158
+
159
+ if @team_id.nil?
160
+ invalid_properties.push('invalid value for "team_id", team_id cannot be nil.')
161
+ end
162
+
163
+ if @created_at.nil?
164
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
165
+ end
166
+
167
+ if @updated_at.nil?
168
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
169
+ end
170
+
171
+ if @details.nil?
172
+ invalid_properties.push('invalid value for "details", details cannot be nil.')
173
+ end
174
+
175
+ invalid_properties
176
+ end
177
+
178
+ # Check to see if the all the properties in the model are valid
179
+ # @return true if the model is valid
180
+ def valid?
181
+ warn '[DEPRECATED] the `valid?` method is obsolete'
182
+ return false if @id.nil?
183
+ return false if @name.nil?
184
+ return false if @emoji.nil?
185
+ return false if @team_id.nil?
186
+ return false if @created_at.nil?
187
+ return false if @updated_at.nil?
188
+ return false if @details.nil?
189
+ true
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] id Value to be assigned
194
+ def id=(id)
195
+ if id.nil?
196
+ fail ArgumentError, 'id cannot be nil'
197
+ end
198
+
199
+ @id = id
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] name Value to be assigned
204
+ def name=(name)
205
+ if name.nil?
206
+ fail ArgumentError, 'name cannot be nil'
207
+ end
208
+
209
+ @name = name
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] emoji Value to be assigned
214
+ def emoji=(emoji)
215
+ if emoji.nil?
216
+ fail ArgumentError, 'emoji cannot be nil'
217
+ end
218
+
219
+ @emoji = emoji
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] team_id Value to be assigned
224
+ def team_id=(team_id)
225
+ if team_id.nil?
226
+ fail ArgumentError, 'team_id cannot be nil'
227
+ end
228
+
229
+ @team_id = team_id
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] created_at Value to be assigned
234
+ def created_at=(created_at)
235
+ if created_at.nil?
236
+ fail ArgumentError, 'created_at cannot be nil'
237
+ end
238
+
239
+ @created_at = created_at
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] updated_at Value to be assigned
244
+ def updated_at=(updated_at)
245
+ if updated_at.nil?
246
+ fail ArgumentError, 'updated_at cannot be nil'
247
+ end
248
+
249
+ @updated_at = updated_at
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] details Value to be assigned
254
+ def details=(details)
255
+ if details.nil?
256
+ fail ArgumentError, 'details cannot be nil'
257
+ end
258
+
259
+ @details = details
260
+ end
261
+
262
+ # Checks equality by comparing each attribute.
263
+ # @param [Object] Object to be compared
264
+ def ==(o)
265
+ return true if self.equal?(o)
266
+ self.class == o.class &&
267
+ id == o.id &&
268
+ name == o.name &&
269
+ emoji == o.emoji &&
270
+ properties == o.properties &&
271
+ team_id == o.team_id &&
272
+ created_at == o.created_at &&
273
+ updated_at == o.updated_at &&
274
+ details == o.details
275
+ end
276
+
277
+ # @see the `==` method
278
+ # @param [Object] Object to be compared
279
+ def eql?(o)
280
+ self == o
281
+ end
282
+
283
+ # Calculates hash code according to all attributes.
284
+ # @return [Integer] Hash code
285
+ def hash
286
+ [id, name, emoji, properties, team_id, created_at, updated_at, details].hash
287
+ end
288
+
289
+ # Builds the object from hash
290
+ # @param [Hash] attributes Model attributes in the form of hash
291
+ # @return [Object] Returns the model itself
292
+ def self.build_from_hash(attributes)
293
+ return nil unless attributes.is_a?(Hash)
294
+ attributes = attributes.transform_keys(&:to_sym)
295
+ transformed_hash = {}
296
+ openapi_types.each_pair do |key, type|
297
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
298
+ transformed_hash["#{key}"] = nil
299
+ elsif type =~ /\AArray<(.*)>/i
300
+ # check to ensure the input is an array given that the attribute
301
+ # is documented as an array but the input is not
302
+ if attributes[attribute_map[key]].is_a?(Array)
303
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
304
+ end
305
+ elsif !attributes[attribute_map[key]].nil?
306
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
307
+ end
308
+ end
309
+ new(transformed_hash)
310
+ end
311
+
312
+ # Returns the object in the form of hash
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_hash
315
+ hash = {}
316
+ self.class.attribute_map.each_pair do |attr, param|
317
+ value = self.send(attr)
318
+ if value.nil?
319
+ is_nullable = self.class.openapi_nullable.include?(attr)
320
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
321
+ end
322
+
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ end
329
+
330
+ end