Sha256: 2bb186fb03ffa922f0724da1ce17a96aabdd55c7cdc3eb0e8dc8375d7e4cb849

Contents?: true

Size: 640 Bytes

Versions: 5

Compression:

Stored size: 640 Bytes

Contents

module Petfinder
  class Shelter
    extend JsonMapper
    json_attributes "country", "name", "phone", "state", "address", "email", "city", "zip", "id"

    def initialize attributes
      @attributes = attributes
    end

    def get_pets
      get_shelter_pets = API_BASE_URI + "shelter.getPets?key=#{Client.new.api_key}&id=#{id}&output=basic&format=json"
      response = open(get_shelter_pets).read
      res = []
      if resp = JSON.parse(response)
        resp["petfinder"]["pets"]["pet"].each do |pet|
          # res << Petfinder::Pet.new(pet[1][0])
          res << Pet.new(pet)
        end
      end
      res
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
petfinder-wrap-1.0.3 lib/petfinder/shelter.rb
petfinder-wrap-1.0.2.1 lib/petfinder/shelter.rb
petfinder-wrap-1.0.2 lib/petfinder/shelter.rb
petfinder-wrap-1.0.1.1 lib/petfinder/shelter.rb
petfinder-wrap-1.0.0 lib/petfinder/shelter.rb