Git Product home page Git Product logo

koha.rb's Introduction

Koha Build Status Code Climate

A simple ruby wrapper for the Koha ILS RESTFUL API.

Prerequisites

You must install the RESTFUL api code to your instance of Koha. This project can be found here => http://git.biblibre.com/?p=koha-restful;a=summary

Installation

Add this line to your application's Gemfile:

gem 'koha'

And then execute:

$ bundle

Or install it yourself as:

$ gem install koha

Usage

Here a quick irb walk-through...

$ irb

1.9.3-p286 :001 > require 'koha'
=> true

Make a Connection...

1.9.3-p286 :002 > k = Koha.connect(:url => "http://my.library.se/cgi-bin/koha/rest.pl" )
=> #<Koha::Client:0x007fbcec9b6fd0 @uri=#<URI::HTTP:0x007fbcec9c3a00 URL:http://my.library.se/cgi-bin/koha/rest.pl/>, @proxy=nil, @connection=#Koha::Connection:0x007fbcec9b6ff8, @options={:url=>"http://my.library.se/cgi-bin/koha/rest.pl"}>

now get branch information...

1.9.3-p286 :003 > k.branches
=> [ { "name"=>"World Maritime University Library", "code"=>"WMU"}, { "name"=>"ebrary", "code"=>"EBR" } ]

find a bibliographic record

1.9.3-p286 :006 > k.find_biblio("17454")
=> [{"withdrawn"=>"1", "biblioitemnumber"=>"17454", .......

check is an biblio is holdable.....

1.9.3-p286 :009 > k.biblio_holdable?("17454" )
=> false

... for a specific user ...

1.9.3-p286 :011 > k.biblio_holdable?("17454", :borrowernumber => "544" )
=> true

... by user name ...

1.9.3-p286 :012 > k.biblio_holdable?("17454", :borrowername => "cf" )
=> true

get the user's holds.

1.9.3-p286 :013 > k.user_holds :borrowername => "cf"
=> [{"itemnumber"=>nil, "branchname"=>"World Maritime University Library", "itemcallnumber"=>nil, "hold_id"=>nil, "reservedate"=>"2013-02-20", "barcode"=>nil, "found"=>nil, "biblionumber"=>"76356", "cancellationdate"=>nil, "title"=>"Asian approaches to international law and the legacy of colonialism and imperialism :", "rank"=>"1", "branchcode"=>"WMU"}]

or get the user's issues

1.9.3-p286 :014 > k.user_issues :borrowernumber => "544"
=> [{"itemnumber"=>"42414", "itemcallnumber"=>"KD1819 .H54 2003", "barcode"=>"022593", "date_due"=>"2013-03-11T23:59:00", "renewable"=>true, "issuedate"=>"2012-11-21T00:00:00", "biblionumber"=>"17454", "title"=>"Maritime law", "borrowernumber"=>"544", "branchcode"=>"WMU"}]

TODO

Change to Farady? Worried about other libraries that some people cannot use? More tests.

Development

Checkout the code. rake will run the tests. rake coverage will generate coverage. rake yard will generate documentation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature) 2.5 Write the code and add tests.
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

koha.rb's People

Contributors

cfitz avatar

Watchers

Liz Rea avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.