justgiving 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccb5e54e49a507a3bbb068d62ac4f21e6e42aaf6
4
- data.tar.gz: 7027a1f332ab1fe04f008ceb4a768e44de40b15d
3
+ metadata.gz: e1e658fde7ceee06bfcd7837ef2022e6210282eb
4
+ data.tar.gz: 2761b08ee6c72220dae4c3f7f8fdd27d560f965c
5
5
  SHA512:
6
- metadata.gz: ddd0bd40d46ef08df75cb0f8025816db0dd94545875bada88036963a436738f1b8df9c3f4e4ae7700f6a3c9c435fd6defb2c332d328e7a8bdc804c3995dc0a82
7
- data.tar.gz: 04d2f2ad3da1f119588b6bfca6e8fe6748d38977de36157e8ed373c1947919ad43b64a5d8df6e3192f239a0e0dbf30ea4b667aed533281afdfbb5fc701173cfd
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.searchCharities({q: 'Macmillan'})
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
@@ -23,5 +23,4 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_runtime_dependency "faraday", "~> 0.9"
25
25
  spec.add_runtime_dependency "faraday_middleware", "~> 0.9"
26
- spec.add_runtime_dependency "addressable", "~> 2.3"
27
26
  end
@@ -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
- url: @base_url,
14
- headers: {
15
- 'User-Agent' => 'Ruby REST client',
16
- 'Content-Type' => 'application/json'
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, query_hash=nil)
24
- @connection ||= Faraday.new(@connection_defaults) do |connection|
25
- connection.response :json, :content_type => /\bjson$/
26
- connection.response :logger
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
@@ -1,3 +1,3 @@
1
1
  module JustGiving
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-20 00:00:00.000000000 Z
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