pokeapi 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40816f1238320795f9a1fd2d3fd04cabfb90dab8
4
- data.tar.gz: 7ab4819c43275bdc5938052f46340f292ee021f0
3
+ metadata.gz: 8cd982ed2498d562b1b7e92ff43a36362b72e308
4
+ data.tar.gz: d571ed59b5cc8583f00dc87bb25817113e1744b1
5
5
  SHA512:
6
- metadata.gz: 329e351b4541d4b15e0454c43d345a27013853a851ec9d3965d268b24d4c5d46bd02a0a49a8172d3160a7c1b9e5ad5cb06f26756c90ee8a47e1d17c1dc52a78f
7
- data.tar.gz: 3a266eda7b2a66be70803af8995109bb92b169ab2f3e11e1f00976189803a7c8fe027a0efcb6a326e7d96d1e7b79b3d392082f1cdc21eb658f5f9a182b3044e6
6
+ metadata.gz: 7a28812b8de7cc54b262e6f160b0eeddc8242dbb5785fbadd4219b894d816d70e1c10b9b943929ef4c7fb87a5c0df6e7397fe231434f4aba5cc271c466090c23
7
+ data.tar.gz: a1ae32f4ac839b37db1e69b552a5c0e103639b0bf8f8bc5018cf0ca92bcef6ca0354e63c317e8b9edc1b1d777e9ddafecfb0e6986ceef2376ba117cbe6eecb30
@@ -3,6 +3,7 @@ require "http"
3
3
  module PokeAPI
4
4
  class Requester
5
5
  NotFoundError = Class.new(StandardError)
6
+ TimeoutError = Class.new(StandardError)
6
7
 
7
8
  API_ENDPOINT = "https://pokeapi.co/api/v2/"
8
9
  POKEMON_ENDPOINT = "pokemon/"
@@ -16,6 +17,7 @@ module PokeAPI
16
17
  def get(path)
17
18
  http = HTTP.get("#{API_ENDPOINT}#{path}/")
18
19
  fail NotFoundError if http.code == 404
20
+ fail TimeoutError if http.code == 504
19
21
  JSON.parse(http.to_s, symbolize_names: true)
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module PokeAPI
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pokeapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Ortega