Class: BlueCrossPets::Pet

Inherits:
Object
  • Object
show all
Defined in:
lib/blue_cross_pets/pet.rb

Direct Known Subclasses

Cat, Dog

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ageObject

Returns the value of attribute age.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def age
  @age
end

#availabilityObject

Returns the value of attribute availability.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def availability
  @availability
end

#bioObject

Returns the value of attribute bio.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def bio
  @bio
end

#breedObject

Returns the value of attribute breed.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def breed
  @breed
end

#breed_and_colourObject

Returns the value of attribute breed_and_colour.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def breed_and_colour
  @breed_and_colour
end

#can_live_withObject

Returns the value of attribute can_live_with.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def can_live_with
  @can_live_with
end

#genderObject

Returns the value of attribute gender.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def gender
  @gender
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def name
  @name
end

#profile_urlObject

Returns the value of attribute profile_url.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def profile_url
  @profile_url
end

#referenceObject

Returns the value of attribute reference.



3
4
5
# File 'lib/blue_cross_pets/pet.rb', line 3

def reference
  @reference
end

Class Method Details

.create_from_index(pet_array) ⇒ Object



5
6
7
8
9
# File 'lib/blue_cross_pets/pet.rb', line 5

def self.create_from_index(pet_array)
  pet_array.each do |pet_hash|
    self.new(pet_hash)
  end
end

Instance Method Details

#add_attributes(attribute_hash) ⇒ Object



18
19
20
21
22
23
# File 'lib/blue_cross_pets/pet.rb', line 18

def add_attributes(attribute_hash)
  attribute_hash.each do |attribute, value|
    self.send("#{attribute}=".to_sym, value)
  end
  self
end

#get_more_infoObject



11
12
13
14
15
16
# File 'lib/blue_cross_pets/pet.rb', line 11

def get_more_info
  if !self.reference
    attribute_hash = BlueCrossPets::Scraper.new.scrape_profile(self.profile_url)
    self.add_attributes(attribute_hash)
  end 
end