Class: JustGiving::Account
Instance Method Summary collapse
-
#available? ⇒ Boolean
Confirm if an email is available or not.
-
#change_password(params) ⇒ Object
Update password.
-
#create(params) ⇒ Object
This creates an user account with Just Giving.
-
#initialize(email = nil) ⇒ Account
constructor
A new instance of Account.
-
#pages ⇒ Object
This lists all the fundraising pages for the supplied email.
-
#password_reminder ⇒ Object
Send password reminder.
-
#validate(params) ⇒ Object
This validates a username/password.
Methods included from Request
Constructor Details
#initialize(email = nil) ⇒ Account
Returns a new instance of Account.
3 4 5 |
# File 'lib/just_giving/account.rb', line 3 def initialize(email=nil) @email = email end |
Instance Method Details
#available? ⇒ Boolean
Confirm if an email is available or not
23 24 25 26 27 28 29 30 |
# File 'lib/just_giving/account.rb', line 23 def available? begin head("v1/account/#{@email}") return false rescue JustGiving::NotFound return true end end |
#change_password(params) ⇒ Object
Update password
33 34 35 |
# File 'lib/just_giving/account.rb', line 33 def change_password(params) post('v1/account/changePassword', params) end |
#create(params) ⇒ Object
This creates an user account with Just Giving
13 14 15 |
# File 'lib/just_giving/account.rb', line 13 def create(params) put('v1/account', params) end |
#pages ⇒ Object
This lists all the fundraising pages for the supplied email
8 9 10 |
# File 'lib/just_giving/account.rb', line 8 def pages get("v1/account/#{@email}/pages") end |
#password_reminder ⇒ Object
Send password reminder
38 39 40 41 |
# File 'lib/just_giving/account.rb', line 38 def password_reminder response = get("v1/account/#{@email}/requestpasswordreminder") (response && response[:errors]) ? response : true end |
#validate(params) ⇒ Object
This validates a username/password
18 19 20 |
# File 'lib/just_giving/account.rb', line 18 def validate(params) post('v1/account/validate', params) end |