eol_rb 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/eol_rb/cycle.rb +14 -16
- data/lib/eol_rb/products.rb +23 -0
- data/lib/eol_rb/version.rb +1 -1
- data/lib/eol_rb.rb +4 -4
- metadata +2 -2
- data/lib/eol_rb/product.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b81066b3f5b19119e404b9696bfa58ba315b028020802569189e1588f488d50e
|
4
|
+
data.tar.gz: 8ed604feb067e3970deb930109af1091537ea27b8d5f73cd89731ea82bc30112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c085ab185049d6cfd8e4e154975f58fded3b9846ee46d902f2c932a8cffe47d372299818c58ae8235794df7ed6e84c4ca46bb3c2de7582c75a1a0a3a412009
|
7
|
+
data.tar.gz: fcdf9914a43e42fd46624986f02ad2d58899dc0788db49a4aa4bd29f24ba1bc7e913efd30ac6cef97649f59dad4ab24347d8f9538968b840302bc1a12ad9c384
|
data/CHANGELOG.md
CHANGED
data/lib/eol_rb/cycle.rb
CHANGED
@@ -3,27 +3,25 @@
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
module EOL
|
6
|
-
|
7
|
-
|
8
|
-
class
|
9
|
-
class NotFoundError < StandardError; end
|
6
|
+
# Class for retrieving information about Cycles
|
7
|
+
class Cycle
|
8
|
+
class NotFoundError < StandardError; end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
class << self
|
11
|
+
def get(client, product, cycle)
|
12
|
+
res = client.get("/#{product}/#{cycle}.json")
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
raise NotFoundError,
|
22
|
-
"Cycle #{cycle} could not be found under product #{product}. Try any of #{available_cycles.inspect}"
|
14
|
+
if res.status == 404
|
15
|
+
available_cycles = []
|
16
|
+
Products.get(client, product).each do |p|
|
17
|
+
available_cycles.push(p["cycle"])
|
23
18
|
end
|
24
19
|
|
25
|
-
|
20
|
+
raise NotFoundError,
|
21
|
+
"Cycle #{cycle} could not be found under product #{product}. Try any of #{available_cycles.inspect}"
|
26
22
|
end
|
23
|
+
|
24
|
+
JSON.parse(res.body)
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module EOL
|
6
|
+
# Class for retrieving information about Products
|
7
|
+
class Products
|
8
|
+
class NotFoundError < StandardError; end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def all(client)
|
12
|
+
JSON.parse(client.get("/all.json").body)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get(client, product)
|
16
|
+
res = client.get("/#{product}.json")
|
17
|
+
raise NotFoundError, "Product #{product} could not be found in the API" if res.status == 404
|
18
|
+
|
19
|
+
JSON.parse(res.body)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/eol_rb/version.rb
CHANGED
data/lib/eol_rb.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "eol_rb/client"
|
4
4
|
require_relative "eol_rb/configuration"
|
5
|
-
require_relative "eol_rb/
|
5
|
+
require_relative "eol_rb/products"
|
6
6
|
require_relative "eol_rb/cycle"
|
7
7
|
|
8
8
|
# Root module for EndOfLife
|
@@ -32,14 +32,14 @@ module EOL
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def products
|
35
|
-
|
35
|
+
Products.all(@client)
|
36
36
|
end
|
37
37
|
|
38
38
|
def of(product, cycle: "")
|
39
39
|
if cycle.empty?
|
40
|
-
|
40
|
+
Products.get(@client, product)
|
41
41
|
else
|
42
|
-
|
42
|
+
Cycle.get(@client, product, cycle)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eol_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Colomina
|
@@ -80,7 +80,7 @@ files:
|
|
80
80
|
- lib/eol_rb/client.rb
|
81
81
|
- lib/eol_rb/configuration.rb
|
82
82
|
- lib/eol_rb/cycle.rb
|
83
|
-
- lib/eol_rb/
|
83
|
+
- lib/eol_rb/products.rb
|
84
84
|
- lib/eol_rb/version.rb
|
85
85
|
homepage: https://github.com/Coolomina/eol-rb
|
86
86
|
licenses:
|
data/lib/eol_rb/product.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "json"
|
4
|
-
|
5
|
-
module EOL
|
6
|
-
class Client
|
7
|
-
# Class for retrieving information about Products
|
8
|
-
class Product
|
9
|
-
class NotFoundError < StandardError; end
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def all(client)
|
13
|
-
JSON.parse(client.get("/all.json").body)
|
14
|
-
end
|
15
|
-
|
16
|
-
def get(client, product)
|
17
|
-
res = client.get("/#{product}.json")
|
18
|
-
raise NotFoundError, "Product #{product} could not be found in the API" if res.status == 404
|
19
|
-
|
20
|
-
JSON.parse(res.body)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|