Module: Pokemones

Includes:
HTTParty
Defined in:
lib/pokemones.rb,
lib/pokemones/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.find_by_id(id) ⇒ Object

up to 400



12
13
14
15
# File 'lib/pokemones.rb', line 12

def self.find_by_id(id)
	result = get("/api/v2/pokemon/#{id}").parsed_response["name"]
	generate_json(result)
end

.find_place(id) ⇒ Object

up to 17



18
19
20
21
# File 'lib/pokemones.rb', line 18

def self.find_place(id)
 result = get("/api/v2/encounter-method/#{id}").parsed_response["names"][1]["name"]
 generate_json(result)
end

.random_encounterObject



23
24
25
# File 'lib/pokemones.rb', line 23

def self.random_encounter
 puts "You have found #{find_by_id(rand(1..400))}, #{find_place(rand(1..17))}"
end