Class: MiracleGrow::Plant

Inherits:
Object
  • Object
show all
Defined in:
lib/miracle_grow/plant.rb

Class Method Summary collapse

Class Method Details

.all_plant_namesObject



11
12
13
# File 'lib/miracle_grow/plant.rb', line 11

def all_plant_names
  all_the_plants.map {|plant| plant["name"] }
end

.all_the_plantsObject



6
7
8
9
# File 'lib/miracle_grow/plant.rb', line 6

def all_the_plants
  response = Faraday.get("#{ENV["HOST"]}/api/v1/plants")
  JSON.parse(response.body)
end