Elessar Ruby Library
Elessar - In the book, Elessar is a green gemstone that is a symbol of the kingship of Gondor.
The Elessar Ruby library provides convenient access to the The Lord of the Rings API from
applications written in the Ruby language.
Documentation
See the The Lord of the Rings API docs.
Installation
You don't need this source code unless you want to modify the gem. If you just
want to use the package, just run:
gem install elessar
If you want to build the gem from source:
gem build elessar.gemspec
Requirements
Bundler
If you are installing via bundler, you should be sure to use the https rubygems
source in your Gemfile, as any gems fetched over http could potentially be
compromised in transit and alter the code of gems fetched securely over https:
gem 'elessar'
Usage
The library needs to be configured with your account's secret key which is
available in your The Lord of the Rings Account. Set Elessar.api_key
to its
value:
require 'elessar'
Elessar.api_key = 'aR9j-...'
Elessar::Movie.list()
movie = Elessar::Movie.retrieve('5cd95395de30eff6ebccde5b')
movie.list_quotes()
Params
Elessar::Movie.list({limit: 3, page: 2})
Elessar::Movie.list("budgetInMillions<100")
Configuring Automatic Retries
You can enable automatic retries on requests that fail due to a transient
problem by configuring the maximum number of retries:
Elessar.max_network_retries = 2
Various errors can trigger a retry, like a connection error or a timeout, and
also certain API responses like HTTP status 409 Conflict
.
Configuring Timeouts
Open, read timeouts are configurable:
Elessar.open_timeout = 30
Elessar.read_timeout = 80
Development
Instructions to run tests:
bundle install
Run all tests:
bundle exec ruby test/run_test.rb
Run a single test:
bundle exec ruby test/elessar_test.rb