openbd_api 0.3.1 → 0.3.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: 794a3669557afc7722f548062aed207891cdcd18
4
- data.tar.gz: fbb1982d42e395a34c21a0e30b4217aab249de45
3
+ metadata.gz: 5d7dbb8431a3263434f2803c4d6ddfe812b45638
4
+ data.tar.gz: c8418e54012fef1faaed816df101b5d51d22633e
5
5
  SHA512:
6
- metadata.gz: ba82e049e17188af953aa58ee457385712db7278075a486e3cd83843842fa6176a8ffaa9142d35c89da4d1b633695192c52bcdba8d9b0b98d231f82a190711f9
7
- data.tar.gz: f44775ee26d6130c3cccb845fd0ad17c82874bda2fb95a6634a017fed26c2854c38f42df52e61b9627632c0bd0bbd4440084ba3fc159824d1369f3aeaf4aaf5a
6
+ metadata.gz: cdb36dd3ebb4a0fb33daa50781a3b7199906740af32c60e7c24cb2dd700b8181139b9434cf298a521bd72366397ddca5b041bf2fdcd28afc1630b392cccef03b
7
+ data.tar.gz: 768c10f9b655a6f8c33b370979c14f54ba240751f7a8c8ff800834e09cf31165acddf785508c7d0065f3d788095709006ee31f66c76e4059d0ecbd16d232e5e5
data/README.md CHANGED
@@ -31,14 +31,18 @@ Like this.
31
31
  require 'openbd_api'
32
32
 
33
33
  # get
34
+ OpenBD.get 9784309226712
34
35
  OpenBD.get '9784309226712'
35
36
  OpenBD.get '9784309226712,9784309226729'
36
37
  OpenBD.get [9784309226712,9784309226729]
38
+ OpenBD.get ['9784309226712','9784309226729']
37
39
 
38
40
  # bulk_get
41
+ OpenBD.bulk_get 9784309226712
39
42
  OpenBD.bulk_get '9784309226712'
40
43
  OpenBD.bulk_get '9784309226712,9784309226729'
41
44
  OpenBD.bulk_get [9784309226712,9784309226729]
45
+ OpenBD.bulk_get ['9784309226712','9784309226729']
42
46
 
43
47
  # coverage
44
48
  OpenBD.coverage
data/lib/openbd/client.rb CHANGED
@@ -34,10 +34,14 @@ class OpenBD
34
34
  end
35
35
 
36
36
  def prepare_url(method, isbns = nil)
37
- if isbns.kind_of? String
37
+ case isbns
38
+ when String
38
39
  params = normalize_isbns(isbns)
39
40
  "#{API_BASE_URL}#{method}?isbn=#{params}"
40
- elsif isbns.kind_of? Array
41
+ when Numeric
42
+ params = normalize_isbns(isbns)
43
+ "#{API_BASE_URL}#{method}?isbn=#{params}"
44
+ when Array
41
45
  params = normalize_isbns(isbns)
42
46
  "#{API_BASE_URL}#{method}?isbn=#{params}"
43
47
  else
@@ -46,17 +50,18 @@ class OpenBD
46
50
  end
47
51
 
48
52
  def normalize_isbns(isbns)
49
- params = ""
50
- if isbns.kind_of? String
51
- params << isbns
52
- elsif isbns.kind_of? Array
53
+ case isbns
54
+ when String
55
+ isbns
56
+ when Numeric
57
+ isbns
58
+ when Array
59
+ params = ""
53
60
  isbns.each do |isbn|
54
61
  params << "#{isbn}, "
55
62
  end
56
- params.strip!.gsub!(/,$/,'')
63
+ params.strip!.gsub(/,$/,'')
57
64
  end
58
-
59
- params
60
65
  end
61
66
  end
62
67
  end
@@ -1,3 +1,3 @@
1
1
  module Openbd
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nasum