lib/createsend/administrator.rb in createsend-2.5.1 vs lib/createsend/administrator.rb in createsend-3.0.0
- old
+ new
@@ -1,49 +1,49 @@
-require 'createsend'
-require 'json'
-
module CreateSend
# Represents an administrator and associated functionality.
- class Administrator
+ class Administrator < CreateSend
attr_reader :email_address
- def initialize(email_address)
+ def initialize(auth, email_address)
@email_address = email_address
+ super
end
- # Gets an adminsitrator by email address.
- def self.get(email_address)
+ # Gets an administrator by email address.
+ def self.get(auth, email_address)
options = { :query => { :email => email_address } }
- response = CreateSend.get "/admins.json", options
+ cs = CreateSend.new auth
+ response = cs.cs_get "/admins.json", options
Hashie::Mash.new(response)
end
- # Adds an adminstrator to the account
- def self.add(email_address, name)
+ # Adds an administrator to the account.
+ def self.add(auth, email_address, name)
options = { :body => {
:EmailAddress => email_address,
:Name => name
}.to_json }
- response = CreateSend.post "/admins.json", options
+ cs = CreateSend.new auth
+ response = cs.cs_post "/admins.json", options
Hashie::Mash.new(response)
end
- # Updates the administator details
+ # Updates the administator details.
def update(new_email_address, name)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name
}.to_json }
- CreateSend.put '/admins.json', options
+ put '/admins.json', options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end
- # deletes this administrator from the account
+ # Deletes this administrator from the account.
def delete
options = { :query => { :email => @email_address } }
- CreateSend.delete '/admins.json', options
+ super '/admins.json', options
end
end
end
\ No newline at end of file