Class: PetFinder::Shelter
- Inherits:
-
Object
- Object
- PetFinder::Shelter
- Defined in:
- lib/pet_finder/shelter.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#address2 ⇒ Object
Returns the value of attribute address2.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#fax ⇒ Object
Returns the value of attribute fax.
-
#id ⇒ Object
Returns the value of attribute id.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
-
#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.
-
#initialize(atts = {}) ⇒ Shelter
constructor
Instance Methods.
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
#address1 ⇒ Object
Returns the value of attribute address1.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def address1 @address1 end |
#address2 ⇒ Object
Returns the value of attribute address2.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def address2 @address2 end |
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def email @email end |
#fax ⇒ Object
Returns the value of attribute fax.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def fax @fax end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def id @id end |
#latitude ⇒ Object
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def longitude @longitude end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def phone @phone end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/pet_finder/shelter.rb', line 4 def state @state end |
#zip ⇒ Object
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 |