Class: PetFinder::Shelter

Inherits:
Object
  • Object
show all
Defined in:
lib/pet_finder/shelter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(atts = {}) ⇒ Shelter

Instance Methods



8
9
10
11
12
# File 'lib/pet_finder/shelter.rb', line 8

def initialize(atts={})
  atts.each do |key, value|
    self.send("#{key}=", value) if respond_to?(key)
  end
end

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def address2
  @address2
end

#cityObject

Returns the value of attribute city.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def city
  @city
end

#countryObject

Returns the value of attribute country.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def country
  @country
end

#emailObject

Returns the value of attribute email.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def email
  @email
end

#faxObject

Returns the value of attribute fax.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def fax
  @fax
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def id
  @id
end

#latitudeObject

Returns the value of attribute latitude.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def longitude
  @longitude
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def phone
  @phone
end

#stateObject

Returns the value of attribute state.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def state
  @state
end

#zipObject

Returns the value of attribute zip.



4
5
6
# File 'lib/pet_finder/shelter.rb', line 4

def zip
  @zip
end

Instance Method Details

#get_pets(opts = {}) ⇒ Object

OPTIONS: status character optional (default=A, public may only list adoptable pets) A=adoptable, H=hold, P=pending, X=adopted/removed offset integer optional offset into the result set (default is 0) count integer optional how many records to return for this particular API call (default is 25) output string optional (default=basic) How much of the pet record to return: id, basic (no description), full



19
20
21
22
23
24
25
26
# File 'lib/pet_finder/shelter.rb', line 19

def get_pets(opts={})
  query = {
    :id => id
  }.merge(opts)
  res = Client.get('/shelter.getPets', :query => query).parsed_response['petfinder']['pets']['pet']
  res = [res] unless res.is_a?(Array)
  res.map{|p| Pet.new(p)} unless res.nil? || res.empty?
end