Class: Scraper

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

Constant Summary collapse

@@pokemons =
HTTParty.get(url + "/pokemon?offset=0&limit=964").parsed_response["results"]
@@moves =
HTTParty.get(url + "/move?offset=0&limit=746").parsed_response["results"]

Class Method Summary collapse

Class Method Details

.get_move_by_name(name) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/scraper.rb', line 21

def self.get_move_by_name(name)
  @@moves.each{|move|
    if move["name"] == name
      return HTTParty.get(move["url"])
    end
  }
end

.get_pokemon_by_name(name) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/scraper.rb', line 9

def self.get_pokemon_by_name(name)
  @@pokemons.each{|pokemon|
    if pokemon["name"] == name
      return HTTParty.get(pokemon["url"])
    end
  }
end

.movesObject



29
30
31
# File 'lib/scraper.rb', line 29

def self.moves
  @@moves.collect{|move| move["name"]}
end

.pokemonsObject



17
18
19
# File 'lib/scraper.rb', line 17

def self.pokemons
  @@pokemons.collect{|pokemon| pokemon["name"]}
end