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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +7 -0
- data/lib/openbd/client.rb +3 -2
- data/lib/openbd/openbd_cli.rb +9 -1
- data/lib/openbd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2af0771ace9a3273fb922c7e8824c403ffe7378d
|
4
|
+
data.tar.gz: 82728020a0d54f05114dd6bb75c1d479bfe2cbea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af95b49a8efd9ca089981cf31c9c18f777752ab66aa8492aac66f17c942fe4e2e88bf7cea970aae7c0175f0135c57af76e12742b1cbd71a380ce8a84bb703ca8
|
7
|
+
data.tar.gz: 8c66060f8c267cff67ec1cf6116cf4a3bd4abf28addd5e91009e2954867e95d69521703990f6000dabce4cec2f8234a922ef35960a9f2e496d833b2d70b70ec0
|
data/CHANGELOG.md
CHANGED
@@ -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
|
```
|
data/lib/openbd/client.rb
CHANGED
@@ -14,7 +14,7 @@ module OpenBD
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def bulk_get(isbns)
|
17
|
-
|
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
|
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)
|
data/lib/openbd/openbd_cli.rb
CHANGED
@@ -29,7 +29,15 @@ module OpenBD
|
|
29
29
|
|
30
30
|
def parse_option
|
31
31
|
@opts = ::Slop.parse do |o|
|
32
|
-
o.banner =
|
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
|
data/lib/openbd/version.rb
CHANGED