Class: JustGiving::Account

Inherits:
API
  • Object
show all
Defined in:
lib/just_giving/account.rb

Instance Method Summary collapse

Methods included from Request

#get, #head, #post, #put

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

Returns:

  • (Boolean)


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

#pagesObject

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_reminderObject

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