bookdepository 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0f44da3798414dfa5f88b590110651f80356f79
4
- data.tar.gz: c1d3c084aaba5af513d329f2a13b277cb9e96d28
3
+ metadata.gz: 17ecf3c98217449e085e830180167027aff51193
4
+ data.tar.gz: 4335fabead3b9d39cd00f98c1d07895d258d79c4
5
5
  SHA512:
6
- metadata.gz: c1740fcdbeb2cdec3753e38c6d92f0041fe65f050918cd3496826132c1762f606024288801ff09c0dc24f7731bc257ccd1b200a81533a5383fca937939d7909e
7
- data.tar.gz: 1b1ceda638bdd68d66873a92718e6f0d746bcf014f4e46bd4d8112fa05097622af9367a0fa9f705616e029dca817d3dac1404356d07a22d015cf225218ad260a
6
+ metadata.gz: 56f9a314e0181e46c8c2eb9256f045043908d35e0138822a8ed6192142984d8a05643f04af46a2679312a09a85ab62780b2a5310cb7bd6240f9066e36ebf1999
7
+ data.tar.gz: 4dbe6cfdeec8f07cb8beeacb3f7e4ce60c768a235db0e07b5f786641ff98d235e92f7f491f1c4a1725ccbf95bac7ef62e048c972b4ef6b6c5169aedaeb5c5286
@@ -1,10 +1,10 @@
1
1
  require 'forwardable'
2
- require 'bookdepository/request'
2
+ require 'bookdepository/client'
3
3
 
4
4
  module Bookdepository
5
5
  class << self
6
6
  extend Forwardable
7
7
 
8
- def_delegators Request, :new, :config
8
+ def_delegators Client, :new, :configure
9
9
  end
10
10
  end
@@ -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 Request
8
+ class Client
9
+ extend Forwardable
10
+
8
11
  AVAILABLE_CURRENCIES = %w(USD GBP EUR CAD AUD SGD NZD)
9
12
 
10
- def self.config
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' => Config.client_id,
43
- 'authenticationKey' => Config.auth_key
47
+ 'clientId' => client_id,
48
+ 'authenticationKey' => auth_key
44
49
  )
45
50
  .tap { |params|
46
51
  if params.has_key?('countryCode')
@@ -1,3 +1,3 @@
1
1
  module Bookdepository
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -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.1
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-14 00:00:00.000000000 Z
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