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



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

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

.all_the_plantsObject



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

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