0.0
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for Rescuegroups API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
>= 0
 Project Readme

This is Ruby wrapper for Rescuegroups API http://support.rescuegroups.org:8091/display/userguide/HTTP+API

Installation

Add to your Gemfile

gem 'rescuegroups'

Usage

First setup your api key

Rescuegroups.configure do |config|
  config.api_key = 'ABCD'
end

Then create a client anywhere with object_type and object_action attributes. Your snake_case symbols are automatically camelcased within.

client = Rescuegroups::Client.new :object_type => "animals", :object_action => "publicSearch"

If you wish to perform elevated actions like add or edit animal you will have to login.

client.login(:username => "john", :password => "doe", :account_number => "0")

This will attach token and tokenHash to further requests

Search procedure

Add filters. For example to search for an animal with animalID as 1234

client.set_search_filter 'animalID', :eq, "1234"
client.set_search_filter 'animalStatus', :eq, "Available" # Not required but adviced

To clear all filters do

client.clear_search_filters

Specify the fields you need as an array

client.set_search_fields ['animalName', 'animalID', 'animalBreed']

To clear all fields do

client.clear_search_fields

Then, run the query and get the json

response = client.query

Add/Edit animal procedure

To add animal species(dog/cat/bird) and primary breed are compulsory First create a client and login

client = Rescuegroups::Client.new :object_type => "animals", :object_action => "add" # or "edit"
client.login(:username => "john", :password => "doe", :user_account => "0")

Then set the values of fields(snake_cased)

client.set_value_fields(:animal_name => "Pepsi", :animal_species_id => "Dog", :animal_primary_breed_id => "123")

Send a query as usual and watch for response

response = client.query

For available object type and object actions refer to http://support.rescuegroups.org:8091/display/userguide/HTTP+API+object+definitions

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request