module Petfinder::Api

Public Instance Methods

animal(id) click to toggle source
# File lib/petfinder/api.rb, line 13
def animal(id)
  Mash.new(request("animals/#{id}")['animal'])
end
animals(params = {}) click to toggle source
# File lib/petfinder/api.rb, line 4
def animals(params = {})
  response = request('animals', params)

  animals = response['animals'].map { |animal| Mash.new(animal) }
  pagination = Mash.new(response['pagination'])

  [animals, pagination]
end
breeds(type) click to toggle source
# File lib/petfinder/api.rb, line 25
def breeds(type)
  request("types/#{type}/breeds")['breeds'].map { |breed| Mash.new(breed) }
end
organization(id) click to toggle source
# File lib/petfinder/api.rb, line 38
def organization(id)
  Mash.new(request("organizations/#{id}")['organization'])
end
organizations(params = {}) click to toggle source
# File lib/petfinder/api.rb, line 29
def organizations(params = {})
  response = request('organizations', params)

  organizations = response['organizations'].map { |org| Mash.new(org) }
  pagination = Mash.new(response['pagination'])

  [organizations, pagination]
end
type(type) click to toggle source
# File lib/petfinder/api.rb, line 21
def type(type)
  Mash.new(request("types/#{type}")['type'])
end
types() click to toggle source
# File lib/petfinder/api.rb, line 17
def types
  request("types")['types'].map { |type| Mash.new(type) }
end