Class: Rapidmail::Resources::RecipientList

Inherits:
Base
  • Object
show all
Defined in:
lib/rapidmail/resources/recipient_list.rb

Overview

Resource class for managing recipient lists.

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#find, #initialize

Constructor Details

This class inherits a constructor from Rapidmail::Resources::Base

Instance Method Details

#activity(id) ⇒ Faraday::Response

Retrieves the activity stats for a recipient list by ID.

Parameters:

  • id (String)

    The ID of the recipient list.

Returns:

  • (Faraday::Response)

    The response from the API.



42
43
44
# File 'lib/rapidmail/resources/recipient_list.rb', line 42

def activity(id)
  get("#{resource_path}/#{id}/stats/activity")
end

#create(params = {}) ⇒ Faraday::Response

Creates a new recipient list.

Parameters:

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

    The parameters for creating a recipient list.

Returns:

  • (Faraday::Response)

    The response from the API.



17
18
19
# File 'lib/rapidmail/resources/recipient_list.rb', line 17

def create(params = {})
  post(resource_path, params)
end

#destroy(id) ⇒ Faraday::Response

Deletes a recipient list by ID.

Parameters:

  • id (String)

    The ID of the recipient list to delete.

Returns:

  • (Faraday::Response)

    The response from the API.



25
26
27
# File 'lib/rapidmail/resources/recipient_list.rb', line 25

def destroy(id)
  delete("#{resource_path}/#{id}")
end

#list(params = {}) ⇒ Faraday::Response

Lists all recipient lists with optional filters.

Parameters:

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

    Optional filters for listing recipient lists.

Returns:

  • (Faraday::Response)

    The response from the API.



9
10
11
# File 'lib/rapidmail/resources/recipient_list.rb', line 9

def list(params = {})
  get(resource_path, params)
end

#update(id, params = {}) ⇒ Faraday::Response

Updates a recipient list by ID.

Parameters:

  • id (String)

    The ID of the recipient list to update.

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

    The parameters for updating the recipient list.

Returns:

  • (Faraday::Response)

    The response from the API.



34
35
36
# File 'lib/rapidmail/resources/recipient_list.rb', line 34

def update(id, params = {})
  patch("#{resource_path}/#{id}", params)
end