Class: BrevoRuby::SendersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo-ruby/api/senders_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SendersApi

Returns a new instance of SendersApi.



19
20
21
# File 'lib/brevo-ruby/api/senders_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/brevo-ruby/api/senders_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_sender(opts = {}) ⇒ CreateSenderModel

Create a new sender

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



36
37
38
39
# File 'lib/brevo-ruby/api/senders_api.rb', line 36

def create_sender(opts = {})
  data, _status_code, _headers = create_sender_with_http_info(opts)
  data
end

#create_sender_with_http_info(opts = {}) ⇒ Array<(CreateSenderModel, Fixnum, Hash)>

Create a new sender

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(CreateSenderModel, Fixnum, Hash)>)

    CreateSenderModel data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/brevo-ruby/api/senders_api.rb', line 45

def create_sender_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.create_sender ...'
  end
  # resource path
  local_var_path = '/senders'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'sender'])
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateSenderModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#create_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_sender(sender_id, opts = {}) ⇒ nil

Delete a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


84
85
86
87
# File 'lib/brevo-ruby/api/senders_api.rb', line 84

def delete_sender(sender_id, opts = {})
  delete_sender_with_http_info(sender_id, opts)
  nil
end

#delete_sender_with_http_info(sender_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/brevo-ruby/api/senders_api.rb', line 93

def delete_sender_with_http_info(sender_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.delete_sender ...'
  end
  # verify the required parameter 'sender_id' is set
  if @api_client.config.client_side_validation && sender_id.nil?
    fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.delete_sender"
  end
  # resource path
  local_var_path = '/senders/{senderId}'.sub('{' + 'senderId' + '}', sender_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#delete_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ips(opts = {}) ⇒ GetIps

Get all the dedicated IPs for your account

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



134
135
136
137
# File 'lib/brevo-ruby/api/senders_api.rb', line 134

def get_ips(opts = {})
  data, _status_code, _headers = get_ips_with_http_info(opts)
  data
end

#get_ips_from_sender(sender_id, opts = {}) ⇒ GetIpsFromSender

Get all the dedicated IPs for a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



181
182
183
184
# File 'lib/brevo-ruby/api/senders_api.rb', line 181

def get_ips_from_sender(sender_id, opts = {})
  data, _status_code, _headers = get_ips_from_sender_with_http_info(sender_id, opts)
  data
end

#get_ips_from_sender_with_http_info(sender_id, opts = {}) ⇒ Array<(GetIpsFromSender, Fixnum, Hash)>

Get all the dedicated IPs for a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetIpsFromSender, Fixnum, Hash)>)

    GetIpsFromSender data, response status code and response headers



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/brevo-ruby/api/senders_api.rb', line 190

def get_ips_from_sender_with_http_info(sender_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.get_ips_from_sender ...'
  end
  # verify the required parameter 'sender_id' is set
  if @api_client.config.client_side_validation && sender_id.nil?
    fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.get_ips_from_sender"
  end
  # resource path
  local_var_path = '/senders/{senderId}/ips'.sub('{' + 'senderId' + '}', sender_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetIpsFromSender')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#get_ips_from_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ips_with_http_info(opts = {}) ⇒ Array<(GetIps, Fixnum, Hash)>

Get all the dedicated IPs for your account

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetIps, Fixnum, Hash)>)

    GetIps data, response status code and response headers



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/brevo-ruby/api/senders_api.rb', line 142

def get_ips_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.get_ips ...'
  end
  # resource path
  local_var_path = '/senders/ips'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetIps')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#get_ips\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_senders(opts = {}) ⇒ GetSendersList

Get the list of all your senders

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ip (String)

    Filter your senders for a specific ip (available for dedicated IP usage only)

  • :domain (String)

    Filter your senders for a specific domain

Returns:



234
235
236
237
# File 'lib/brevo-ruby/api/senders_api.rb', line 234

def get_senders(opts = {})
  data, _status_code, _headers = get_senders_with_http_info(opts)
  data
end

#get_senders_with_http_info(opts = {}) ⇒ Array<(GetSendersList, Fixnum, Hash)>

Get the list of all your senders

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ip (String)

    Filter your senders for a specific ip (available for dedicated IP usage only)

  • :domain (String)

    Filter your senders for a specific domain

Returns:

  • (Array<(GetSendersList, Fixnum, Hash)>)

    GetSendersList data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/brevo-ruby/api/senders_api.rb', line 244

def get_senders_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.get_senders ...'
  end
  # resource path
  local_var_path = '/senders'

  # query parameters
  query_params = {}
  query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
  query_params[:'domain'] = opts[:'domain'] if !opts[:'domain'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetSendersList')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#get_senders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#setUserAgent(user_agent) ⇒ Object

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby



25
26
27
28
29
30
# File 'lib/brevo-ruby/api/senders_api.rb', line 25

def setUserAgent(user_agent)
  @user_agent = user_agent
  if user_agent.is_a?(String) && user_agent.downcase.start_with?('brevo_')
    @api_client.default_headers['User-Agent'] = @user_agent
  end
end

#update_sender(sender_id, opts = {}) ⇒ nil

Update a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (nil)


286
287
288
289
# File 'lib/brevo-ruby/api/senders_api.rb', line 286

def update_sender(sender_id, opts = {})
  update_sender_with_http_info(sender_id, opts)
  nil
end

#update_sender_with_http_info(sender_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/brevo-ruby/api/senders_api.rb', line 296

def update_sender_with_http_info(sender_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.update_sender ...'
  end
  # verify the required parameter 'sender_id' is set
  if @api_client.config.client_side_validation && sender_id.nil?
    fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.update_sender"
  end
  # resource path
  local_var_path = '/senders/{senderId}'.sub('{' + 'senderId' + '}', sender_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'sender'])
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#update_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#validate_sender_by_otp(sender_id, opts = {}) ⇒ nil

Update a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :otp (Otp)

    otp

Returns:

  • (nil)


339
340
341
342
# File 'lib/brevo-ruby/api/senders_api.rb', line 339

def validate_sender_by_otp(sender_id, opts = {})
  validate_sender_by_otp_with_http_info(sender_id, opts)
  nil
end

#validate_sender_by_otp_with_http_info(sender_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a sender

Parameters:

  • sender_id

    Id of the sender

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :otp (Otp)

    otp

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/brevo-ruby/api/senders_api.rb', line 349

def validate_sender_by_otp_with_http_info(sender_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendersApi.validate_sender_by_otp ...'
  end
  # verify the required parameter 'sender_id' is set
  if @api_client.config.client_side_validation && sender_id.nil?
    fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.validate_sender_by_otp"
  end
  # resource path
  local_var_path = '/senders/{senderId}/validate'.sub('{' + 'senderId' + '}', sender_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'otp'])
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SendersApi#validate_sender_by_otp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end