class ActiveCampaignWrapper::Core::ListGateway

Public Class Methods

new(client) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 6
def initialize(client)
  @client = client
  @config = client.config
end

Public Instance Methods

all(**params) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 11
def all(**params)
  @config.get('/lists', query: params)
end
create(params) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 15
def create(params)
  params = { list: params }
  @config.post(
    '/lists',
    body: ActiveCampaignWrapper::Helpers.normalize_body(
      params,
      ActiveCampaignWrapper::Api::List::Arguments::SNAKE_CASED[:create]
    )
  )
end
delete(list_id) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 26
def delete(list_id)
  @config.delete("/lists/#{list_id}")
end
find(list_id) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 41
def find(list_id)
  @config.get("/lists/#{list_id}")
end
update(list_id, params) click to toggle source
# File lib/active_campaign_wrapper/core/list_gateway.rb, line 30
def update(list_id, params)
  params = { list: params }
  @config.put(
    "/lists/#{list_id}",
    body: ActiveCampaignWrapper::Helpers.normalize_body(
      params,
      ActiveCampaignWrapper::Api::List::Arguments::SNAKE_CASED[:create]
    )
  )
end