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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f869412732c788fe696a4e02cc9a1027c095196017e5381a15c2abb8dfc5e8c3
4
- data.tar.gz: 62f4d9767acfd5021c6d1362f8a29af4d712251e5989f9a8761093a99f0a4661
3
+ metadata.gz: b81066b3f5b19119e404b9696bfa58ba315b028020802569189e1588f488d50e
4
+ data.tar.gz: 8ed604feb067e3970deb930109af1091537ea27b8d5f73cd89731ea82bc30112
5
5
  SHA512:
6
- metadata.gz: 8a24a8c5a7b99ef2a778f8b3977ed50c6d3539a490dafaedc9acc014d2dee509f28804c6e0f8b700e89e21dbc7a7efba05e44e716d5138ed82d98955bb42ecc1
7
- data.tar.gz: 58caa00b251cfc6d423ce8f338e926a54144293f72bdaef246724e4436efaf4586dc73287fd978def8aa23e929954cff1dcded9a0b71448de93a94bc243bc84d
6
+ metadata.gz: 63c085ab185049d6cfd8e4e154975f58fded3b9846ee46d902f2c932a8cffe47d372299818c58ae8235794df7ed6e84c4ca46bb3c2de7582c75a1a0a3a412009
7
+ data.tar.gz: fcdf9914a43e42fd46624986f02ad2d58899dc0788db49a4aa4bd29f24ba1bc7e913efd30ac6cef97649f59dad4ab24347d8f9538968b840302bc1a12ad9c384
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.0] - 2022-11-29
4
+
5
+ - Adds release mechanism
6
+
7
+ ## [0.3.0] - 2022-11-29
8
+
9
+ - Refactors classes names and namespaces
10
+
3
11
  ## [0.2.0] - 2022-11-29
4
12
 
5
13
  - Refactors resources usage
data/lib/eol_rb/cycle.rb CHANGED
@@ -3,27 +3,25 @@
3
3
  require "json"
4
4
 
5
5
  module EOL
6
- class Client
7
- # Class for retrieving information about Cycles
8
- class Cycle
9
- class NotFoundError < StandardError; end
6
+ # Class for retrieving information about Cycles
7
+ class Cycle
8
+ class NotFoundError < StandardError; end
10
9
 
11
- class << self
12
- def get(client, product, cycle)
13
- res = client.get("/#{product}/#{cycle}.json")
10
+ class << self
11
+ def get(client, product, cycle)
12
+ res = client.get("/#{product}/#{cycle}.json")
14
13
 
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}"
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
- JSON.parse(res.body)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EOL
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
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/product"
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
- Client::Product.all(@client)
35
+ Products.all(@client)
36
36
  end
37
37
 
38
38
  def of(product, cycle: "")
39
39
  if cycle.empty?
40
- Client::Product.get(@client, product)
40
+ Products.get(@client, product)
41
41
  else
42
- Client::Cycle.get(@client, product, cycle)
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.2.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/product.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:
@@ -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