Class: Vng::Breed
Overview
Provides methods to interact with Vonigo breeds.
Constant Summary collapse
- PATH =
'/api/v1/resources/breeds/'
Instance Attribute Summary collapse
-
#high_weight ⇒ Object
readonly
Returns the value of attribute high_weight.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#low_weight ⇒ Object
readonly
Returns the value of attribute low_weight.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#option_id ⇒ Object
readonly
Returns the value of attribute option_id.
-
#species ⇒ Object
readonly
Returns the value of attribute species.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, species:, option_id:, low_weight:, high_weight:) ⇒ Breed
constructor
A new instance of Breed.
Constructor Details
#initialize(id:, name:, species:, option_id:, low_weight:, high_weight:) ⇒ Breed
Returns a new instance of Breed.
10 11 12 13 14 15 16 17 |
# File 'lib/vng/breed.rb', line 10 def initialize(id:, name:, species:, option_id:, low_weight:, high_weight:) @id = id @name = name @species = species @option_id = option_id @low_weight = low_weight @high_weight = high_weight end |
Instance Attribute Details
#high_weight ⇒ Object (readonly)
Returns the value of attribute high_weight.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def high_weight @high_weight end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def id @id end |
#low_weight ⇒ Object (readonly)
Returns the value of attribute low_weight.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def low_weight @low_weight end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def name @name end |
#option_id ⇒ Object (readonly)
Returns the value of attribute option_id.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def option_id @option_id end |
#species ⇒ Object (readonly)
Returns the value of attribute species.
8 9 10 |
# File 'lib/vng/breed.rb', line 8 def species @species end |
Class Method Details
.all ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vng/breed.rb', line 19 def self.all data = request path: PATH data['Breeds'].map do |breed| id = breed['breedID'] name = breed['breed'] species = breed['species'] option_id = breed['optionID'] low_weight = breed['breedLowWeight'] high_weight = breed['breedHighWeight'] new id: id, name: name, species: species, option_id: option_id, low_weight: low_weight, high_weight: high_weight end end |