Class: PetfinderV2::Serializers::AnimalType

Inherits:
Object
  • Object
show all
Defined in:
lib/petfinder_V2/serializers/animal_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ AnimalType



10
11
12
13
14
15
16
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 10

def initialize(data)
  @name = data['name']
  @colors = data['colors']
  @genders = data['genders']
  @link = data['_links']['self']['href']
  @breeds_link = data['_links']['breeds']['href']
end

Instance Attribute Details

Returns the value of attribute breeds_link.



4
5
6
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 4

def breeds_link
  @breeds_link
end

#colorsObject (readonly)

Returns the value of attribute colors.



4
5
6
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 4

def colors
  @colors
end

#gendersObject (readonly)

Returns the value of attribute genders.



4
5
6
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 4

def genders
  @genders
end

Returns the value of attribute link.



4
5
6
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 4

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 4

def name
  @name
end

Class Method Details

.process_collection(data) ⇒ Object



6
7
8
# File 'lib/petfinder_V2/serializers/animal_type.rb', line 6

def self.process_collection(data)
  data['types'].map { |d| new(d) }
end