Smithsonian/edanrb

Name: edanrb

Owner: Smithsonian Institution

Description: ruby connector for EDAN API

Created: 2013-11-14 19:53:38.0

Updated: 2016-07-13 20:36:23.0

Pushed: 2013-11-16 14:20:19.0

Homepage: null

Size: 128

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

EDAN API Ruby Library

This is for an initial exploration of a Smithsonian API.

Use of this library requires a name & password and is currently for developers who are registered volunteers.

Contact Info: Sarah Allen allensa@si.edu

Usage
install edanrb
rt EDANUSER=SECRETNAME
rt EDANPASS=SECRETPASS

install json

quire 'edan'
 = EDANQuery.new('myapp')
s = eq.request('q=art&wt=json')
s.code
"200"

quire 'json'
ON.parse(res.body)
{"responseHeader" ...
Using the Gem with Rails 3.x+
Add edanrb gem to your Gemfile:
'edanrb'

Then, run the 'bundle install' command.

Add authentication settings:

There are two ways to do this, you can create a file in your /config/initializer directory:

ig/initializer/edanrb_settings.rb:

ecify the username and password for the EDAN API:
'EDANUSER'] = "this_is_my_username"
'EDANPASS'] = "this_is_my_password"

Alternatively, you can do this from the command line when you start your rails server if you do not want to commit auth info for security reasons.

ANUSER="this_is_my_username" EDANPASS="this_is_my_password" rails server
That's it! Now you're ready to rock with EDAN.

Don't forget to add the 'require' statement to your controllers or other locations where you'll be calling edanrb methods:

ire 'edan'

hello_edan_world
q = EDANQuery.new('myapp')
es = eq.request('q=art&wt=json')
son_res = JSON.parse(res.body)


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.