No commit activity in last 3 years
No release in over 3 years
Interact with Etrieve Content's REST API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.16
~> 12.3

Runtime

 Project Readme

EtrieveContentApi

Ruby wrapper for accessing the Etrieve Content API. Document metadata and content retrieval is currently supported. Document writes may be supported in a future version.

Installation

Add this line to your application's Gemfile:

gem 'etrieve_content_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install etrieve_content_api

Configuration

Configuration can be passed as a hash.

{
  auth_url: 'https://example.com/auth', # default: ''
  base_url: 'https://example.com/api', # default: ''
  password: password, # default: ''
  username: username, # default: '' - might be a client_id as opposed to a user login
  timeout: 1, # default: 30 seconds
  verify_ssl: false # default: true
}

Configuration can be read from a YAML file by passing the file path. The file should contain a hash structure and ERB content is evaluated:

  ---
  auth_url: 'https://example.com/auth',
  base_url: 'https://example.com/api',
  password: password,
  username: username,
  timeout: 1,
  verify_ssl: false

Usage

Basic Request

See Handler class for prebuilt requests for things like document metadata and content.

require 'etrieve_content_api'
handler = EtrieveContentApi::Handler.new(config_hash_or_path_to_config_yaml)
handler.document_metadata({:q => 'Sue'})

Using EtrieveContentApi::Connection

Connection#execute can be used to wrap a group of calls with a single authentication request.

conn = EtrieveContentApi::Connection.new(config_hash_or_path_to_config_yaml)
conn.execute() {
  @custom1 = conn.get_custom_connection([conn.base_url, 'custom_path1'].join('/'), conn.headers)
  @custom2 = conn.get_custom_connection([conn.base_url, 'custom_path2'].join('/'), conn.headers)
}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/reed_college/etrieve_content_api.

License

The gem is available as open source under the terms of the BSD-3-Clause License.