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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +258 -2
- data/lib/unsent/analytics.rb +30 -0
- data/lib/unsent/api_keys.rb +21 -0
- data/lib/unsent/campaigns.rb +4 -0
- data/lib/unsent/client.rb +8 -1
- data/lib/unsent/contact_books.rb +29 -0
- data/lib/unsent/contacts.rb +11 -0
- data/lib/unsent/emails.rb +47 -0
- data/lib/unsent/errors.rb +2 -0
- data/lib/unsent/models/add_suppression_request.rb +223 -0
- data/lib/unsent/models/create_api_key_request.rb +218 -0
- data/lib/unsent/models/create_campaign200_response.rb +750 -0
- data/lib/unsent/models/create_campaign_request.rb +426 -0
- data/lib/unsent/models/create_campaign_request_reply_to.rb +103 -0
- data/lib/unsent/models/create_contact200_response.rb +147 -0
- data/lib/unsent/models/create_contact_book200_response.rb +304 -0
- data/lib/unsent/models/create_contact_book_request.rb +193 -0
- data/lib/unsent/models/create_contact_request.rb +202 -0
- data/lib/unsent/models/create_domain_request.rb +190 -0
- data/lib/unsent/models/create_template200_response.rb +164 -0
- data/lib/unsent/models/create_template_request.rb +226 -0
- data/lib/unsent/models/delete_contact_book200_response.rb +164 -0
- data/lib/unsent/models/get_api_keys200_response_inner.rb +278 -0
- data/lib/unsent/models/get_campaigns200_response_inner.rb +296 -0
- data/lib/unsent/models/get_contact_book200_response.rb +330 -0
- data/lib/unsent/models/get_contact_book200_response_details.rb +218 -0
- data/lib/unsent/models/get_domains200_response_inner.rb +482 -0
- data/lib/unsent/models/get_domains200_response_inner_dns_records_inner.rb +318 -0
- data/lib/unsent/models/get_health200_response.rb +216 -0
- data/lib/unsent/models/get_templates200_response_inner.rb +314 -0
- data/lib/unsent/models/list_emails_domain_id_parameter.rb +103 -0
- data/lib/unsent/models/schedule_campaign_request.rb +185 -0
- data/lib/unsent/models/send_email_request.rb +378 -0
- data/lib/unsent/models/send_email_request_to.rb +103 -0
- data/lib/unsent/models/update_contact_book200_response.rb +190 -0
- data/lib/unsent/models/update_contact_book_request.rb +167 -0
- data/lib/unsent/models/update_contact_request.rb +176 -0
- data/lib/unsent/models/update_template_request.rb +174 -0
- data/lib/unsent/settings.rb +13 -0
- data/lib/unsent/suppressions.rb +28 -0
- data/lib/unsent/templates.rb +29 -0
- data/lib/unsent/version.rb +1 -1
- data/lib/unsent/webhooks.rb +25 -0
- data/lib/unsent.rb +7 -0
- metadata +38 -2
|
@@ -0,0 +1,314 @@
|
|
|
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 GetTemplates200ResponseInner < ApiModelBase
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
attr_accessor :subject
|
|
23
|
+
|
|
24
|
+
attr_accessor :html
|
|
25
|
+
|
|
26
|
+
attr_accessor :content
|
|
27
|
+
|
|
28
|
+
attr_accessor :team_id
|
|
29
|
+
|
|
30
|
+
attr_accessor :created_at
|
|
31
|
+
|
|
32
|
+
attr_accessor :updated_at
|
|
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
|
+
:'subject' => :'subject',
|
|
40
|
+
:'html' => :'html',
|
|
41
|
+
:'content' => :'content',
|
|
42
|
+
:'team_id' => :'teamId',
|
|
43
|
+
:'created_at' => :'createdAt',
|
|
44
|
+
:'updated_at' => :'updatedAt'
|
|
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
|
+
:'subject' => :'String',
|
|
64
|
+
:'html' => :'String',
|
|
65
|
+
:'content' => :'String',
|
|
66
|
+
:'team_id' => :'String',
|
|
67
|
+
:'created_at' => :'String',
|
|
68
|
+
:'updated_at' => :'String'
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# List of attributes with nullable: true
|
|
73
|
+
def self.openapi_nullable
|
|
74
|
+
Set.new([
|
|
75
|
+
:'html',
|
|
76
|
+
:'content',
|
|
77
|
+
])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Initializes the object
|
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
82
|
+
def initialize(attributes = {})
|
|
83
|
+
if (!attributes.is_a?(Hash))
|
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetTemplates200ResponseInner` initialize method"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
88
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
89
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
90
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetTemplates200ResponseInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
92
|
+
end
|
|
93
|
+
h[k.to_sym] = v
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'id')
|
|
97
|
+
self.id = attributes[:'id']
|
|
98
|
+
else
|
|
99
|
+
self.id = nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'name')
|
|
103
|
+
self.name = attributes[:'name']
|
|
104
|
+
else
|
|
105
|
+
self.name = nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'subject')
|
|
109
|
+
self.subject = attributes[:'subject']
|
|
110
|
+
else
|
|
111
|
+
self.subject = nil
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'html')
|
|
115
|
+
self.html = attributes[:'html']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'content')
|
|
119
|
+
self.content = attributes[:'content']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'team_id')
|
|
123
|
+
self.team_id = attributes[:'team_id']
|
|
124
|
+
else
|
|
125
|
+
self.team_id = nil
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'created_at')
|
|
129
|
+
self.created_at = attributes[:'created_at']
|
|
130
|
+
else
|
|
131
|
+
self.created_at = nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'updated_at')
|
|
135
|
+
self.updated_at = attributes[:'updated_at']
|
|
136
|
+
else
|
|
137
|
+
self.updated_at = nil
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
142
|
+
# @return Array for valid properties with the reasons
|
|
143
|
+
def list_invalid_properties
|
|
144
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
145
|
+
invalid_properties = Array.new
|
|
146
|
+
if @id.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if @name.nil?
|
|
151
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if @subject.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "subject", subject cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if @team_id.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "team_id", team_id cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @created_at.nil?
|
|
163
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if @updated_at.nil?
|
|
167
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
invalid_properties
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Check to see if the all the properties in the model are valid
|
|
174
|
+
# @return true if the model is valid
|
|
175
|
+
def valid?
|
|
176
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
177
|
+
return false if @id.nil?
|
|
178
|
+
return false if @name.nil?
|
|
179
|
+
return false if @subject.nil?
|
|
180
|
+
return false if @team_id.nil?
|
|
181
|
+
return false if @created_at.nil?
|
|
182
|
+
return false if @updated_at.nil?
|
|
183
|
+
true
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Custom attribute writer method with validation
|
|
187
|
+
# @param [Object] id Value to be assigned
|
|
188
|
+
def id=(id)
|
|
189
|
+
if id.nil?
|
|
190
|
+
fail ArgumentError, 'id cannot be nil'
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
@id = id
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Custom attribute writer method with validation
|
|
197
|
+
# @param [Object] name Value to be assigned
|
|
198
|
+
def name=(name)
|
|
199
|
+
if name.nil?
|
|
200
|
+
fail ArgumentError, 'name cannot be nil'
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
@name = name
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Custom attribute writer method with validation
|
|
207
|
+
# @param [Object] subject Value to be assigned
|
|
208
|
+
def subject=(subject)
|
|
209
|
+
if subject.nil?
|
|
210
|
+
fail ArgumentError, 'subject cannot be nil'
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
@subject = subject
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Custom attribute writer method with validation
|
|
217
|
+
# @param [Object] team_id Value to be assigned
|
|
218
|
+
def team_id=(team_id)
|
|
219
|
+
if team_id.nil?
|
|
220
|
+
fail ArgumentError, 'team_id cannot be nil'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
@team_id = team_id
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Custom attribute writer method with validation
|
|
227
|
+
# @param [Object] created_at Value to be assigned
|
|
228
|
+
def created_at=(created_at)
|
|
229
|
+
if created_at.nil?
|
|
230
|
+
fail ArgumentError, 'created_at cannot be nil'
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
@created_at = created_at
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Custom attribute writer method with validation
|
|
237
|
+
# @param [Object] updated_at Value to be assigned
|
|
238
|
+
def updated_at=(updated_at)
|
|
239
|
+
if updated_at.nil?
|
|
240
|
+
fail ArgumentError, 'updated_at cannot be nil'
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
@updated_at = updated_at
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Checks equality by comparing each attribute.
|
|
247
|
+
# @param [Object] Object to be compared
|
|
248
|
+
def ==(o)
|
|
249
|
+
return true if self.equal?(o)
|
|
250
|
+
self.class == o.class &&
|
|
251
|
+
id == o.id &&
|
|
252
|
+
name == o.name &&
|
|
253
|
+
subject == o.subject &&
|
|
254
|
+
html == o.html &&
|
|
255
|
+
content == o.content &&
|
|
256
|
+
team_id == o.team_id &&
|
|
257
|
+
created_at == o.created_at &&
|
|
258
|
+
updated_at == o.updated_at
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# @see the `==` method
|
|
262
|
+
# @param [Object] Object to be compared
|
|
263
|
+
def eql?(o)
|
|
264
|
+
self == o
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Calculates hash code according to all attributes.
|
|
268
|
+
# @return [Integer] Hash code
|
|
269
|
+
def hash
|
|
270
|
+
[id, name, subject, html, content, team_id, created_at, updated_at].hash
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Builds the object from hash
|
|
274
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
275
|
+
# @return [Object] Returns the model itself
|
|
276
|
+
def self.build_from_hash(attributes)
|
|
277
|
+
return nil unless attributes.is_a?(Hash)
|
|
278
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
279
|
+
transformed_hash = {}
|
|
280
|
+
openapi_types.each_pair do |key, type|
|
|
281
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
282
|
+
transformed_hash["#{key}"] = nil
|
|
283
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
284
|
+
# check to ensure the input is an array given that the attribute
|
|
285
|
+
# is documented as an array but the input is not
|
|
286
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
287
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
288
|
+
end
|
|
289
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
290
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
new(transformed_hash)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Returns the object in the form of hash
|
|
297
|
+
# @return [Hash] Returns the object in the form of hash
|
|
298
|
+
def to_hash
|
|
299
|
+
hash = {}
|
|
300
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
301
|
+
value = self.send(attr)
|
|
302
|
+
if value.nil?
|
|
303
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
304
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
hash[param] = _to_hash(value)
|
|
308
|
+
end
|
|
309
|
+
hash
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
module ListEmailsDomainIdParameter
|
|
18
|
+
class << self
|
|
19
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
20
|
+
def openapi_any_of
|
|
21
|
+
[
|
|
22
|
+
:'Array<String>',
|
|
23
|
+
:'String'
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Builds the object
|
|
28
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
29
|
+
# @return [Object] Returns the model or the data itself
|
|
30
|
+
def build(data)
|
|
31
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
32
|
+
# Note:
|
|
33
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
34
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
35
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
36
|
+
# - TODO: logging when debugging is set.
|
|
37
|
+
openapi_any_of.each do |klass|
|
|
38
|
+
begin
|
|
39
|
+
next if klass == :AnyType # "nullable: true"
|
|
40
|
+
return find_and_cast_into_type(klass, data)
|
|
41
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
51
|
+
|
|
52
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
53
|
+
def find_and_cast_into_type(klass, data)
|
|
54
|
+
return if data.nil?
|
|
55
|
+
|
|
56
|
+
case klass.to_s
|
|
57
|
+
when 'Boolean'
|
|
58
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
59
|
+
when 'Float'
|
|
60
|
+
return data if data.instance_of?(Float)
|
|
61
|
+
when 'Integer'
|
|
62
|
+
return data if data.instance_of?(Integer)
|
|
63
|
+
when 'Time'
|
|
64
|
+
return Time.parse(data)
|
|
65
|
+
when 'Date'
|
|
66
|
+
return Date.iso8601(data)
|
|
67
|
+
when 'String'
|
|
68
|
+
return data if data.instance_of?(String)
|
|
69
|
+
when 'Object' # "type: object"
|
|
70
|
+
return data if data.instance_of?(Hash)
|
|
71
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
72
|
+
if data.instance_of?(Array)
|
|
73
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
74
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
75
|
+
end
|
|
76
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
77
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
78
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
79
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
80
|
+
end
|
|
81
|
+
else # model
|
|
82
|
+
const = Unsent.const_get(klass)
|
|
83
|
+
if const
|
|
84
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
85
|
+
model = const.build(data)
|
|
86
|
+
return model if model
|
|
87
|
+
else
|
|
88
|
+
# raise if data contains keys that are not known to the model
|
|
89
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
90
|
+
model = const.build_from_hash(data)
|
|
91
|
+
return model if model
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
raise # if no match by now, raise
|
|
97
|
+
rescue
|
|
98
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,185 @@
|
|
|
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 ScheduleCampaignRequest < ApiModelBase
|
|
18
|
+
# Timestamp in ISO 8601 format or natural language (e.g., 'tomorrow 9am', 'next monday 10:30')
|
|
19
|
+
attr_accessor :scheduled_at
|
|
20
|
+
|
|
21
|
+
attr_accessor :batch_size
|
|
22
|
+
|
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
|
+
def self.attribute_map
|
|
25
|
+
{
|
|
26
|
+
:'scheduled_at' => :'scheduledAt',
|
|
27
|
+
:'batch_size' => :'batchSize'
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns attribute mapping this model knows about
|
|
32
|
+
def self.acceptable_attribute_map
|
|
33
|
+
attribute_map
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
|
37
|
+
def self.acceptable_attributes
|
|
38
|
+
acceptable_attribute_map.values
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute type mapping.
|
|
42
|
+
def self.openapi_types
|
|
43
|
+
{
|
|
44
|
+
:'scheduled_at' => :'String',
|
|
45
|
+
:'batch_size' => :'Integer'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# List of attributes with nullable: true
|
|
50
|
+
def self.openapi_nullable
|
|
51
|
+
Set.new([
|
|
52
|
+
])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Initializes the object
|
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
57
|
+
def initialize(attributes = {})
|
|
58
|
+
if (!attributes.is_a?(Hash))
|
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::ScheduleCampaignRequest` initialize method"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
63
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
64
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
65
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
66
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::ScheduleCampaignRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
67
|
+
end
|
|
68
|
+
h[k.to_sym] = v
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if attributes.key?(:'scheduled_at')
|
|
72
|
+
self.scheduled_at = attributes[:'scheduled_at']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.key?(:'batch_size')
|
|
76
|
+
self.batch_size = attributes[:'batch_size']
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
81
|
+
# @return Array for valid properties with the reasons
|
|
82
|
+
def list_invalid_properties
|
|
83
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
84
|
+
invalid_properties = Array.new
|
|
85
|
+
if !@batch_size.nil? && @batch_size > 100000
|
|
86
|
+
invalid_properties.push('invalid value for "batch_size", must be smaller than or equal to 100000.')
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if !@batch_size.nil? && @batch_size < 1
|
|
90
|
+
invalid_properties.push('invalid value for "batch_size", must be greater than or equal to 1.')
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
invalid_properties
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Check to see if the all the properties in the model are valid
|
|
97
|
+
# @return true if the model is valid
|
|
98
|
+
def valid?
|
|
99
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
100
|
+
return false if !@batch_size.nil? && @batch_size > 100000
|
|
101
|
+
return false if !@batch_size.nil? && @batch_size < 1
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Custom attribute writer method with validation
|
|
106
|
+
# @param [Object] batch_size Value to be assigned
|
|
107
|
+
def batch_size=(batch_size)
|
|
108
|
+
if batch_size.nil?
|
|
109
|
+
fail ArgumentError, 'batch_size cannot be nil'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if batch_size > 100000
|
|
113
|
+
fail ArgumentError, 'invalid value for "batch_size", must be smaller than or equal to 100000.'
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if batch_size < 1
|
|
117
|
+
fail ArgumentError, 'invalid value for "batch_size", must be greater than or equal to 1.'
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
@batch_size = batch_size
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Checks equality by comparing each attribute.
|
|
124
|
+
# @param [Object] Object to be compared
|
|
125
|
+
def ==(o)
|
|
126
|
+
return true if self.equal?(o)
|
|
127
|
+
self.class == o.class &&
|
|
128
|
+
scheduled_at == o.scheduled_at &&
|
|
129
|
+
batch_size == o.batch_size
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# @see the `==` method
|
|
133
|
+
# @param [Object] Object to be compared
|
|
134
|
+
def eql?(o)
|
|
135
|
+
self == o
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Calculates hash code according to all attributes.
|
|
139
|
+
# @return [Integer] Hash code
|
|
140
|
+
def hash
|
|
141
|
+
[scheduled_at, batch_size].hash
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Builds the object from hash
|
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
146
|
+
# @return [Object] Returns the model itself
|
|
147
|
+
def self.build_from_hash(attributes)
|
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
|
149
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
150
|
+
transformed_hash = {}
|
|
151
|
+
openapi_types.each_pair do |key, type|
|
|
152
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
153
|
+
transformed_hash["#{key}"] = nil
|
|
154
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
155
|
+
# check to ensure the input is an array given that the attribute
|
|
156
|
+
# is documented as an array but the input is not
|
|
157
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
158
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
159
|
+
end
|
|
160
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
161
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
new(transformed_hash)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Returns the object in the form of hash
|
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
|
169
|
+
def to_hash
|
|
170
|
+
hash = {}
|
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
172
|
+
value = self.send(attr)
|
|
173
|
+
if value.nil?
|
|
174
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
175
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
hash[param] = _to_hash(value)
|
|
179
|
+
end
|
|
180
|
+
hash
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
end
|