openbd_api 0.4.2 → 0.4.3

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: 8182cc57fa934856a6925c238a474a95f60be94b
4
- data.tar.gz: 843d55ada33dc9e7cf066ea86074f47027928ae9
3
+ metadata.gz: 2af0771ace9a3273fb922c7e8824c403ffe7378d
4
+ data.tar.gz: 82728020a0d54f05114dd6bb75c1d479bfe2cbea
5
5
  SHA512:
6
- metadata.gz: d3371a9253701278c58a0a1674aab44d70a869bbaed980d4dc75bfb3281c8b441cf9008701b8b74f86fe664dc964f31acdc477c3f8d88c108a939dd66fdfd23e
7
- data.tar.gz: 4512dd10a23df80c46f7ad26a77a7ae1313fccaa0a4c2ecebb890351b71c849cc5e35ef5bfff0e56f7a51cf5cea7d7a8da1ec385238966cdb179fb6192574334
6
+ metadata.gz: af95b49a8efd9ca089981cf31c9c18f777752ab66aa8492aac66f17c942fe4e2e88bf7cea970aae7c0175f0135c57af76e12742b1cbd71a380ce8a84bb703ca8
7
+ data.tar.gz: 8c66060f8c267cff67ec1cf6116cf4a3bd4abf28addd5e91009e2954867e95d69521703990f6000dabce4cec2f8234a922ef35960a9f2e496d833b2d70b70ec0
@@ -1,7 +1,12 @@
1
+ ## 0.4.3
2
+
3
+ - add OpenBD::Client specs for #get, #bulk_get, and #coverage
4
+ - bulk_get should use POST method
5
+
1
6
  ## 0.4.2
2
7
 
3
8
  - add specs of OpenBD::Client#normalize_isbns
4
- - make Client#normalize_isbns return String of Numbers (and `,` if needed)
9
+ - make Client#normalize_isbns return String of Numbers (and `,` if needed)
5
10
 
6
11
  ## 0.4.1
7
12
 
data/README.md CHANGED
@@ -65,6 +65,13 @@ $ openbd coverage
65
65
  $ openbd schema
66
66
  $ openbd --help
67
67
  Usage: openbd <method> [arguments] [options]
68
+
69
+ Supported <method>:
70
+ get Find book data by ISBN(s)
71
+ bulk_get Find book data by ISBN(s)
72
+ coverage Show all ISBNs in openBD
73
+ schema Show the JSON Schema of openBD
74
+
68
75
  -v, --version print the version
69
76
  -h, --help print help
70
77
  ```
@@ -14,7 +14,7 @@ module OpenBD
14
14
  end
15
15
 
16
16
  def bulk_get(isbns)
17
- get_request(
17
+ post_request(
18
18
  method: PATH_TO_GET,
19
19
  params: { isbn: normalize_isbns(isbns) },
20
20
  response_class: ::OpenBD::Responses::Get
@@ -49,11 +49,12 @@ module OpenBD
49
49
  response_class.new(faraday_response)
50
50
  end
51
51
 
52
- def post_request(method, params)
52
+ def post_request(method:, params:, response_class:)
53
53
  faraday_response = connection.post do |req|
54
54
  req.url method
55
55
  req.body = "isbn=#{normalize_isbns(params[:isbn])}"
56
56
  end
57
+ response_class.new(faraday_response)
57
58
  end
58
59
 
59
60
  def normalize_isbns(isbns)
@@ -29,7 +29,15 @@ module OpenBD
29
29
 
30
30
  def parse_option
31
31
  @opts = ::Slop.parse do |o|
32
- o.banner = "Usage: openbd <method> [arguments] [options]"
32
+ o.banner = <<-EOB
33
+ Usage: openbd <method> [arguments] [options]
34
+
35
+ Supported <method>:
36
+ get Find book data by ISBN(s)
37
+ bulk_get Find book data by ISBN(s)
38
+ coverage Show all ISBNs in openBD
39
+ schema Show the JSON Schema of openBD
40
+ EOB
33
41
  o.on '-v', '--version', 'print the version' do
34
42
  puts "openbd_api #{OpenBD::VERSION}"
35
43
  exit
@@ -1,3 +1,3 @@
1
1
  module OpenBD
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openbd_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nasum