class MailchimpMarketing::BatchWebhooksApi

Attributes

api_client[RW]

Public Class Methods

new(api_client) click to toggle source
# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 19
def initialize(api_client)
  @api_client = api_client
end

Public Instance Methods

create(body, opts = {}) click to toggle source

Add batch webhook

# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 87
def create(body, opts = {})
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/batch-webhooks'
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
get(batch_webhook_id, opts = {}) click to toggle source

Get batch webhook info

# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 38
def get(batch_webhook_id, opts = {})
  fail ArgumentError, "Missing required param: 'batch_webhook_id'" if batch_webhook_id.nil?

  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  post_body = nil

  local_var_path = '/batch-webhooks/{batch_webhook_id}'.sub('{' + 'batch_webhook_id' + '}', batch_webhook_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
list(opts = {}) click to toggle source

List batch webhooks

# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 54
def list(opts = {})
  fail ArgumentError, 'invalid value for "opts[:"count"]", must be smaller than or equal to 1000.' if !opts[:'count'].nil? && opts[:'count'] > 1000

  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  post_body = nil

  local_var_path = '/batch-webhooks'
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
remove(batch_webhook_id, opts = {}) click to toggle source

Delete batch webhook

# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 24
def remove(batch_webhook_id, opts = {})
  fail ArgumentError, "Missing required param: 'batch_webhook_id'" if batch_webhook_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/batch-webhooks/{batch_webhook_id}'.sub('{' + 'batch_webhook_id' + '}', batch_webhook_id.to_s)
  data = @api_client.call_api(:DELETE, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
update(batch_webhook_id, body, opts = {}) click to toggle source

Update batch webhook

# File lib/MailchimpMarketing/api/batch_webhooks_api.rb, line 72
def update(batch_webhook_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'batch_webhook_id'" if batch_webhook_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/batch-webhooks/{batch_webhook_id}'.sub('{' + 'batch_webhook_id' + '}', batch_webhook_id.to_s)
  data = @api_client.call_api(:PATCH, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end