Class: EmailDirect::List
- Inherits:
-
Object
- Object
- EmailDirect::List
- Defined in:
- lib/emaildirect/list.rb
Overview
Represents a list and associated functionality
Instance Attribute Summary collapse
-
#list_id ⇒ Object
readonly
Returns the value of attribute list_id.
Class Method Summary collapse
Instance Method Summary collapse
- #add_emails(email_addresses) ⇒ Object
- #delete ⇒ Object
- #details ⇒ Object
-
#initialize(list_id) ⇒ List
constructor
A new instance of List.
- #members ⇒ Object
- #remove_emails(email_addresses) ⇒ Object
- #update(name, options) ⇒ Object
Constructor Details
#initialize(list_id) ⇒ List
Returns a new instance of List.
22 23 24 |
# File 'lib/emaildirect/list.rb', line 22 def initialize(list_id) @list_id = list_id end |
Instance Attribute Details
#list_id ⇒ Object (readonly)
Returns the value of attribute list_id.
20 21 22 |
# File 'lib/emaildirect/list.rb', line 20 def list_id @list_id end |
Class Method Details
.all(options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/emaildirect/list.rb', line 8 def all( = {}) response = EmailDirect.get '/Lists', :query => Hashie::Mash.new(response) end |
.create(name, options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/emaildirect/list.rb', line 13 def create(name, = {}) .merge! :Name => name response = EmailDirect.post '/Lists', :body => .to_json Hashie::Mash.new(response) end |
Instance Method Details
#add_emails(email_addresses) ⇒ Object
47 48 49 50 51 |
# File 'lib/emaildirect/list.rb', line 47 def add_emails(email_addresses) = { :EmailAddresses => Array(email_addresses) } response = post 'AddEmails', :body => .to_json Hashie::Mash.new(response) end |
#delete ⇒ Object
42 43 44 45 |
# File 'lib/emaildirect/list.rb', line 42 def delete response = EmailDirect.delete uri_for, {} Hashie::Mash.new(response) end |
#details ⇒ Object
26 27 28 29 |
# File 'lib/emaildirect/list.rb', line 26 def details response = get Hashie::Mash.new(response) end |
#members ⇒ Object
31 32 33 34 |
# File 'lib/emaildirect/list.rb', line 31 def members response = get 'Members' Hashie::Mash.new(response) end |
#remove_emails(email_addresses) ⇒ Object
53 54 55 56 57 |
# File 'lib/emaildirect/list.rb', line 53 def remove_emails(email_addresses) = { :EmailAddresses => Array(email_addresses) } response = post 'RemoveEmails', :body => .to_json Hashie::Mash.new(response) end |
#update(name, options) ⇒ Object
36 37 38 39 40 |
# File 'lib/emaildirect/list.rb', line 36 def update(name, ) .merge! :Name => name response = EmailDirect.put uri_for, :body => .to_json Hashie::Mash.new(response) end |