eol_rb 0.1.0 → 0.2.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 +4 -0
- data/lib/eol_rb/cycle.rb +13 -2
- data/lib/eol_rb/product.rb +4 -2
- data/lib/eol_rb/version.rb +1 -1
- data/lib/eol_rb.rb +6 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f869412732c788fe696a4e02cc9a1027c095196017e5381a15c2abb8dfc5e8c3
|
4
|
+
data.tar.gz: 62f4d9767acfd5021c6d1362f8a29af4d712251e5989f9a8761093a99f0a4661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a24a8c5a7b99ef2a778f8b3977ed50c6d3539a490dafaedc9acc014d2dee509f28804c6e0f8b700e89e21dbc7a7efba05e44e716d5138ed82d98955bb42ecc1
|
7
|
+
data.tar.gz: 58caa00b251cfc6d423ce8f338e926a54144293f72bdaef246724e4436efaf4586dc73287fd978def8aa23e929954cff1dcded9a0b71448de93a94bc243bc84d
|
data/CHANGELOG.md
CHANGED
data/lib/eol_rb/cycle.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "json"
|
4
|
+
|
3
5
|
module EOL
|
4
6
|
class Client
|
5
7
|
# Class for retrieving information about Cycles
|
@@ -9,9 +11,18 @@ module EOL
|
|
9
11
|
class << self
|
10
12
|
def get(client, product, cycle)
|
11
13
|
res = client.get("/#{product}/#{cycle}.json")
|
12
|
-
raise NotFoundError, "Cycle #{cycle} could not be found under product #{product}" if res.status == 404
|
13
14
|
|
14
|
-
res
|
15
|
+
if res.status == 404
|
16
|
+
available_cycles = []
|
17
|
+
Product.get(client, product).each do |p|
|
18
|
+
available_cycles.push(p["cycle"])
|
19
|
+
end
|
20
|
+
|
21
|
+
raise NotFoundError,
|
22
|
+
"Cycle #{cycle} could not be found under product #{product}. Try any of #{available_cycles.inspect}"
|
23
|
+
end
|
24
|
+
|
25
|
+
JSON.parse(res.body)
|
15
26
|
end
|
16
27
|
end
|
17
28
|
end
|
data/lib/eol_rb/product.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "json"
|
4
|
+
|
3
5
|
module EOL
|
4
6
|
class Client
|
5
7
|
# Class for retrieving information about Products
|
@@ -8,14 +10,14 @@ module EOL
|
|
8
10
|
|
9
11
|
class << self
|
10
12
|
def all(client)
|
11
|
-
client.get("/all.json")
|
13
|
+
JSON.parse(client.get("/all.json").body)
|
12
14
|
end
|
13
15
|
|
14
16
|
def get(client, product)
|
15
17
|
res = client.get("/#{product}.json")
|
16
18
|
raise NotFoundError, "Product #{product} could not be found in the API" if res.status == 404
|
17
19
|
|
18
|
-
res
|
20
|
+
JSON.parse(res.body)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/eol_rb/version.rb
CHANGED
data/lib/eol_rb.rb
CHANGED
@@ -32,19 +32,15 @@ module EOL
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def products
|
35
|
-
|
36
|
-
|
37
|
-
JSON.parse(res.body)
|
35
|
+
Client::Product.all(@client)
|
38
36
|
end
|
39
37
|
|
40
38
|
def of(product, cycle: "")
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
JSON.parse(res.body)
|
39
|
+
if cycle.empty?
|
40
|
+
Client::Product.get(@client, product)
|
41
|
+
else
|
42
|
+
Client::Cycle.get(@client, product, cycle)
|
43
|
+
end
|
48
44
|
end
|
49
45
|
end
|
50
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eol_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Colomina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|