23 lines
436 B
Ruby
23 lines
436 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'httparty'
|
|
|
|
module FO::Client
|
|
class PokeAPI
|
|
include HTTParty
|
|
base_uri 'pokeapi.co'
|
|
|
|
def species(id = nil)
|
|
if id.nil?
|
|
self.class.get('/api/v2/pokemon-species', {query: {offset: 0, limit: 100_000}})
|
|
else
|
|
self.class.get("/api/v2/pokemon-species/#{id}/")
|
|
end
|
|
end
|
|
|
|
def pokemon(id)
|
|
self.class.get("/api/v2/pokemon/#{id}/")
|
|
end
|
|
end
|
|
end
|