bookdepository 0.0.1 → 0.0.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 +4 -4
- data/lib/bookdepository.rb +2 -2
- data/lib/bookdepository/{request.rb → client.rb} +9 -4
- data/lib/bookdepository/version.rb +1 -1
- data/test/test_bookdepository.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ecf3c98217449e085e830180167027aff51193
|
4
|
+
data.tar.gz: 4335fabead3b9d39cd00f98c1d07895d258d79c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56f9a314e0181e46c8c2eb9256f045043908d35e0138822a8ed6192142984d8a05643f04af46a2679312a09a85ab62780b2a5310cb7bd6240f9066e36ebf1999
|
7
|
+
data.tar.gz: 4dbe6cfdeec8f07cb8beeacb3f7e4ce60c768a235db0e07b5f786641ff98d235e92f7f491f1c4a1725ccbf95bac7ef62e048c972b4ef6b6c5169aedaeb5c5286
|
data/lib/bookdepository.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
require 'countries'
|
2
3
|
require 'excon'
|
3
4
|
require 'bookdepository/config'
|
4
5
|
require 'bookdepository/parser'
|
5
6
|
|
6
7
|
module Bookdepository
|
7
|
-
class
|
8
|
+
class Client
|
9
|
+
extend Forwardable
|
10
|
+
|
8
11
|
AVAILABLE_CURRENCIES = %w(USD GBP EUR CAD AUD SGD NZD)
|
9
12
|
|
10
|
-
|
13
|
+
def_delegators Config, :auth_key, :client_id
|
14
|
+
|
15
|
+
def self.configure
|
11
16
|
yield Config
|
12
17
|
end
|
13
18
|
|
@@ -39,8 +44,8 @@ module Bookdepository
|
|
39
44
|
def build_params(options)
|
40
45
|
options
|
41
46
|
.merge(
|
42
|
-
'clientId' =>
|
43
|
-
'authenticationKey' =>
|
47
|
+
'clientId' => client_id,
|
48
|
+
'authenticationKey' => auth_key
|
44
49
|
)
|
45
50
|
.tap { |params|
|
46
51
|
if params.has_key?('countryCode')
|
data/test/test_bookdepository.rb
CHANGED
@@ -11,6 +11,13 @@ class TestBookdepository < Minitest::Test
|
|
11
11
|
VCR.eject_cassette
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_configure
|
15
|
+
Bookdepository.configure do |c|
|
16
|
+
c.client_id = '123'
|
17
|
+
end
|
18
|
+
assert_equal '123', @client.client_id
|
19
|
+
end
|
20
|
+
|
14
21
|
def test_books
|
15
22
|
@options.update(
|
16
23
|
'keywords' => 'Architecture'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookdepository
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: countries
|
@@ -104,9 +104,9 @@ files:
|
|
104
104
|
- LICENSE
|
105
105
|
- README.md
|
106
106
|
- lib/bookdepository.rb
|
107
|
+
- lib/bookdepository/client.rb
|
107
108
|
- lib/bookdepository/config.rb
|
108
109
|
- lib/bookdepository/parser.rb
|
109
|
-
- lib/bookdepository/request.rb
|
110
110
|
- lib/bookdepository/version.rb
|
111
111
|
- test/helper.rb
|
112
112
|
- test/test_bookdepository.rb
|