Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

relaton-isbn

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relaton-isbn

  • 1.19.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Relaton-ISBN: retrieves bibliographic items using OpenLibrary API

image:https://img.shields.io/gem/v/relaton-isbn.svg["Gem Version", link="https://rubygems.org/gems/relaton-isbn"] image:https://github.com/relaton/relaton-isbn/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-isbn/actions?workflow=macos"] image:https://github.com/relaton/relaton-isbn/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-isbn/actions?workflow=windows"] image:https://github.com/relaton/relaton-isbn/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-isbn/actions?workflow=ubuntu"] image:https://codeclimate.com/github/relaton/relaton-isbn/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-isbn"] image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-isbn.svg["Pull Requests", link="https://github.com/relaton/relaton-isbn/pulls"] image:https://img.shields.io/github/commits-since/relaton/relaton-isbn/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-isbn/releases"]

RelatonIsbn is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].

You can use it to retrieve metadata of Standards from https://openlibrary.org, and access such metadata through the BibliographicItem object.

== Installation

Add this line to your application's Gemfile:

[source,ruby]

gem 'relaton-isbn'

And then execute:

[source,sh]

$ bundle install

Or install it yourself as:

[source,sh]

$ gem install relaton-isbn

== Usage

=== Retrieving bibliographic items using OpenLibrary API

To retrieve bibliographic items, use RelatonIsbn::OpenLibrary.get method with ISBN-10 or ISBN-13 as an argument. Allowed prefixes are ISBN, isbn:. Prefix and hyphens are optional. The method returns RelatonBib::BibliographicItem object.

[source,ruby]

require 'relaton_isbn' => true

get document by ISBN-13

ibitem = RelatonIsbn::OpenLibrary.get "ISBN 978-0-12-064481-0" [relaton-isbn] (ISBN 9780120644810) Fetching from OpenLibrary ... [relaton-isbn] (ISBN 9780120644810) Found: 9780120644810 => #<RelatonBib::BibliographicItem:0x0000000113889258 ...

get document by ISBN-10

RelatonIsbn::OpenLibrary.get "isbn:0120644819" [relaton-isbn] (isbn:0120644819) Fetching from OpenLibrary ... [relaton-isbn] (isbn:0120644819) Found: 9780120644810 => #<RelatonBib::BibliographicItem:0x00000001098ac960 ...


=== Serializing bibliographic items [source,ruby]

serialize to XML

puts bibitem.to_xml

Graphics gems II http://openlibrary.org/books/OL21119585M/Graphics_gems_II 9780120644810 1991 James Arvo AP Professional Boston London

serialize to bibdata XML

puts bibitem.to_xml bibdata: true

Graphics gems II ...

serialize to hash

bibitem.to_hash => {"schema-version"=>"v1.2.7", "id"=>"9780120644810", "title"=>[{"content"=>"Graphics gems II", "format"=>"text/plain", "type"=>"main"}], "link"=>[{"content"=>"http://openlibrary.org/books/OL21119585M/Graphics_gems_II", "type"=>"src"}], "docid"=>[{"id"=>"9780120644810", "type"=>"ISBN", "primary"=>true}], "date"=>[{"type"=>"published", "value"=>"1991"}], "contributor"=> [{"person"=>{"name"=>{"completename"=>{"content"=>"James Arvo"}}, "url"=>"http://openlibrary.org/authors/OL2646519A/James_Arvo"}, "role"=>[{"type"=>"author"}]}, {"organization"=>{"name"=>[{"content"=>"AP Professional"}]}, "role"=>[{"type"=>"publisher"}]}], "revdate"=>"1991", "place"=>[{"city"=>"Boston"}, {"city"=>"London"}]}


=== Logging

RelatonIsbn uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.

== Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to https://rubygems.org[rubygems.org].

== Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-isbn.

== License

The gem is available as open source under the terms of the https://opensource.org/licenses/MIT[MIT License].

FAQs

Package last updated on 03 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc