Class: JustGiving::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/justgiving_client/client.rb

Overview

The main client, through which you interact with JustGiving

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Create a spangly new client instance

Example:

>> client = JustGiving::Client.new(:api_key => "my_key")
=> #<JustGiving::Client:0x000001009c6f98 @api_key="my_key">


9
10
11
# File 'lib/justgiving_client/client.rb', line 9

def initialize(options)
  @api_key = options[:api_key]
end

Instance Method Details

#donation(id) ⇒ Object

Get a donation by it’s id



19
20
21
22
# File 'lib/justgiving_client/client.rb', line 19

def donation(id)
  response = http.get("/donation/#{id}")
  Donation.new(response)
end

#user(email) ⇒ Object

Get a user by their email



14
15
16
# File 'lib/justgiving_client/client.rb', line 14

def user(email)
  User.new(http, email)
end