Class: Chimpactions::List
- Inherits:
-
Object
- Object
- Chimpactions::List
- Includes:
- Utility
- Defined in:
- lib/chimpactions/list.rb
Overview
The List class does all kinds of things with your MailChimp lists.
Defined Under Namespace
Classes: Stats
Constant Summary collapse
- @@socket =
The system-wide single socket to the MailChimp mothership.
Chimpactions.socket
Instance Attribute Summary collapse
- #stats ⇒ List::Stats readonly
Class Method Summary collapse
-
.new_socket ⇒ Object
Receiver for Observer pattern.
Instance Method Summary collapse
-
#data ⇒ Hash
The raw list data.
-
#initialize(raw) ⇒ List
constructor
Create a new List object.
-
#merge_vars ⇒ Object
The available merge varaibles for the List.
-
#remove_webhook(opts) ⇒ true, Hash
removes the specified url webhook for this List.
-
#set_webhook(opts) ⇒ true, Hash
Sets a webhook for this List.
-
#webhook? ⇒ boolean
Checks if there are ANY webhooks for this list.
-
#webhooks ⇒ Hash, false
Retrieves webhooks for this List.
Methods included from Utility
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Chimpactions::Utility
Instance Attribute Details
#stats ⇒ List::Stats (readonly)
17 18 19 |
# File 'lib/chimpactions/list.rb', line 17 def stats @stats end |
Class Method Details
.new_socket ⇒ Object
Receiver for Observer pattern. Sets the class level socket to the current Chimpactions module socket.
12 13 14 |
# File 'lib/chimpactions/list.rb', line 12 def self.new_socket @@socket = Chimpactions.socket end |
Instance Method Details
#data ⇒ Hash
The raw list data.
29 30 31 |
# File 'lib/chimpactions/list.rb', line 29 def data @raw end |
#merge_vars ⇒ Object
The available merge varaibles for the List.
65 66 67 |
# File 'lib/chimpactions/list.rb', line 65 def merge_vars @merge_vars ||= @@socket.listMergeVars(:id => id) end |
#remove_webhook(opts) ⇒ true, Hash
removes the specified url webhook for this List
91 92 93 |
# File 'lib/chimpactions/list.rb', line 91 def remove_webhook(opts) @@socket.listWebhookDel({:id => id}.merge(opts) ) == "true" end |
#set_webhook(opts) ⇒ true, Hash
Sets a webhook for this List
84 85 86 |
# File 'lib/chimpactions/list.rb', line 84 def set_webhook(opts) @@socket.listWebhookAdd({:id => id}.merge(opts) ) == "true" end |
#webhook? ⇒ boolean
Checks if there are ANY webhooks for this list
71 72 73 |
# File 'lib/chimpactions/list.rb', line 71 def webhook? @@socket.listWebhooks(:id => id).empty? ? false : true end |
#webhooks ⇒ Hash, false
Retrieves webhooks for this List
77 78 79 |
# File 'lib/chimpactions/list.rb', line 77 def webhooks @@socket.listWebhooks(:id => id) end |