lighthouse-ruby 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 28d040348d4eea07651f7e41646eacbc6ee7360403dbff011982fa9928551549
4
- data.tar.gz: 55cfd11b187f358bd27945303886728054f1807bba1cc8911a93913dbe1e4f13
3
+ metadata.gz: 18470aaf1e02625cc7623dd4eec4406d54a748d88e0c8053694aa0fec0b64a13
4
+ data.tar.gz: 2a85003187142f768f4a6b18918f92b0812a88737e74c4bb64546e0e171cd885
5
5
  SHA512:
6
- metadata.gz: 3a03cc1321324f4f6ea5d32f944cacd8a76d6b175c6b4b8a243290c7be3fee2f7c5902199f1b0f9baaa19a94c54a721e428c1f068cfa7ccf02ac06c7bcfafaca
7
- data.tar.gz: fbad2ebd35847208f5ac44ef4e8cad83de214ca7e5341fca220bfb38321ffc6ef5ce39f9452e910ad70d8440eed202904777898677472fee75829effa69283c3
6
+ metadata.gz: 7efe4a8608436d3af69640b20ff5d6f5e0b0a64877db23af17e2589d4a45dafdcdfb3b4c4e8efd6c8b14c99a89c513e9fba29fdfef960eabf5952b262f14386c
7
+ data.tar.gz: 0b2332ac37de52f263aa4ae8d66ee4945263092da6182a3abe187160ce1bf353f2fcaa3d2e068fd3219782bcb4eb3ff4d34338b0692ba13a0ca4c9892535681f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lighthouse-ruby (0.1.2)
4
+ lighthouse-ruby (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -5,6 +5,8 @@ module Lighthouse
5
5
  module Ruby
6
6
  class Builder
7
7
 
8
+ attr_reader :response
9
+
8
10
  def initialize(url)
9
11
  @url = url
10
12
  @runner = Lighthouse::Preferences.runner
@@ -16,10 +18,11 @@ module Lighthouse
16
18
 
17
19
  def execute
18
20
  @response = @runner.call("#{@cli} #{options}")
21
+ get_test_scores(parsed_response)
19
22
  end
20
23
 
21
- def test_scores
22
- get_test_scores(@response)
24
+ def parsed_response
25
+ @parsed_response = JSON.parse(@response)
23
26
  end
24
27
 
25
28
  private
@@ -35,13 +38,12 @@ module Lighthouse
35
38
  end
36
39
 
37
40
  def get_test_scores(response)
38
- json_result = JSON.parse(response)
39
41
  @test_scores = { url: @url}
40
42
  @test_scores[:run_time] = Time.now
41
- @test_scores[:performance] = json_result.dig("categories", "performance" , "score") * 100
42
- @test_scores[:accessibility] = json_result.dig("categories", "accessibility" , "score") * 100
43
- @test_scores[:best_practices] = json_result.dig("categories", "best-practices" , "score") * 100
44
- @test_scores[:seo] = json_result.dig("categories", "seo" , "score") * 100
43
+ @test_scores[:performance] = response.dig("categories", "performance" , "score") * 100
44
+ @test_scores[:accessibility] = response.dig("categories", "accessibility" , "score") * 100
45
+ @test_scores[:best_practices] = response.dig("categories", "best-practices" , "score") * 100
46
+ @test_scores[:seo] = response.dig("categories", "seo" , "score") * 100
45
47
  @test_scores
46
48
  end
47
49
 
@@ -1,5 +1,5 @@
1
1
  module Lighthouse
2
2
  module Ruby
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lighthouse-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Budi Sugianto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler