justgiving 0.0.2 → 0.0.3

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: 149cdad0d3a7e2f98ffdafeaed8e285a1ad3599a
4
- data.tar.gz: b6a7a81216152023c21816fab925f1868e252353
3
+ metadata.gz: 9aa8aac685f830d070bc74748d0f03f84914235c
4
+ data.tar.gz: f4681e2e50a780856d01a52354ef2532c8ebe05b
5
5
  SHA512:
6
- metadata.gz: d2b08eefee9d32e7e897ea28e1656d5f61e36d965cdbee60353aafb1d9d4cb9b4fcee88ce7afbda0e6ce5aa5636618e5783088bc573de1ccfba01948d693c8a5
7
- data.tar.gz: 2d386fcea88cd7e8cfce3eb1c432aacd5be9417e6d7d7421108ee43b71a43bd1a41525a107d563a9d654a55309c69a1bae845a0f83fd61287dc2fe15b53da96c
6
+ metadata.gz: a0f6709649c9a342ccb85c25c00eeb06beba870d58559950f1b9578f84c341ab5e4ca0de8b3c7d7625c7aaec90a93f6964b8402f738126eaacc9180887aa4bad
7
+ data.tar.gz: c65573055ffdb5b4179c7f68220f6773429191b03f9426d770e502b2dfd0ba06c675902a08521dac9f71867ead7447e8e5e5b091e65319861bc2ebf5d74b189d
@@ -8,28 +8,26 @@ module JustGiving
8
8
  def initialize(token)
9
9
  @token = token
10
10
  @base_url = "https://api.justgiving.com/#{@token}/v1/"
11
+ @connection_defaults = {
12
+ url: @base_url,
13
+ headers: {
14
+ 'User-Agent' => 'Ruby REST client',
15
+ 'Content-Type' => 'application/json'
16
+ }
17
+ }
11
18
  end
12
19
 
13
20
  protected
14
21
 
15
22
  def get(path, query_hash=nil)
16
- if not @conn
17
- defaults = {
18
- url: @base_url,
19
- headers: {
20
- 'User-Agent' => 'Ruby REST client',
21
- 'Content-Type' => 'application/json'
22
- }
23
- }
24
- connection = Faraday.new(defaults) do |connection|
25
- connection.response :json, :content_type => /\bjson$/
26
- connection.response :logger
27
- connection.adapter Faraday.default_adapter
28
- end
23
+ @connection ||= Faraday.new(@connection_defaults) do |connection|
24
+ connection.response :json, :content_type => /\bjson$/
25
+ connection.response :logger
26
+ connection.adapter Faraday.default_adapter
29
27
  end
30
28
 
31
29
  path += '?' + query_string_from_hash(query_hash) if query_hash
32
- response = connection.get path
30
+ response = @connection.get path
33
31
  response.body
34
32
  end
35
33
 
@@ -1,3 +1,3 @@
1
1
  module JustGiving
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: justgiving
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dent