sib-api-v3-sdk 3.0.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -11
  3. data/docs/AddContactToList.md +8 -0
  4. data/docs/AddCredits.md +2 -2
  5. data/docs/ContactsApi.md +9 -9
  6. data/docs/CreateReseller.md +8 -0
  7. data/docs/GetChildInfo.md +2 -2
  8. data/docs/GetChildInfoApiKeys.md +2 -3
  9. data/docs/GetChildInfoApiKeysV2.md +9 -0
  10. data/docs/GetChildInfoApiKeysV3.md +9 -0
  11. data/docs/GetEmailCampaign.md +2 -0
  12. data/docs/GetSmsCampaign.md +2 -0
  13. data/docs/ListsApi.md +9 -9
  14. data/docs/ManageIp.md +1 -1
  15. data/docs/RemoveContactFromList.md +9 -0
  16. data/docs/RemoveCredits.md +2 -2
  17. data/docs/ResellerApi.md +45 -45
  18. data/docs/SendSmtpEmail.md +7 -5
  19. data/docs/UpdateChild.md +0 -1
  20. data/lib/sib-api-v3-sdk.rb +5 -2
  21. data/lib/sib-api-v3-sdk/api/contacts_api.rb +7 -7
  22. data/lib/sib-api-v3-sdk/api/lists_api.rb +7 -7
  23. data/lib/sib-api-v3-sdk/api/reseller_api.rb +82 -82
  24. data/lib/sib-api-v3-sdk/models/{add_remove_contact_to_list.rb → add_contact_to_list.rb} +2 -2
  25. data/lib/sib-api-v3-sdk/models/add_credits.rb +2 -2
  26. data/lib/sib-api-v3-sdk/models/create_reseller.rb +194 -0
  27. data/lib/sib-api-v3-sdk/models/error_model.rb +2 -2
  28. data/lib/sib-api-v3-sdk/models/get_child_info.rb +3 -6
  29. data/lib/sib-api-v3-sdk/models/get_child_info_api_keys.rb +21 -34
  30. data/lib/sib-api-v3-sdk/models/get_child_info_api_keys_v2.rb +209 -0
  31. data/lib/sib-api-v3-sdk/models/get_child_info_api_keys_v3.rb +209 -0
  32. data/lib/sib-api-v3-sdk/models/get_email_campaign.rb +32 -4
  33. data/lib/sib-api-v3-sdk/models/get_sms_campaign.rb +32 -4
  34. data/lib/sib-api-v3-sdk/models/manage_ip.rb +8 -8
  35. data/lib/sib-api-v3-sdk/models/{get_child_info_ips.rb → remove_contact_from_list.rb} +18 -26
  36. data/lib/sib-api-v3-sdk/models/remove_credits.rb +2 -2
  37. data/lib/sib-api-v3-sdk/models/send_smtp_email.rb +29 -23
  38. data/lib/sib-api-v3-sdk/models/send_smtp_email_sender.rb +1 -1
  39. data/lib/sib-api-v3-sdk/models/update_child.rb +4 -15
  40. data/lib/sib-api-v3-sdk/version.rb +1 -1
  41. data/spec/api/contacts_api_spec.rb +2 -2
  42. data/spec/api/lists_api_spec.rb +2 -2
  43. data/spec/api/reseller_api_spec.rb +12 -12
  44. data/spec/models/{add_remove_contact_to_list_spec.rb → add_contact_to_list_spec.rb} +6 -6
  45. data/spec/models/create_reseller_spec.rb +42 -0
  46. data/spec/models/error_model_spec.rb +1 -1
  47. data/spec/models/get_child_info_api_keys_spec.rb +2 -8
  48. data/spec/models/{get_child_info_ips_spec.rb → get_child_info_api_keys_v2_spec.rb} +8 -8
  49. data/spec/models/get_child_info_api_keys_v3_spec.rb +48 -0
  50. data/spec/models/get_email_campaign_spec.rb +12 -0
  51. data/spec/models/get_sms_campaign_spec.rb +12 -0
  52. data/spec/models/manage_ip_spec.rb +1 -1
  53. data/spec/models/remove_contact_from_list_spec.rb +48 -0
  54. data/spec/models/send_smtp_email_spec.rb +12 -0
  55. data/spec/models/update_child_spec.rb +0 -6
  56. metadata +22 -10
  57. data/docs/AddRemoveContactToList.md +0 -8
  58. data/docs/GetChildInfoIps.md +0 -9
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #SendinBlue API
3
+
4
+ #SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed |
5
+
6
+ OpenAPI spec version: 3.0.0
7
+ Contact: contact@sendinblue.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SibApiV3Sdk
16
+
17
+ class GetChildInfoApiKeysV3
18
+ # Name of the key for version 3
19
+ attr_accessor :name
20
+
21
+ # API Key for version 3
22
+ attr_accessor :key
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'name' => :'name',
29
+ :'key' => :'key'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'name' => :'String',
37
+ :'key' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'name')
50
+ self.name = attributes[:'name']
51
+ end
52
+
53
+ if attributes.has_key?(:'key')
54
+ self.key = attributes[:'key']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @name.nil?
64
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
65
+ end
66
+
67
+ if @key.nil?
68
+ invalid_properties.push("invalid value for 'key', key cannot be nil.")
69
+ end
70
+
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return false if @name.nil?
78
+ return false if @key.nil?
79
+ return true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ name == o.name &&
88
+ key == o.key
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [name, key].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = SibApiV3Sdk.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end
@@ -74,6 +74,10 @@ module SibApiV3Sdk
74
74
  # FOR TRIGGER ONLY ! Type of trigger campaign.recurring = false means contact can receive the same Trigger campaign only once, & recurring = true means contact can receive the same Trigger campaign several times
75
75
  attr_accessor :recurring
76
76
 
77
+ attr_accessor :recipients
78
+
79
+ attr_accessor :statistics
80
+
77
81
  class EnumAttributeValidator
78
82
  attr_reader :datatype
79
83
  attr_reader :allowable_values
@@ -118,7 +122,9 @@ module SibApiV3Sdk
118
122
  :'modified_at' => :'modifiedAt',
119
123
  :'inline_image_activation' => :'inlineImageActivation',
120
124
  :'mirror_active' => :'mirrorActive',
121
- :'recurring' => :'recurring'
125
+ :'recurring' => :'recurring',
126
+ :'recipients' => :'recipients',
127
+ :'statistics' => :'statistics'
122
128
  }
123
129
  end
124
130
 
@@ -144,7 +150,9 @@ module SibApiV3Sdk
144
150
  :'modified_at' => :'DateTime',
145
151
  :'inline_image_activation' => :'BOOLEAN',
146
152
  :'mirror_active' => :'BOOLEAN',
147
- :'recurring' => :'BOOLEAN'
153
+ :'recurring' => :'BOOLEAN',
154
+ :'recipients' => :'Object',
155
+ :'statistics' => :'Object'
148
156
  }
149
157
  end
150
158
 
@@ -236,6 +244,14 @@ module SibApiV3Sdk
236
244
  self.recurring = attributes[:'recurring']
237
245
  end
238
246
 
247
+ if attributes.has_key?(:'recipients')
248
+ self.recipients = attributes[:'recipients']
249
+ end
250
+
251
+ if attributes.has_key?(:'statistics')
252
+ self.statistics = attributes[:'statistics']
253
+ end
254
+
239
255
  end
240
256
 
241
257
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -302,6 +318,14 @@ module SibApiV3Sdk
302
318
  invalid_properties.push("invalid value for 'modified_at', modified_at cannot be nil.")
303
319
  end
304
320
 
321
+ if @recipients.nil?
322
+ invalid_properties.push("invalid value for 'recipients', recipients cannot be nil.")
323
+ end
324
+
325
+ if @statistics.nil?
326
+ invalid_properties.push("invalid value for 'statistics', statistics cannot be nil.")
327
+ end
328
+
305
329
  return invalid_properties
306
330
  end
307
331
 
@@ -327,6 +351,8 @@ module SibApiV3Sdk
327
351
  return false if @tag.nil?
328
352
  return false if @created_at.nil?
329
353
  return false if @modified_at.nil?
354
+ return false if @recipients.nil?
355
+ return false if @statistics.nil?
330
356
  return true
331
357
  end
332
358
 
@@ -374,7 +400,9 @@ module SibApiV3Sdk
374
400
  modified_at == o.modified_at &&
375
401
  inline_image_activation == o.inline_image_activation &&
376
402
  mirror_active == o.mirror_active &&
377
- recurring == o.recurring
403
+ recurring == o.recurring &&
404
+ recipients == o.recipients &&
405
+ statistics == o.statistics
378
406
  end
379
407
 
380
408
  # @see the `==` method
@@ -386,7 +414,7 @@ module SibApiV3Sdk
386
414
  # Calculates hash code according to all attributes.
387
415
  # @return [Fixnum] Hash code
388
416
  def hash
389
- [id, name, subject, type, status, scheduled_at, test_sent, header, footer, sender, reply_to, to_field, html_content, share_link, tag, created_at, modified_at, inline_image_activation, mirror_active, recurring].hash
417
+ [id, name, subject, type, status, scheduled_at, test_sent, header, footer, sender, reply_to, to_field, html_content, share_link, tag, created_at, modified_at, inline_image_activation, mirror_active, recurring, recipients, statistics].hash
390
418
  end
391
419
 
392
420
  # Builds the object from hash
@@ -42,6 +42,10 @@ module SibApiV3Sdk
42
42
  # UTC date-time of last modification of the SMS campaign (YYYY-MM-DDTHH:mm:ss.SSSZ)
43
43
  attr_accessor :modified_at
44
44
 
45
+ attr_accessor :recipients
46
+
47
+ attr_accessor :statistics
48
+
45
49
  class EnumAttributeValidator
46
50
  attr_reader :datatype
47
51
  attr_reader :allowable_values
@@ -75,7 +79,9 @@ module SibApiV3Sdk
75
79
  :'test_sent' => :'testSent',
76
80
  :'sender' => :'sender',
77
81
  :'created_at' => :'createdAt',
78
- :'modified_at' => :'modifiedAt'
82
+ :'modified_at' => :'modifiedAt',
83
+ :'recipients' => :'recipients',
84
+ :'statistics' => :'statistics'
79
85
  }
80
86
  end
81
87
 
@@ -90,7 +96,9 @@ module SibApiV3Sdk
90
96
  :'test_sent' => :'BOOLEAN',
91
97
  :'sender' => :'String',
92
98
  :'created_at' => :'DateTime',
93
- :'modified_at' => :'DateTime'
99
+ :'modified_at' => :'DateTime',
100
+ :'recipients' => :'Object',
101
+ :'statistics' => :'Object'
94
102
  }
95
103
  end
96
104
 
@@ -138,6 +146,14 @@ module SibApiV3Sdk
138
146
  self.modified_at = attributes[:'modifiedAt']
139
147
  end
140
148
 
149
+ if attributes.has_key?(:'recipients')
150
+ self.recipients = attributes[:'recipients']
151
+ end
152
+
153
+ if attributes.has_key?(:'statistics')
154
+ self.statistics = attributes[:'statistics']
155
+ end
156
+
141
157
  end
142
158
 
143
159
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -180,6 +196,14 @@ module SibApiV3Sdk
180
196
  invalid_properties.push("invalid value for 'modified_at', modified_at cannot be nil.")
181
197
  end
182
198
 
199
+ if @recipients.nil?
200
+ invalid_properties.push("invalid value for 'recipients', recipients cannot be nil.")
201
+ end
202
+
203
+ if @statistics.nil?
204
+ invalid_properties.push("invalid value for 'statistics', statistics cannot be nil.")
205
+ end
206
+
183
207
  return invalid_properties
184
208
  end
185
209
 
@@ -197,6 +221,8 @@ module SibApiV3Sdk
197
221
  return false if @sender.nil?
198
222
  return false if @created_at.nil?
199
223
  return false if @modified_at.nil?
224
+ return false if @recipients.nil?
225
+ return false if @statistics.nil?
200
226
  return true
201
227
  end
202
228
 
@@ -223,7 +249,9 @@ module SibApiV3Sdk
223
249
  test_sent == o.test_sent &&
224
250
  sender == o.sender &&
225
251
  created_at == o.created_at &&
226
- modified_at == o.modified_at
252
+ modified_at == o.modified_at &&
253
+ recipients == o.recipients &&
254
+ statistics == o.statistics
227
255
  end
228
256
 
229
257
  # @see the `==` method
@@ -235,7 +263,7 @@ module SibApiV3Sdk
235
263
  # Calculates hash code according to all attributes.
236
264
  # @return [Fixnum] Hash code
237
265
  def hash
238
- [id, name, status, content, scheduled_at, test_sent, sender, created_at, modified_at].hash
266
+ [id, name, status, content, scheduled_at, test_sent, sender, created_at, modified_at, recipients, statistics].hash
239
267
  end
240
268
 
241
269
  # Builds the object from hash
@@ -15,21 +15,21 @@ require 'date'
15
15
  module SibApiV3Sdk
16
16
 
17
17
  class ManageIp
18
- # ID of the IP
19
- attr_accessor :ip_id
18
+ # Dedicated ID
19
+ attr_accessor :ip
20
20
 
21
21
 
22
22
  # Attribute mapping from ruby-style variable name to JSON key.
23
23
  def self.attribute_map
24
24
  {
25
- :'ip_id' => :'ipId'
25
+ :'ip' => :'ip'
26
26
  }
27
27
  end
28
28
 
29
29
  # Attribute type mapping.
30
30
  def self.swagger_types
31
31
  {
32
- :'ip_id' => :'Integer'
32
+ :'ip' => :'String'
33
33
  }
34
34
  end
35
35
 
@@ -41,8 +41,8 @@ module SibApiV3Sdk
41
41
  # convert string to symbol for hash key
42
42
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
43
 
44
- if attributes.has_key?(:'ipId')
45
- self.ip_id = attributes[:'ipId']
44
+ if attributes.has_key?(:'ip')
45
+ self.ip = attributes[:'ip']
46
46
  end
47
47
 
48
48
  end
@@ -65,7 +65,7 @@ module SibApiV3Sdk
65
65
  def ==(o)
66
66
  return true if self.equal?(o)
67
67
  self.class == o.class &&
68
- ip_id == o.ip_id
68
+ ip == o.ip
69
69
  end
70
70
 
71
71
  # @see the `==` method
@@ -77,7 +77,7 @@ module SibApiV3Sdk
77
77
  # Calculates hash code according to all attributes.
78
78
  # @return [Fixnum] Hash code
79
79
  def hash
80
- [ip_id].hash
80
+ [ip].hash
81
81
  end
82
82
 
83
83
  # Builds the object from hash
@@ -14,27 +14,27 @@ require 'date'
14
14
 
15
15
  module SibApiV3Sdk
16
16
 
17
- class GetChildInfoIps
18
- # ID of the IP
19
- attr_accessor :id
17
+ class RemoveContactFromList
18
+ # Required if 'all' is false. Emails to remove from a list
19
+ attr_accessor :emails
20
20
 
21
- # IP associated to the child account user
22
- attr_accessor :ip
21
+ # Required if 'emails' is empty. Remove all existing contacts from a list
22
+ attr_accessor :all
23
23
 
24
24
 
25
25
  # Attribute mapping from ruby-style variable name to JSON key.
26
26
  def self.attribute_map
27
27
  {
28
- :'id' => :'id',
29
- :'ip' => :'ip'
28
+ :'emails' => :'emails',
29
+ :'all' => :'all'
30
30
  }
31
31
  end
32
32
 
33
33
  # Attribute type mapping.
34
34
  def self.swagger_types
35
35
  {
36
- :'id' => :'Integer',
37
- :'ip' => :'String'
36
+ :'emails' => :'Array<String>',
37
+ :'all' => :'BOOLEAN'
38
38
  }
39
39
  end
40
40
 
@@ -46,12 +46,14 @@ module SibApiV3Sdk
46
46
  # convert string to symbol for hash key
47
47
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
48
 
49
- if attributes.has_key?(:'id')
50
- self.id = attributes[:'id']
49
+ if attributes.has_key?(:'emails')
50
+ if (value = attributes[:'emails']).is_a?(Array)
51
+ self.emails = value
52
+ end
51
53
  end
52
54
 
53
- if attributes.has_key?(:'ip')
54
- self.ip = attributes[:'ip']
55
+ if attributes.has_key?(:'all')
56
+ self.all = attributes[:'all']
55
57
  end
56
58
 
57
59
  end
@@ -60,22 +62,12 @@ module SibApiV3Sdk
60
62
  # @return Array for valid properties with the reasons
61
63
  def list_invalid_properties
62
64
  invalid_properties = Array.new
63
- if @id.nil?
64
- invalid_properties.push("invalid value for 'id', id cannot be nil.")
65
- end
66
-
67
- if @ip.nil?
68
- invalid_properties.push("invalid value for 'ip', ip cannot be nil.")
69
- end
70
-
71
65
  return invalid_properties
72
66
  end
73
67
 
74
68
  # Check to see if the all the properties in the model are valid
75
69
  # @return true if the model is valid
76
70
  def valid?
77
- return false if @id.nil?
78
- return false if @ip.nil?
79
71
  return true
80
72
  end
81
73
 
@@ -84,8 +76,8 @@ module SibApiV3Sdk
84
76
  def ==(o)
85
77
  return true if self.equal?(o)
86
78
  self.class == o.class &&
87
- id == o.id &&
88
- ip == o.ip
79
+ emails == o.emails &&
80
+ all == o.all
89
81
  end
90
82
 
91
83
  # @see the `==` method
@@ -97,7 +89,7 @@ module SibApiV3Sdk
97
89
  # Calculates hash code according to all attributes.
98
90
  # @return [Fixnum] Hash code
99
91
  def hash
100
- [id, ip].hash
92
+ [emails, all].hash
101
93
  end
102
94
 
103
95
  # Builds the object from hash