sendpost_ruby_sdk 1.0.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +155 -1
  3. data/config-ruby.json +2 -2
  4. data/docs/CountStat.md +18 -0
  5. data/docs/DeleteResponse.md +20 -0
  6. data/docs/EventMetadata.md +4 -0
  7. data/docs/RDSuppression.md +18 -0
  8. data/docs/RSuppression.md +24 -0
  9. data/docs/Suppression.md +26 -0
  10. data/docs/SuppressionApi.md +293 -0
  11. data/docs/SuppressionEmail.md +18 -0
  12. data/generate-libs.bash +1 -1
  13. data/git_push.sh +2 -2
  14. data/lib/sendpost_ruby_sdk/api/email_api.rb +1 -1
  15. data/lib/sendpost_ruby_sdk/api/suppression_api.rb +305 -0
  16. data/lib/sendpost_ruby_sdk/api_client.rb +1 -1
  17. data/lib/sendpost_ruby_sdk/api_error.rb +1 -1
  18. data/lib/sendpost_ruby_sdk/configuration.rb +12 -10
  19. data/lib/sendpost_ruby_sdk/models/attachment.rb +13 -18
  20. data/lib/sendpost_ruby_sdk/models/city.rb +13 -18
  21. data/lib/sendpost_ruby_sdk/models/copy_to.rb +13 -18
  22. data/lib/sendpost_ruby_sdk/models/count_stat.rb +214 -0
  23. data/lib/sendpost_ruby_sdk/models/delete_response.rb +223 -0
  24. data/lib/sendpost_ruby_sdk/models/device.rb +13 -18
  25. data/lib/sendpost_ruby_sdk/models/email_message.rb +13 -18
  26. data/lib/sendpost_ruby_sdk/models/email_response.rb +13 -18
  27. data/lib/sendpost_ruby_sdk/models/event_metadata.rb +32 -19
  28. data/lib/sendpost_ruby_sdk/models/from.rb +13 -18
  29. data/lib/sendpost_ruby_sdk/models/os.rb +13 -18
  30. data/lib/sendpost_ruby_sdk/models/q_email_message.rb +13 -18
  31. data/lib/sendpost_ruby_sdk/models/q_event.rb +13 -18
  32. data/lib/sendpost_ruby_sdk/models/r_suppression.rb +249 -0
  33. data/lib/sendpost_ruby_sdk/models/rd_suppression.rb +216 -0
  34. data/lib/sendpost_ruby_sdk/models/reply_to.rb +13 -18
  35. data/lib/sendpost_ruby_sdk/models/suppression.rb +250 -0
  36. data/lib/sendpost_ruby_sdk/models/suppression_email.rb +214 -0
  37. data/lib/sendpost_ruby_sdk/models/to.rb +13 -18
  38. data/lib/sendpost_ruby_sdk/models/user_agent.rb +13 -18
  39. data/lib/sendpost_ruby_sdk/models/webhook_event.rb +13 -18
  40. data/lib/sendpost_ruby_sdk/version.rb +2 -2
  41. data/lib/sendpost_ruby_sdk.rb +8 -1
  42. data/sendpost.yaml +230 -2
  43. data/sendpost_ruby_sdk.gemspec +2 -2
  44. data/spec/api/suppression_api_spec.rb +88 -0
  45. data/spec/api_client_spec.rb +1 -1
  46. data/spec/configuration_spec.rb +1 -1
  47. data/spec/models/count_stat_spec.rb +34 -0
  48. data/spec/models/delete_response_spec.rb +40 -0
  49. data/spec/models/r_suppression_spec.rb +52 -0
  50. data/spec/models/rd_suppression_spec.rb +34 -0
  51. data/spec/models/suppression_email_spec.rb +34 -0
  52. data/spec/models/suppression_spec.rb +58 -0
  53. data/spec/spec_helper.rb +1 -1
  54. metadata +37 -9
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #SendPost API
3
+
4
+ #Email API and SMTP relay to not just send and measure email sending, but also alert and optimise. We provide you with tools, expertise and support needed to reliably deliver emails to your customers inboxes on time, every time.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hello@sendpost.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendpost
17
+ class SuppressionEmail
18
+ attr_accessor :email
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'email' => :'email'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'email' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::SuppressionEmail` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::SuppressionEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'email')
61
+ self.email = attributes[:'email']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ email == o.email
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [email].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ attributes = attributes.transform_keys(&:to_sym)
106
+ transformed_hash = {}
107
+ openapi_types.each_pair do |key, type|
108
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = nil
110
+ elsif type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
116
+ elsif !attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
+ end
119
+ end
120
+ new(transformed_hash)
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 self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.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
+ # models (e.g. Pet) or oneOf
161
+ klass = Sendpost.const_get(type)
162
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -101,6 +101,7 @@ module Sendpost
101
101
  # Show invalid properties with the reasons. Usually used together with valid?
102
102
  # @return Array for valid properties with the reasons
103
103
  def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
105
  invalid_properties = Array.new
105
106
  invalid_properties
106
107
  end
@@ -108,6 +109,7 @@ module Sendpost
108
109
  # Check to see if the all the properties in the model are valid
109
110
  # @return true if the model is valid
110
111
  def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
113
  true
112
114
  end
113
115
 
@@ -139,37 +141,30 @@ module Sendpost
139
141
  # @param [Hash] attributes Model attributes in the form of hash
140
142
  # @return [Object] Returns the model itself
141
143
  def self.build_from_hash(attributes)
142
- new.build_from_hash(attributes)
143
- end
144
-
145
- # Builds the object from hash
146
- # @param [Hash] attributes Model attributes in the form of hash
147
- # @return [Object] Returns the model itself
148
- def build_from_hash(attributes)
149
144
  return nil unless attributes.is_a?(Hash)
150
145
  attributes = attributes.transform_keys(&:to_sym)
151
- self.class.openapi_types.each_pair do |key, type|
152
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
- self.send("#{key}=", nil)
146
+ transformed_hash = {}
147
+ openapi_types.each_pair do |key, type|
148
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = nil
154
150
  elsif type =~ /\AArray<(.*)>/i
155
151
  # check to ensure the input is an array given that the attribute
156
152
  # is documented as an array but the input is not
157
- if attributes[self.class.attribute_map[key]].is_a?(Array)
158
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
159
155
  end
160
- elsif !attributes[self.class.attribute_map[key]].nil?
161
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
162
158
  end
163
159
  end
164
-
165
- self
160
+ new(transformed_hash)
166
161
  end
167
162
 
168
163
  # Deserializes the data based on type
169
164
  # @param string type Data type
170
165
  # @param string value Value to be deserialized
171
166
  # @return [Object] Deserialized data
172
- def _deserialize(type, value)
167
+ def self._deserialize(type, value)
173
168
  case type.to_sym
174
169
  when :Time
175
170
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -89,6 +89,7 @@ module Sendpost
89
89
  # Show invalid properties with the reasons. Usually used together with valid?
90
90
  # @return Array for valid properties with the reasons
91
91
  def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
93
  invalid_properties = Array.new
93
94
  invalid_properties
94
95
  end
@@ -96,6 +97,7 @@ module Sendpost
96
97
  # Check to see if the all the properties in the model are valid
97
98
  # @return true if the model is valid
98
99
  def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
101
  true
100
102
  end
101
103
 
@@ -126,37 +128,30 @@ module Sendpost
126
128
  # @param [Hash] attributes Model attributes in the form of hash
127
129
  # @return [Object] Returns the model itself
128
130
  def self.build_from_hash(attributes)
129
- new.build_from_hash(attributes)
130
- end
131
-
132
- # Builds the object from hash
133
- # @param [Hash] attributes Model attributes in the form of hash
134
- # @return [Object] Returns the model itself
135
- def build_from_hash(attributes)
136
131
  return nil unless attributes.is_a?(Hash)
137
132
  attributes = attributes.transform_keys(&:to_sym)
138
- self.class.openapi_types.each_pair do |key, type|
139
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
140
- self.send("#{key}=", nil)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
141
137
  elsif type =~ /\AArray<(.*)>/i
142
138
  # check to ensure the input is an array given that the attribute
143
139
  # is documented as an array but the input is not
144
- if attributes[self.class.attribute_map[key]].is_a?(Array)
145
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
146
142
  end
147
- elsif !attributes[self.class.attribute_map[key]].nil?
148
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
149
145
  end
150
146
  end
151
-
152
- self
147
+ new(transformed_hash)
153
148
  end
154
149
 
155
150
  # Deserializes the data based on type
156
151
  # @param string type Data type
157
152
  # @param string value Value to be deserialized
158
153
  # @return [Object] Deserialized data
159
- def _deserialize(type, value)
154
+ def self._deserialize(type, value)
160
155
  case type.to_sym
161
156
  when :Time
162
157
  Time.parse(value)
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -73,6 +73,7 @@ module Sendpost
73
73
  # Show invalid properties with the reasons. Usually used together with valid?
74
74
  # @return Array for valid properties with the reasons
75
75
  def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
76
77
  invalid_properties = Array.new
77
78
  invalid_properties
78
79
  end
@@ -80,6 +81,7 @@ module Sendpost
80
81
  # Check to see if the all the properties in the model are valid
81
82
  # @return true if the model is valid
82
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
85
  true
84
86
  end
85
87
 
@@ -108,37 +110,30 @@ module Sendpost
108
110
  # @param [Hash] attributes Model attributes in the form of hash
109
111
  # @return [Object] Returns the model itself
110
112
  def self.build_from_hash(attributes)
111
- new.build_from_hash(attributes)
112
- end
113
-
114
- # Builds the object from hash
115
- # @param [Hash] attributes Model attributes in the form of hash
116
- # @return [Object] Returns the model itself
117
- def build_from_hash(attributes)
118
113
  return nil unless attributes.is_a?(Hash)
119
114
  attributes = attributes.transform_keys(&:to_sym)
120
- self.class.openapi_types.each_pair do |key, type|
121
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
- self.send("#{key}=", nil)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
123
119
  elsif type =~ /\AArray<(.*)>/i
124
120
  # check to ensure the input is an array given that the attribute
125
121
  # is documented as an array but the input is not
126
- if attributes[self.class.attribute_map[key]].is_a?(Array)
127
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
128
124
  end
129
- elsif !attributes[self.class.attribute_map[key]].nil?
130
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
131
127
  end
132
128
  end
133
-
134
- self
129
+ new(transformed_hash)
135
130
  end
136
131
 
137
132
  # Deserializes the data based on type
138
133
  # @param string type Data type
139
134
  # @param string value Value to be deserialized
140
135
  # @return [Object] Deserialized data
141
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
142
137
  case type.to_sym
143
138
  when :Time
144
139
  Time.parse(value)
@@ -6,10 +6,10 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
13
13
  module Sendpost
14
- VERSION = '1.0.0'
14
+ VERSION = '1.2.2'
15
15
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: hello@sendpost.io
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ OpenAPI Generator version: 7.0.1
10
10
 
11
11
  =end
12
12
 
@@ -20,6 +20,8 @@ require 'sendpost_ruby_sdk/configuration'
20
20
  require 'sendpost_ruby_sdk/models/attachment'
21
21
  require 'sendpost_ruby_sdk/models/city'
22
22
  require 'sendpost_ruby_sdk/models/copy_to'
23
+ require 'sendpost_ruby_sdk/models/count_stat'
24
+ require 'sendpost_ruby_sdk/models/delete_response'
23
25
  require 'sendpost_ruby_sdk/models/device'
24
26
  require 'sendpost_ruby_sdk/models/email_message'
25
27
  require 'sendpost_ruby_sdk/models/email_response'
@@ -28,13 +30,18 @@ require 'sendpost_ruby_sdk/models/from'
28
30
  require 'sendpost_ruby_sdk/models/os'
29
31
  require 'sendpost_ruby_sdk/models/q_email_message'
30
32
  require 'sendpost_ruby_sdk/models/q_event'
33
+ require 'sendpost_ruby_sdk/models/rd_suppression'
34
+ require 'sendpost_ruby_sdk/models/r_suppression'
31
35
  require 'sendpost_ruby_sdk/models/reply_to'
36
+ require 'sendpost_ruby_sdk/models/suppression'
37
+ require 'sendpost_ruby_sdk/models/suppression_email'
32
38
  require 'sendpost_ruby_sdk/models/to'
33
39
  require 'sendpost_ruby_sdk/models/user_agent'
34
40
  require 'sendpost_ruby_sdk/models/webhook_event'
35
41
 
36
42
  # APIs
37
43
  require 'sendpost_ruby_sdk/api/email_api'
44
+ require 'sendpost_ruby_sdk/api/suppression_api'
38
45
 
39
46
  module Sendpost
40
47
  class << self