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,305 @@
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 'cgi'
14
+
15
+ module Sendpost
16
+ class SuppressionApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Count Total Suppressions
23
+ # @param x_sub_account_api_key [String] Sub-Account API Key
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :from from date
26
+ # @option opts [String] :to to date
27
+ # @return [CountStat]
28
+ def count(x_sub_account_api_key, opts = {})
29
+ data, _status_code, _headers = count_with_http_info(x_sub_account_api_key, opts)
30
+ data
31
+ end
32
+
33
+ # Count Total Suppressions
34
+ # @param x_sub_account_api_key [String] Sub-Account API Key
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [String] :from from date
37
+ # @option opts [String] :to to date
38
+ # @return [Array<(CountStat, Integer, Hash)>] CountStat data, response status code and response headers
39
+ def count_with_http_info(x_sub_account_api_key, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: SuppressionApi.count ...'
42
+ end
43
+ # verify the required parameter 'x_sub_account_api_key' is set
44
+ if @api_client.config.client_side_validation && x_sub_account_api_key.nil?
45
+ fail ArgumentError, "Missing the required parameter 'x_sub_account_api_key' when calling SuppressionApi.count"
46
+ end
47
+ # resource path
48
+ local_var_path = '/subaccount/suppression/count'
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
53
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
59
+ header_params[:'X-SubAccount-ApiKey'] = x_sub_account_api_key
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body]
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'CountStat'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || []
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"SuppressionApi.count",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: SuppressionApi#count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Add Email Addresses To Suppression List
91
+ # @param x_sub_account_api_key [String] Sub-Account API Key
92
+ # @param [Hash] opts the optional parameters
93
+ # @option opts [RSuppression] :r_suppression Suppression content
94
+ # @return [Array<Suppression>]
95
+ def create_suppressions(x_sub_account_api_key, opts = {})
96
+ data, _status_code, _headers = create_suppressions_with_http_info(x_sub_account_api_key, opts)
97
+ data
98
+ end
99
+
100
+ # Add Email Addresses To Suppression List
101
+ # @param x_sub_account_api_key [String] Sub-Account API Key
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [RSuppression] :r_suppression Suppression content
104
+ # @return [Array<(Array<Suppression>, Integer, Hash)>] Array<Suppression> data, response status code and response headers
105
+ def create_suppressions_with_http_info(x_sub_account_api_key, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: SuppressionApi.create_suppressions ...'
108
+ end
109
+ # verify the required parameter 'x_sub_account_api_key' is set
110
+ if @api_client.config.client_side_validation && x_sub_account_api_key.nil?
111
+ fail ArgumentError, "Missing the required parameter 'x_sub_account_api_key' when calling SuppressionApi.create_suppressions"
112
+ end
113
+ # resource path
114
+ local_var_path = '/subaccount/suppression/'
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
123
+ # HTTP header 'Content-Type'
124
+ content_type = @api_client.select_header_content_type(['application/json'])
125
+ if !content_type.nil?
126
+ header_params['Content-Type'] = content_type
127
+ end
128
+ header_params[:'X-SubAccount-ApiKey'] = x_sub_account_api_key
129
+
130
+ # form parameters
131
+ form_params = opts[:form_params] || {}
132
+
133
+ # http body (model)
134
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'r_suppression'])
135
+
136
+ # return_type
137
+ return_type = opts[:debug_return_type] || 'Array<Suppression>'
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || []
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"SuppressionApi.create_suppressions",
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => return_type
150
+ )
151
+
152
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: SuppressionApi#create_suppressions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Delete specific emails which are in suppression list
160
+ # @param x_sub_account_api_key [String] Sub-Account API Key
161
+ # @param [Hash] opts the optional parameters
162
+ # @option opts [RDSuppression] :rd_suppression Suppression content
163
+ # @return [Array<DeleteResponse>]
164
+ def delete_suppression(x_sub_account_api_key, opts = {})
165
+ data, _status_code, _headers = delete_suppression_with_http_info(x_sub_account_api_key, opts)
166
+ data
167
+ end
168
+
169
+ # Delete specific emails which are in suppression list
170
+ # @param x_sub_account_api_key [String] Sub-Account API Key
171
+ # @param [Hash] opts the optional parameters
172
+ # @option opts [RDSuppression] :rd_suppression Suppression content
173
+ # @return [Array<(Array<DeleteResponse>, Integer, Hash)>] Array<DeleteResponse> data, response status code and response headers
174
+ def delete_suppression_with_http_info(x_sub_account_api_key, opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: SuppressionApi.delete_suppression ...'
177
+ end
178
+ # verify the required parameter 'x_sub_account_api_key' is set
179
+ if @api_client.config.client_side_validation && x_sub_account_api_key.nil?
180
+ fail ArgumentError, "Missing the required parameter 'x_sub_account_api_key' when calling SuppressionApi.delete_suppression"
181
+ end
182
+ # resource path
183
+ local_var_path = '/subaccount/suppression/'
184
+
185
+ # query parameters
186
+ query_params = opts[:query_params] || {}
187
+
188
+ # header parameters
189
+ header_params = opts[:header_params] || {}
190
+ # HTTP header 'Accept' (if needed)
191
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
192
+ # HTTP header 'Content-Type'
193
+ content_type = @api_client.select_header_content_type(['application/json'])
194
+ if !content_type.nil?
195
+ header_params['Content-Type'] = content_type
196
+ end
197
+ header_params[:'X-SubAccount-ApiKey'] = x_sub_account_api_key
198
+
199
+ # form parameters
200
+ form_params = opts[:form_params] || {}
201
+
202
+ # http body (model)
203
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'rd_suppression'])
204
+
205
+ # return_type
206
+ return_type = opts[:debug_return_type] || 'Array<DeleteResponse>'
207
+
208
+ # auth_names
209
+ auth_names = opts[:debug_auth_names] || []
210
+
211
+ new_options = opts.merge(
212
+ :operation => :"SuppressionApi.delete_suppression",
213
+ :header_params => header_params,
214
+ :query_params => query_params,
215
+ :form_params => form_params,
216
+ :body => post_body,
217
+ :auth_names => auth_names,
218
+ :return_type => return_type
219
+ )
220
+
221
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug "API called: SuppressionApi#delete_suppression\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
224
+ end
225
+ return data, status_code, headers
226
+ end
227
+
228
+ # Get all suppressions
229
+ # @param x_sub_account_api_key [String] Sub-Account API Key
230
+ # @param [Hash] opts the optional parameters
231
+ # @option opts [Integer] :offset offset
232
+ # @option opts [Integer] :limit limit
233
+ # @option opts [String] :search search
234
+ # @option opts [String] :from from date
235
+ # @option opts [String] :to to date
236
+ # @return [Array<Suppression>]
237
+ def get_suppressions(x_sub_account_api_key, opts = {})
238
+ data, _status_code, _headers = get_suppressions_with_http_info(x_sub_account_api_key, opts)
239
+ data
240
+ end
241
+
242
+ # Get all suppressions
243
+ # @param x_sub_account_api_key [String] Sub-Account API Key
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [Integer] :offset offset
246
+ # @option opts [Integer] :limit limit
247
+ # @option opts [String] :search search
248
+ # @option opts [String] :from from date
249
+ # @option opts [String] :to to date
250
+ # @return [Array<(Array<Suppression>, Integer, Hash)>] Array<Suppression> data, response status code and response headers
251
+ def get_suppressions_with_http_info(x_sub_account_api_key, opts = {})
252
+ if @api_client.config.debugging
253
+ @api_client.config.logger.debug 'Calling API: SuppressionApi.get_suppressions ...'
254
+ end
255
+ # verify the required parameter 'x_sub_account_api_key' is set
256
+ if @api_client.config.client_side_validation && x_sub_account_api_key.nil?
257
+ fail ArgumentError, "Missing the required parameter 'x_sub_account_api_key' when calling SuppressionApi.get_suppressions"
258
+ end
259
+ # resource path
260
+ local_var_path = '/subaccount/suppression/'
261
+
262
+ # query parameters
263
+ query_params = opts[:query_params] || {}
264
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
265
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
266
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
267
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
268
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
269
+
270
+ # header parameters
271
+ header_params = opts[:header_params] || {}
272
+ # HTTP header 'Accept' (if needed)
273
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
274
+ header_params[:'X-SubAccount-ApiKey'] = x_sub_account_api_key
275
+
276
+ # form parameters
277
+ form_params = opts[:form_params] || {}
278
+
279
+ # http body (model)
280
+ post_body = opts[:debug_body]
281
+
282
+ # return_type
283
+ return_type = opts[:debug_return_type] || 'Array<Suppression>'
284
+
285
+ # auth_names
286
+ auth_names = opts[:debug_auth_names] || []
287
+
288
+ new_options = opts.merge(
289
+ :operation => :"SuppressionApi.get_suppressions",
290
+ :header_params => header_params,
291
+ :query_params => query_params,
292
+ :form_params => form_params,
293
+ :body => post_body,
294
+ :auth_names => auth_names,
295
+ :return_type => return_type
296
+ )
297
+
298
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "API called: SuppressionApi#get_suppressions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
301
+ end
302
+ return data, status_code, headers
303
+ end
304
+ end
305
+ 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
 
@@ -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
 
@@ -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
 
@@ -152,7 +152,7 @@ module Sendpost
152
152
  @scheme = 'https'
153
153
  @host = 'api.sendpost.io'
154
154
  @base_path = '/api/v1'
155
- @server_index = 0
155
+ @server_index = nil
156
156
  @server_operation_index = {}
157
157
  @server_variables = {}
158
158
  @server_operation_variables = {}
@@ -200,10 +200,12 @@ module Sendpost
200
200
 
201
201
  # Returns base URL for specified operation based on server settings
202
202
  def base_url(operation = nil)
203
- index = server_operation_index[operation]
204
- return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
205
-
206
- server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
203
+ if operation_server_settings.key?(operation) then
204
+ index = server_operation_index.fetch(operation, server_index)
205
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
206
+ else
207
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
208
+ end
207
209
  end
208
210
 
209
211
  # Gets API key (with prefix if set).
@@ -220,8 +222,8 @@ module Sendpost
220
222
 
221
223
  # Gets access_token using access_token_getter or uses the static access_token
222
224
  def access_token_with_refresh
223
- return access_token if access_token_getter.nil?
224
- access_token_getter.call
225
+ return access_token if access_token_getter.nil?
226
+ access_token_getter.call
225
227
  end
226
228
 
227
229
  # Gets Basic Auth token string
@@ -258,8 +260,8 @@ module Sendpost
258
260
  servers = server_settings if servers == nil
259
261
 
260
262
  # check array index out of bound
261
- if (index < 0 || index >= servers.size)
262
- fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
263
+ if (index.nil? || index < 0 || index >= servers.size)
264
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
263
265
  end
264
266
 
265
267
  server = servers[index]
@@ -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,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
 
@@ -97,6 +97,7 @@ module Sendpost
97
97
  # Show invalid properties with the reasons. Usually used together with valid?
98
98
  # @return Array for valid properties with the reasons
99
99
  def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
101
  invalid_properties = Array.new
101
102
  invalid_properties
102
103
  end
@@ -104,6 +105,7 @@ module Sendpost
104
105
  # Check to see if the all the properties in the model are valid
105
106
  # @return true if the model is valid
106
107
  def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
109
  true
108
110
  end
109
111
 
@@ -135,37 +137,30 @@ module Sendpost
135
137
  # @param [Hash] attributes Model attributes in the form of hash
136
138
  # @return [Object] Returns the model itself
137
139
  def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
140
  return nil unless attributes.is_a?(Hash)
146
141
  attributes = attributes.transform_keys(&:to_sym)
147
- self.class.openapi_types.each_pair do |key, type|
148
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
- self.send("#{key}=", nil)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
150
146
  elsif type =~ /\AArray<(.*)>/i
151
147
  # check to ensure the input is an array given that the attribute
152
148
  # is documented as an array but the input is not
153
- if attributes[self.class.attribute_map[key]].is_a?(Array)
154
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
151
  end
156
- elsif !attributes[self.class.attribute_map[key]].nil?
157
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
154
  end
159
155
  end
160
-
161
- self
156
+ new(transformed_hash)
162
157
  end
163
158
 
164
159
  # Deserializes the data based on type
165
160
  # @param string type Data type
166
161
  # @param string value Value to be deserialized
167
162
  # @return [Object] Deserialized data
168
- def _deserialize(type, value)
163
+ def self._deserialize(type, value)
169
164
  case type.to_sym
170
165
  when :Time
171
166
  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
 
@@ -81,6 +81,7 @@ module Sendpost
81
81
  # Show invalid properties with the reasons. Usually used together with valid?
82
82
  # @return Array for valid properties with the reasons
83
83
  def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
85
  invalid_properties = Array.new
85
86
  invalid_properties
86
87
  end
@@ -88,6 +89,7 @@ module Sendpost
88
89
  # Check to see if the all the properties in the model are valid
89
90
  # @return true if the model is valid
90
91
  def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
93
  true
92
94
  end
93
95
 
@@ -117,37 +119,30 @@ module Sendpost
117
119
  # @param [Hash] attributes Model attributes in the form of hash
118
120
  # @return [Object] Returns the model itself
119
121
  def self.build_from_hash(attributes)
120
- new.build_from_hash(attributes)
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 build_from_hash(attributes)
127
122
  return nil unless attributes.is_a?(Hash)
128
123
  attributes = attributes.transform_keys(&:to_sym)
129
- self.class.openapi_types.each_pair do |key, type|
130
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
- self.send("#{key}=", nil)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
132
128
  elsif type =~ /\AArray<(.*)>/i
133
129
  # check to ensure the input is an array given that the attribute
134
130
  # is documented as an array but the input is not
135
- if attributes[self.class.attribute_map[key]].is_a?(Array)
136
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
137
133
  end
138
- elsif !attributes[self.class.attribute_map[key]].nil?
139
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
140
136
  end
141
137
  end
142
-
143
- self
138
+ new(transformed_hash)
144
139
  end
145
140
 
146
141
  # Deserializes the data based on type
147
142
  # @param string type Data type
148
143
  # @param string value Value to be deserialized
149
144
  # @return [Object] Deserialized data
150
- def _deserialize(type, value)
145
+ def self._deserialize(type, value)
151
146
  case type.to_sym
152
147
  when :Time
153
148
  Time.parse(value)