Class: BrevoRuby::ExternalFeedsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ExternalFeedsApi

Returns a new instance of ExternalFeedsApi.



19
20
21
# File 'lib/brevo-ruby/api/external_feeds_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/external_feeds_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_external_feed(create_external_feed, opts = {}) ⇒ InlineResponse2014

Create an external feed This endpoint will create an external feed.

Parameters:

  • create_external_feed

    Values to create a feed

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

    the optional parameters

Returns:



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

def create_external_feed(create_external_feed, opts = {})
  data, _status_code, _headers = create_external_feed_with_http_info(create_external_feed, opts)
  data
end

#create_external_feed_with_http_info(create_external_feed, opts = {}) ⇒ Array<(InlineResponse2014, Fixnum, Hash)>

Create an external feed This endpoint will create an external feed.

Parameters:

  • create_external_feed

    Values to create a feed

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

    the optional parameters

Returns:

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

    InlineResponse2014 data, response status code and response headers



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
80
81
82
83
84
85
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 47

def create_external_feed_with_http_info(create_external_feed, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExternalFeedsApi.create_external_feed ...'
  end
  # verify the required parameter 'create_external_feed' is set
  if @api_client.config.client_side_validation && create_external_feed.nil?
    fail ArgumentError, "Missing the required parameter 'create_external_feed' when calling ExternalFeedsApi.create_external_feed"
  end
  # resource path
  local_var_path = '/feeds'

  # 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(create_external_feed)
  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 => 'InlineResponse2014')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExternalFeedsApi#create_external_feed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_external_feed(uuid, opts = {}) ⇒ nil

Delete an external feed This endpoint will delete an external feed.

Parameters:

  • uuid

    UUID of the feed to delete

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

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 91

def delete_external_feed(uuid, opts = {})
  delete_external_feed_with_http_info(uuid, opts)
  nil
end

#delete_external_feed_with_http_info(uuid, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an external feed This endpoint will delete an external feed.

Parameters:

  • uuid

    UUID of the feed to delete

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
131
132
133
134
135
136
137
138
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 101

def delete_external_feed_with_http_info(uuid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExternalFeedsApi.delete_external_feed ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling ExternalFeedsApi.delete_external_feed"
  end
  # resource path
  local_var_path = '/feeds/{uuid}'.sub('{' + 'uuid' + '}', uuid.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: ExternalFeedsApi#delete_external_feed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_external_feeds(opts = {}) ⇒ GetAllExternalFeeds

Fetch all external feeds This endpoint can fetch all created external feeds.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Can be used to filter records by search keyword on feed name

  • :start_date (Date)

    Mandatory if &#x60;endDate&#x60; is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date.

  • :end_date (Date)

    Mandatory if &#x60;startDate&#x60; is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed. (default to desc)

  • :auth_type (String)

    Filter the records by &#x60;authType&#x60; of the feed.

  • :limit (Integer)

    Number of documents returned per page. (default to 50)

  • :offset (Integer)

    Index of the first document on the page. (default to 0)

Returns:



150
151
152
153
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 150

def get_all_external_feeds(opts = {})
  data, _status_code, _headers = get_all_external_feeds_with_http_info(opts)
  data
end

#get_all_external_feeds_with_http_info(opts = {}) ⇒ Array<(GetAllExternalFeeds, Fixnum, Hash)>

Fetch all external feeds This endpoint can fetch all created external feeds.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :search (String)

    Can be used to filter records by search keyword on feed name

  • :start_date (Date)

    Mandatory if &#x60;endDate&#x60; is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older than current date.

  • :end_date (Date)

    Mandatory if &#x60;startDate&#x60; is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed.

  • :auth_type (String)

    Filter the records by &#x60;authType&#x60; of the feed.

  • :limit (Integer)

    Number of documents returned per page.

  • :offset (Integer)

    Index of the first document on the page.

Returns:

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

    GetAllExternalFeeds data, response status code and response headers



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 166

def get_all_external_feeds_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExternalFeedsApi.get_all_external_feeds ...'
  end
  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  if @api_client.config.client_side_validation && opts[:'auth_type'] && !['basic', 'token', 'noAuth'].include?(opts[:'auth_type'])
    fail ArgumentError, 'invalid value for "auth_type", must be one of basic, token, noAuth'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExternalFeedsApi.get_all_external_feeds, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExternalFeedsApi.get_all_external_feeds, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/feeds'

  # query parameters
  query_params = {}
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'authType'] = opts[:'auth_type'] if !opts[:'auth_type'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].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 => 'GetAllExternalFeeds')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExternalFeedsApi#get_all_external_feeds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_external_feed_by_uuid(uuid, opts = {}) ⇒ GetExternalFeedByUUID

Get an external feed by UUID This endpoint will update an external feed.

Parameters:

  • uuid

    UUID of the feed to fetch

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

    the optional parameters

Returns:



227
228
229
230
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 227

def get_external_feed_by_uuid(uuid, opts = {})
  data, _status_code, _headers = get_external_feed_by_uuid_with_http_info(uuid, opts)
  data
end

#get_external_feed_by_uuid_with_http_info(uuid, opts = {}) ⇒ Array<(GetExternalFeedByUUID, Fixnum, Hash)>

Get an external feed by UUID This endpoint will update an external feed.

Parameters:

  • uuid

    UUID of the feed to fetch

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

    the optional parameters

Returns:

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

    GetExternalFeedByUUID data, response status code and response headers



237
238
239
240
241
242
243
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
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 237

def get_external_feed_by_uuid_with_http_info(uuid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExternalFeedsApi.get_external_feed_by_uuid ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling ExternalFeedsApi.get_external_feed_by_uuid"
  end
  # resource path
  local_var_path = '/feeds/{uuid}'.sub('{' + 'uuid' + '}', uuid.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 => 'GetExternalFeedByUUID')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExternalFeedsApi#get_external_feed_by_uuid\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/external_feeds_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_external_feed(uuid, update_external_feed, opts = {}) ⇒ nil

Update an external feed This endpoint will update an external feed.

Parameters:

  • uuid

    UUID of the feed to update

  • update_external_feed

    Values to update a feed

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

    the optional parameters

Returns:

  • (nil)


282
283
284
285
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 282

def update_external_feed(uuid, update_external_feed, opts = {})
  update_external_feed_with_http_info(uuid, update_external_feed, opts)
  nil
end

#update_external_feed_with_http_info(uuid, update_external_feed, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update an external feed This endpoint will update an external feed.

Parameters:

  • uuid

    UUID of the feed to update

  • update_external_feed

    Values to update a feed

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



293
294
295
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
334
# File 'lib/brevo-ruby/api/external_feeds_api.rb', line 293

def update_external_feed_with_http_info(uuid, update_external_feed, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExternalFeedsApi.update_external_feed ...'
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling ExternalFeedsApi.update_external_feed"
  end
  # verify the required parameter 'update_external_feed' is set
  if @api_client.config.client_side_validation && update_external_feed.nil?
    fail ArgumentError, "Missing the required parameter 'update_external_feed' when calling ExternalFeedsApi.update_external_feed"
  end
  # resource path
  local_var_path = '/feeds/{uuid}'.sub('{' + 'uuid' + '}', uuid.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(update_external_feed)
  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: ExternalFeedsApi#update_external_feed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end