Class: SimpleSpark::Endpoints::RecipientLists
- Inherits:
-
Object
- Object
- SimpleSpark::Endpoints::RecipientLists
- Defined in:
- lib/simple_spark/endpoints/recipient_lists.rb
Overview
Note:
Provides access to the /recipient-lists endpoint
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(values, num_rcpt_errors = nil) ⇒ Hash
Create a recipient list.
-
#delete(id) ⇒ Object
Delete a recipient list.
-
#initialize(client) ⇒ RecipientLists
constructor
A new instance of RecipientLists.
-
#list ⇒ Array
List all recipient lists.
-
#retrieve(id, show_recipients = false) ⇒ Hash
Retrieve recipient list details.
-
#update(id, values) ⇒ Hash
Update a recipient list.
Constructor Details
#initialize(client) ⇒ RecipientLists
Returns a new instance of RecipientLists.
8 9 10 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 8 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 6 def client @client end |
Instance Method Details
#create(values, num_rcpt_errors = nil) ⇒ Hash
Note:
Create a recipient list
24 25 26 27 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 24 def create(values, num_rcpt_errors = nil) query_params = num_rcpt_errors.nil? ? '' : "?num_rcpt_errors=#{num_rcpt_errors.to_i}" @client.call(method: :post, path: "recipient-lists#{query_params}", body_values: values) end |
#delete(id) ⇒ Object
Note:
Delete a recipient list
51 52 53 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 51 def delete(id) @client.call(method: :delete, path: "recipient-lists/#{id}") end |
#list ⇒ Array
Note:
List all recipient lists
15 16 17 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 15 def list @client.call(method: :get, path: 'recipient-lists') end |
#retrieve(id, show_recipients = false) ⇒ Hash
Note:
Retrieve recipient list details
34 35 36 37 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 34 def retrieve(id, show_recipients = false) params = { show_recipients: show_recipients }.compact @client.call(method: :get, path: "recipient-lists/#{id}", query_values: params) end |
#update(id, values) ⇒ Hash
Note:
Update a recipient list
44 45 46 |
# File 'lib/simple_spark/endpoints/recipient_lists.rb', line 44 def update(id, values) @client.call(method: :put, path: "recipient-lists/#{id}", body_values: values) end |