Project

openbd

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
The library provides a wrapper to the openBD API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0
~> 2.3.0

Runtime

~> 2.8.3
 Project Readme

Openbd

Gem Version Build Status

The Ruby library provides a wrapper to the openBD API.

Installation

Add this line to your application's Gemfile:

gem 'openbd'

And then execute:

$ bundle

Or install it yourself as:

$ gem install openbd

Usage

Like this.

require 'openbd'

client = Openbd::Client.new

# get
client.get('978-4-7808-0204-7')
client.get('4-06-2630869,978-4-06-2144490')
client.get(['4-06-2630869', '978-4-06-2144490'])

# get less than 10,000 ISBNs 
isbns.size        # => 9,999
client.get(isbns)
# raise Error if over 10,000 ISBNs
isbns.size        # => 10,001
client.get(isbns) # => Param limit exceeded.

# coverage
client.coverage

You can access HTTPClient(doc). For example:

client.httpclient.class # => HTTPClient
# set debug output device
client.httplicent.debug_dev = STDOUT
# set timeout param
client.connect_timeout = 100
client.send_timeout    = 100
client.receive_timeout = 100

Using proxy

To access resources through HTTP proxy, following methods are available

  1. Set Environment Variable
  2. Set HTTPClient#proxy=(proxy)

Set Environment Variable

Set HTTP_SERVER or http_server as Environment Variable.

export HTTP_PROXY=http://user:pass@host:port
# or
#export http_proxy=http://user:pass@host:port

Set HTTPClient#proxy=(proxy)

#httpclient returns HTTPClient instance.

require 'openbd'

client = Openbd::Client.new
client.httpclient.class # => HTTPClient
client.httpclient.proxy = 'http://user:pass@host:port'

Even if HTTP_PROXY(or http_proxy) been already set, .proxy takes precedence.

Requirements

  • Ruby(MRI) 2.2.0 or higher

License

The gem is available as open source under the terms of the MIT License.