network_profile 0.3.1 → 0.3.3

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: c7f823168ee25fc5a0401b78415694abf2e3b395a48044053a897ec26d3448cc
4
- data.tar.gz: 23f9fd4cc0444d44d3ee4a951943ea91e4ddb05f1e41e5253863e6e7ffd43157
3
+ metadata.gz: 5bc67189b8111e863610023b3fc4540bee618ec5ceb06d1f2a2b07ca4739d289
4
+ data.tar.gz: 3c1df1bd3d11975a1bb71b78a12c71626b34fc2e120cc2de0e444ef731f19906
5
5
  SHA512:
6
- metadata.gz: a9b814867cbf9bcf2c8adecc62c50ea18b09cb265e69882cfaba68e9cfd55bac6d7b25e8e1499f9ca5c44b2c370c1447c907d0edeccfb091bd6c0048fc2fa118
7
- data.tar.gz: fb6416ab2c6adf5fccf9feeacd0d171b5ed9df6a554c1349c83356768447d87cd2a1d025c3e5f9e8ec1fef90b4cae12f683abf847b73527ce9d8b9b0a01fa0d2
6
+ metadata.gz: eb4bea5ae9e060dfeb78003044e33bdc08121af2ffaac5761e11cff30c3e98b3b02f35f28fecdf4e47da87adb65a14dbe7a5ed4c44a787209644891c03e7c0db
7
+ data.tar.gz: 9ee7441b481a0e4052e641dc496ea5263665a0b888154e086f39560b788be861bc8528e6e0f4e54fcc5d8e10abbb0ae17d1f36fe3c365659d959ccde5e205309
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_profile (0.3.1)
4
+ network_profile (0.3.3)
5
5
  activesupport (>= 5.0.0)
6
6
  nokogiri
7
7
  rdf-microdata
@@ -113,4 +113,4 @@ DEPENDENCIES
113
113
  webmock
114
114
 
115
115
  BUNDLED WITH
116
- 2.2.16
116
+ 2.6.9
@@ -89,7 +89,7 @@ module NetworkProfile
89
89
  end
90
90
 
91
91
  def doc
92
- @doc ||= Nokogiri.parse(response.body)
92
+ @doc ||= Nokogiri.parse(response.body, nil, 'utf-8')
93
93
  end
94
94
 
95
95
  def json_ld
@@ -18,6 +18,10 @@ module NetworkProfile::GithubGraphql
18
18
  @json ||= query!(query)
19
19
  end
20
20
 
21
+ def parse_date(value)
22
+ Time.parse(value).to_date if value
23
+ end
24
+
21
25
  def doc
22
26
  raise NotImplementedError
23
27
  end
@@ -10,7 +10,7 @@ module NetworkProfile
10
10
  end
11
11
 
12
12
  def query
13
- username = @link[%r{github.com/([^/]+)}, 1]
13
+ username = @link[%r{github.com/([^/?#]+)}, 1]
14
14
  <<~DOC
15
15
  query {
16
16
  organization(login:"#{username}") {
@@ -63,6 +63,10 @@ module NetworkProfile
63
63
  json.dig('data', 'organization') || json.dig('data', 'user')
64
64
  end
65
65
 
66
+ def data
67
+ super if profile_data
68
+ end
69
+
66
70
  def title
67
71
  profile_data['name']
68
72
  end
@@ -86,8 +90,8 @@ module NetworkProfile
86
90
  n = i['node']
87
91
  { name: n['nameWithOwner'],
88
92
  url: n['url'],
89
- created: Time.parse(n['createdAt']).to_date,
90
- updated: Time.parse(n['updatedAt']).to_date,
93
+ created: parse_date(n['createdAt']),
94
+ updated: parse_date(n['updatedAt']),
91
95
  language: n.dig('primaryLanguage', 'name'),
92
96
  stars: n['stargazers']['totalCount'],
93
97
  watchers: n['watchers']['totalCount'] }
@@ -55,6 +55,11 @@ module NetworkProfile
55
55
  DOC
56
56
  end
57
57
 
58
+ # unknown repos come back as repository: null
59
+ def data
60
+ super if json.dig('data', 'repository')
61
+ end
62
+
58
63
  def title
59
64
  json.dig('data', 'repository', 'nameWithOwner')
60
65
  end
@@ -64,7 +69,7 @@ module NetworkProfile
64
69
  end
65
70
 
66
71
  def last_commit
67
- Time.parse(json.dig('data', 'repository', 'defaultBranchRef', 'target', 'committedDate')).to_date
72
+ parse_date(json.dig('data', 'repository', 'defaultBranchRef', 'target', 'committedDate'))
68
73
  end
69
74
 
70
75
  def image
@@ -79,7 +84,7 @@ module NetworkProfile
79
84
  issue_count: json.dig('data', 'repository', 'issues', 'totalCount'),
80
85
  commits: json.dig('data', 'repository', 'defaultBranchRef', 'target', 'history', 'totalCount'),
81
86
  license: json.dig('data', 'repository', 'licenseInfo', 'name'),
82
- created: Time.parse(json.dig('data', 'repository', 'createdAt')).to_date,
87
+ created: parse_date(json.dig('data', 'repository', 'createdAt')),
83
88
  language_bytes: json.dig('data', 'repository', 'languages', 'edges')&.map { |l| [l.dig('node', 'name'), l['size']] }&.sort_by { |_a, b| -b },
84
89
  last_commit: last_commit
85
90
  }
@@ -1,3 +1,3 @@
1
1
  module NetworkProfile
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_profile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-06-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: typhoeus
@@ -125,7 +124,6 @@ licenses:
125
124
  metadata:
126
125
  homepage_uri: https://github.com/pludoni/network_profile
127
126
  source_code_uri: https://github.com/pludoni/network_profile
128
- post_install_message:
129
127
  rdoc_options: []
130
128
  require_paths:
131
129
  - lib
@@ -140,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
138
  - !ruby/object:Gem::Version
141
139
  version: '0'
142
140
  requirements: []
143
- rubygems_version: 3.2.15
144
- signing_key:
141
+ rubygems_version: 3.6.9
145
142
  specification_version: 4
146
143
  summary: Extract profile metadata from various social-media-profiles
147
144
  test_files: []