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