Class: Openbd::Client
- Inherits:
-
Object
- Object
- Openbd::Client
- Defined in:
- lib/openbd/client.rb
Overview
The Client class provides a wrapper to the openBD service
Instance Method Summary collapse
-
#coverage ⇒ Array<String>
call /coverage.
-
#get(isbn) ⇒ Hash
call /get.
-
#httpclient ⇒ HTTPClient
get HTTPClient.
-
#schema ⇒ Object
call /schema.
Instance Method Details
#coverage ⇒ Array<String>
call /coverage
40 41 42 43 44 |
# File 'lib/openbd/client.rb', line 40 def coverage url = "#{END_POINT}/coverage" resp = httpclient.get(url) body(resp) end |
#get(isbn) ⇒ Hash
call /get
28 29 30 31 32 33 34 35 |
# File 'lib/openbd/client.rb', line 28 def get(isbn) url = "#{END_POINT}/get" isbns = isbn_param(isbn) method = get_method(isbns) q = { isbn: isbns.join(',') } resp = httpclient.send(method, url, q) body(resp) end |
#httpclient ⇒ HTTPClient
get HTTPClient
57 58 59 |
# File 'lib/openbd/client.rb', line 57 def httpclient @httpclient ||= HTTPClient.new end |
#schema ⇒ Object
call /schema
48 49 50 51 52 |
# File 'lib/openbd/client.rb', line 48 def schema url ="#{END_POINT}/schema" resp = httpclient.get(url) body(resp) end |