justgiving 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/justgiving.gemspec +26 -0
- data/lib/justgiving/charity.rb +23 -0
- data/lib/justgiving/client.rb +32 -0
- data/lib/justgiving/country.rb +11 -0
- data/lib/justgiving/currency.rb +11 -0
- data/lib/justgiving/donation.rb +15 -0
- data/lib/justgiving/search.rb +27 -0
- data/lib/justgiving/version.rb +3 -0
- data/lib/justgiving.rb +9 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 330ff0c02a601ad892f6f09d5bc2c210d3fff526
|
4
|
+
data.tar.gz: 90d0cfee0ffba46683b449c4585afa1d86d38f96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f641934cea354d787e5803bb3d78b3dec139e03b736d2691ee4114c361943f2fedde24d7e10e2fa0cce9b8b4f8d4f0335fdd7fd1a474011d544ca719b67a094b
|
7
|
+
data.tar.gz: c63d6a4032ec7885b6de07689556f2b1e529294fb45a56f49ccca7741fcb2b7b6344dc41e66458c3db5e3b4e7f966de3b315ddb3a1213c888bf17f88b9d0933e
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.DS_Store
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jack Dent
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# JustGiving
|
2
|
+
|
3
|
+
A Ruby REST client for the JustGiving API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'justgiving'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install justgiving
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Require the justgiving gem
|
22
|
+
|
23
|
+
require 'justgiving'
|
24
|
+
|
25
|
+
Create a new API client instance, passing your api key to the new method. For example,
|
26
|
+
|
27
|
+
client = JustGiving::Search.new({YOUR_API_KEY})
|
28
|
+
|
29
|
+
Available clients are: Charity, Country, Currency, Donation, Search. You can then call methods on your client, for example
|
30
|
+
|
31
|
+
client.searchCharities({q: 'Macmillan'})
|
32
|
+
|
33
|
+
To view the available methods for each client, browse the /lib/justgiving directory.
|
34
|
+
|
35
|
+
Create a new client
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/jackdent/justgiving/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/justgiving.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'justgiving/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "justgiving"
|
8
|
+
spec.version = JustGiving::VERSION
|
9
|
+
spec.authors = ["Jack Dent"]
|
10
|
+
spec.email = ["jack@jackdent.co.uk"]
|
11
|
+
spec.summary = %q{A Ruby REST client for the JustGiving API}
|
12
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
13
|
+
spec.homepage = "http://www.github.com/jackdent/justgiving"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "curb"
|
24
|
+
spec.add_development_dependency "json"
|
25
|
+
spec.add_development_dependency "addressable"
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "client"
|
2
|
+
|
3
|
+
module JustGiving
|
4
|
+
class Charity < Client
|
5
|
+
|
6
|
+
def getByCharityId(id)
|
7
|
+
get("charity/#{id}")
|
8
|
+
end
|
9
|
+
|
10
|
+
def getEventsByCharityId(id)
|
11
|
+
get("charity/#{id}/events")
|
12
|
+
end
|
13
|
+
|
14
|
+
def getDonationsByCharityId(id)
|
15
|
+
get("charity/#{id}/donations")
|
16
|
+
end
|
17
|
+
|
18
|
+
def getCharityCategories
|
19
|
+
get("charity/categories")
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'curb'
|
3
|
+
require "addressable/uri"
|
4
|
+
|
5
|
+
module JustGiving
|
6
|
+
class Client
|
7
|
+
|
8
|
+
def initialize(token)
|
9
|
+
@token = token
|
10
|
+
@base_url = "https://api.justgiving.com/#{@token}/v1"
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def get(path, query_hash=nil)
|
16
|
+
url = "#{@base_url}/#{path}"
|
17
|
+
url += '?' + query_string_from_hash(query_hash) if query_hash
|
18
|
+
request = Curl.get(url) do |curl|
|
19
|
+
curl.headers["User-Agent"] = "Ruby REST client"
|
20
|
+
curl.headers["Content-Type"] = "application/json"
|
21
|
+
end
|
22
|
+
JSON.parse request.body_str
|
23
|
+
end
|
24
|
+
|
25
|
+
def query_string_from_hash(query_hash)
|
26
|
+
uri = Addressable::URI.new
|
27
|
+
uri.query_values = query_hash
|
28
|
+
uri.query
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "client"
|
2
|
+
|
3
|
+
module JustGiving
|
4
|
+
class Search < Client
|
5
|
+
|
6
|
+
def searchCharities(filters = {})
|
7
|
+
get("charity/search", filters)
|
8
|
+
end
|
9
|
+
|
10
|
+
def searchEvents(filters = {})
|
11
|
+
get("event/search", filters)
|
12
|
+
end
|
13
|
+
|
14
|
+
def searchFundraisers(filters = {})
|
15
|
+
get("fundraising/search", filters)
|
16
|
+
end
|
17
|
+
|
18
|
+
def searchCommemorations(filters = {})
|
19
|
+
get("remember/search", filters)
|
20
|
+
end
|
21
|
+
|
22
|
+
def searchTeams(filters = {})
|
23
|
+
get("team/search", filters)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/justgiving.rb
ADDED
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: justgiving
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jack Dent
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: curb
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: addressable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- jack@jackdent.co.uk
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- justgiving.gemspec
|
96
|
+
- lib/justgiving.rb
|
97
|
+
- lib/justgiving/charity.rb
|
98
|
+
- lib/justgiving/client.rb
|
99
|
+
- lib/justgiving/country.rb
|
100
|
+
- lib/justgiving/currency.rb
|
101
|
+
- lib/justgiving/donation.rb
|
102
|
+
- lib/justgiving/search.rb
|
103
|
+
- lib/justgiving/version.rb
|
104
|
+
homepage: http://www.github.com/jackdent/justgiving
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.0.6
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: A Ruby REST client for the JustGiving API
|
128
|
+
test_files: []
|