network_profile 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaa6afbf057402529a5e99c22ff61b98b1af6bcb8ca03cd869ddf03ba0e6893f
4
- data.tar.gz: 1cd9b2fe99baba7cbc8f6774d8cd981bffa7e6860349df584d7041e9bb23aeb9
3
+ metadata.gz: 7617b43af0544fe036d6891c054523c2737976a4affd5149dff99b9ffec79d31
4
+ data.tar.gz: d33e58df2c9fb4af37e3867e421cb7fdef3a054f234a2d86fa196d9b61bed831
5
5
  SHA512:
6
- metadata.gz: 93002910a6cb60f7ca0434b2231a583e440e2d4bc9a4e23e3721d021ee6af70acf959f0b012932f65dc175e5e209edba490add5780137d9e6afb9af3ebe6fa7b
7
- data.tar.gz: 649cea60a5a341322cb3927aac5cd35b59bf374632694d9443c6dc37cfacf00a4afefe42336e350dce742d06c3ee81a3512eaf5407a82e31f10af77c5e86d97d
6
+ metadata.gz: 6f9b80fc70a71c2f16487c6c4bb4e7e7d25dcd94cd723b020b18d8317c61906f730da76d0cdda1ffac01a253669dc7ade1116b05da2508eb367c691a4588636c
7
+ data.tar.gz: eaf8d8b3dbf76c8d0f5e0f9c297824ad13d01b6946e2d8f1455f7184cb78ad9230683b83d9812ae814a15391b98b3896485d17a37da7dd84877a9e921f14fe25
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_profile (0.1.0)
4
+ network_profile (0.2.0)
5
5
  activesupport (>= 5.0.0)
6
6
  nokogiri
7
7
  rdf-microdata
@@ -9,9 +9,8 @@ module NetworkProfile
9
9
  class DefaultProfile
10
10
  include ActiveSupport::DescendantsTracker
11
11
 
12
- cattr_accessor :mdi_icon
13
-
14
12
  class << self
13
+ attr_accessor :mdi_icon
15
14
  attr_accessor :headers
16
15
  end
17
16
 
@@ -62,7 +61,7 @@ module NetworkProfile
62
61
 
63
62
  def data
64
63
  {
65
- site_icon: mdi_icon,
64
+ site_icon: self.class.mdi_icon,
66
65
  link: @link,
67
66
  title: title,
68
67
  text: text,
@@ -86,7 +85,15 @@ module NetworkProfile
86
85
  end
87
86
 
88
87
  def json_ld
89
- @json_ld ||= JSON.parse(doc.search('script[type*=ld]').first.text)
88
+ @json_ld ||=
89
+ begin
90
+ ld = doc.search('script[type*=ld]').first&.text
91
+ if ld
92
+ JSON.parse(ld)
93
+ else
94
+ {}
95
+ end
96
+ end
90
97
  end
91
98
 
92
99
  def rdf
@@ -18,7 +18,7 @@ module NetworkProfile
18
18
  image: nil,
19
19
  type: self.class.name.underscore.split('/').last,
20
20
  link: @link,
21
- site_icon: mdi_icon,
21
+ site_icon: self.class.mdi_icon,
22
22
  }
23
23
  end
24
24
  end
@@ -33,7 +33,10 @@ module NetworkProfile
33
33
  end
34
34
 
35
35
  def extra_data
36
- items, reads, citations = doc.at(".profile-content-item .nova-c-card").
36
+ card = doc.at(".profile-content-item .nova-c-card")
37
+ return {} unless card
38
+
39
+ items, reads, citations = card.
37
40
  search(".nova-o-grid__column").
38
41
  map { |col| col.search('.nova-e-text').map(&:text) }.
39
42
  map(&:first).map { |i| i.gsub(',', '').to_i }
@@ -1,3 +1,3 @@
1
1
  module NetworkProfile
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_profile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-22 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus