justgiving 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/justgiving.gemspec +0 -1
- data/lib/justgiving/client.rb +15 -21
- data/lib/justgiving/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1e658fde7ceee06bfcd7837ef2022e6210282eb
|
4
|
+
data.tar.gz: 2761b08ee6c72220dae4c3f7f8fdd27d560f965c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f798d5e1262583236541a973db3c45d5f445ca506b1a62919a440ca9bd8bed707cc650f5654ebc5276e07225d7446b09942e9b2567ccbc7a97e78efff1b827d4
|
7
|
+
data.tar.gz: 3caa69636a91847acf09d701511b697661f62f8f4d27f7a925e7d19a87bc231f0a1748a1bd7487663a34b498e6ac576e2f67f91db9ec2c7a658bb9483c727302
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Create a new API client instance, passing your api key to the new method. For ex
|
|
28
28
|
|
29
29
|
Available clients are: Charity, Country, Currency, Donation, Search. You can then call methods on your client, for example
|
30
30
|
|
31
|
-
client.
|
31
|
+
client.search_charities({q: 'Macmillan'})
|
32
32
|
|
33
33
|
To view the available methods for each client, browse the /lib/justgiving directory.
|
34
34
|
|
data/justgiving.gemspec
CHANGED
data/lib/justgiving/client.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "faraday"
|
2
2
|
require "faraday_middleware"
|
3
|
-
require "addressable/uri"
|
4
3
|
require_relative "error"
|
5
4
|
|
6
5
|
module JustGiving
|
@@ -10,34 +9,29 @@ module JustGiving
|
|
10
9
|
@token = token
|
11
10
|
@base_url = "https://api.justgiving.com/#{@token}/v1/"
|
12
11
|
@connection_defaults = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
12
|
+
url: @base_url,
|
13
|
+
headers: {
|
14
|
+
'User-Agent' => 'Ruby REST client',
|
15
|
+
'Content-Type' => 'application/json'
|
18
16
|
}
|
17
|
+
}
|
18
|
+
@connection = Faraday.new(@connection_defaults) do |connection|
|
19
|
+
connection.response :json, :content_type => /\bjson$/
|
20
|
+
connection.response :logger
|
21
|
+
connection.adapter Faraday.default_adapter
|
22
|
+
connection.use Error::RaiseError
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
protected
|
22
27
|
|
23
|
-
def get(path,
|
24
|
-
@connection
|
25
|
-
|
26
|
-
|
27
|
-
connection.adapter Faraday.default_adapter
|
28
|
-
connection.use Error::RaiseError
|
28
|
+
def get(path, query=nil)
|
29
|
+
response = @connection.get do |request|
|
30
|
+
request.url path
|
31
|
+
request.params.merge! query if query
|
29
32
|
end
|
30
|
-
|
31
|
-
path += '?' + query_string_from_hash(query_hash) if query_hash
|
32
|
-
response = @connection.get path
|
33
33
|
response.body
|
34
34
|
end
|
35
35
|
|
36
|
-
def query_string_from_hash(query_hash)
|
37
|
-
uri = Addressable::URI.new
|
38
|
-
uri.query_values = query_hash
|
39
|
-
uri.query
|
40
|
-
end
|
41
|
-
|
42
36
|
end
|
43
37
|
end
|
data/lib/justgiving/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justgiving
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Dent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.9'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: addressable
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.3'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.3'
|
83
69
|
description:
|
84
70
|
email:
|
85
71
|
- jack@jackdent.co.uk
|