Class: CreateSend::Administrator
- Inherits:
-
Object
- Object
- CreateSend::Administrator
- Defined in:
- lib/createsend/administrator.rb
Overview
Represents an administrator and associated functionality.
Instance Attribute Summary collapse
-
#email_address ⇒ Object
readonly
Returns the value of attribute email_address.
Class Method Summary collapse
-
.add(email_address, name) ⇒ Object
Adds an adminstrator to the account.
-
.get(email_address) ⇒ Object
Gets an adminsitrator by email address.
Instance Method Summary collapse
-
#delete ⇒ Object
deletes this administrator from the account.
-
#initialize(email_address) ⇒ Administrator
constructor
A new instance of Administrator.
-
#update(new_email_address, name) ⇒ Object
Updates the administator details.
Constructor Details
#initialize(email_address) ⇒ Administrator
Returns a new instance of Administrator.
9 10 11 |
# File 'lib/createsend/administrator.rb', line 9 def initialize(email_address) @email_address = email_address end |
Instance Attribute Details
#email_address ⇒ Object (readonly)
Returns the value of attribute email_address.
7 8 9 |
# File 'lib/createsend/administrator.rb', line 7 def email_address @email_address end |
Class Method Details
.add(email_address, name) ⇒ Object
Adds an adminstrator to the account
21 22 23 24 25 26 27 28 |
# File 'lib/createsend/administrator.rb', line 21 def self.add(email_address, name) = { :body => { :EmailAddress => email_address, :Name => name }.to_json } response = CreateSend.post "/admins.json", Hashie::Mash.new(response) end |
.get(email_address) ⇒ Object
Gets an adminsitrator by email address.
14 15 16 17 18 |
# File 'lib/createsend/administrator.rb', line 14 def self.get(email_address) = { :query => { :email => email_address } } response = CreateSend.get "/admins.json", Hashie::Mash.new(response) end |
Instance Method Details
#delete ⇒ Object
deletes this administrator from the account
44 45 46 47 |
# File 'lib/createsend/administrator.rb', line 44 def delete = { :query => { :email => @email_address } } CreateSend.delete '/admins.json', end |
#update(new_email_address, name) ⇒ Object
Updates the administator details
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/createsend/administrator.rb', line 31 def update(new_email_address, name) = { :query => { :email => @email_address }, :body => { :EmailAddress => new_email_address, :Name => name }.to_json } CreateSend.put '/admins.json', # Update @email_address, so this object can continue to be used reliably @email_address = new_email_address end |