Class: CreateSend::Administrator
- Inherits:
-
CreateSend
- Object
- CreateSend
- 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.
Attributes inherited from CreateSend
Class Method Summary collapse
-
.add(auth, email_address, name) ⇒ Object
Adds an administrator to the account.
-
.get(auth, email_address) ⇒ Object
Gets an administrator by email address.
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes this administrator from the account.
-
#initialize(auth, email_address) ⇒ Administrator
constructor
A new instance of Administrator.
-
#update(new_email_address, name) ⇒ Object
Updates the administator details.
Methods inherited from CreateSend
#add_auth_details_to_options, #administrators, #auth, authorize_url, #billing_details, #clients, #countries, exchange_token, #external_session_url, #get, #get_primary_contact, #handle_response, #post, #put, refresh_access_token, #refresh_token, #set_primary_contact, #systemdate, #timezones, user_agent
Constructor Details
#initialize(auth, email_address) ⇒ Administrator
Returns a new instance of Administrator.
6 7 8 9 |
# File 'lib/createsend/administrator.rb', line 6 def initialize(auth, email_address) @email_address = email_address super end |
Instance Attribute Details
#email_address ⇒ Object (readonly)
Returns the value of attribute email_address.
4 5 6 |
# File 'lib/createsend/administrator.rb', line 4 def email_address @email_address end |
Class Method Details
.add(auth, email_address, name) ⇒ Object
Adds an administrator to the account.
20 21 22 23 24 25 26 27 28 |
# File 'lib/createsend/administrator.rb', line 20 def self.add(auth, email_address, name) = { :body => { :EmailAddress => email_address, :Name => name }.to_json } cs = CreateSend.new auth response = cs.cs_post "/admins.json", Hashie::Mash.new(response) end |
.get(auth, email_address) ⇒ Object
Gets an administrator by email address.
12 13 14 15 16 17 |
# File 'lib/createsend/administrator.rb', line 12 def self.get(auth, email_address) = { :query => { :email => email_address } } cs = CreateSend.new auth response = cs.cs_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 } } super '/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 } put '/admins.json', # Update @email_address, so this object can continue to be used reliably @email_address = new_email_address end |