Project

zotero-rb

0.0
No release in over 3 years
A feature-complete Ruby client for the Zotero Web API v3, providing full CRUD operations for items, collections, tags, and searches, plus file uploads, fulltext content access, and library synchronization. Built with a modular architecture and comprehensive error handling.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Zotero Ruby Gem

Gem Version CI

A comprehensive Ruby client for the Zotero Web API v3.

NOTE: This gem is experimental and has not been fully tested with real data. So far, the gem has been set up to cover Zotero's web API documentation as much as possible, but testing is still ongoing. Do not use this gem for production applications without exercising due caution. Having said that, if you come across something that doesn't work, open up an issue or even a PR and I'd be happy to get a fix going.

Installation

gem install zotero-rb

Usage

require 'zotero'

# Create a client with your API key
client = Zotero.new(api_key: 'your-api-key')

# Get a library (user or group)
library = client.user_library(12345)
group_library = client.group_library(67890)

# Work with items
items = library.items
new_item = library.create_item(itemType: 'book', title: 'My Book')
library.update_item('ITEM123', { title: 'Updated Title' }, version: 150)
library.delete_item('ITEM123', version: 151)

# Work with collections
collections = library.collections
new_collection = library.create_collection(name: 'My Collection')

# Upload files
library.upload_file('ITEM123', '/path/to/file.pdf')

# Access metadata
item_types = client.item_types
book_fields = client.item_type_fields('book')

Authentication

  1. Create a new Zotero API key or use an existing one in your Zotero settings
  2. Ensure your key has the appropriate permissions (read library, write library, etc.)
  3. Pass it to the client as shown above

Development

bundle install
bundle exec rake spec
bundle exec rubocop

Releases

This project uses Release Please for automated releases:

  1. Use conventional commits: feat: add new feature, fix: resolve bug, etc.
  2. Release Please creates PRs automatically with version bumps and changelog updates
  3. Merge the release PR when ready to publish
  4. Automatic publication to RubyGems happens after merge

Repository Setup (for maintainers)

To enable automated publishing, add this secret to the GitHub repository:

License

MIT License