github-lister-core 0.1.1 → 0.1.2

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: f19f596b99e6b9fa7bc5510c186f0724807a4d956c97f5ddfff2782bc9a5fce2
4
- data.tar.gz: 9d061f85db720b2047b8593f11c9a78e3f48b213e5592c238fb2c08877526ab0
3
+ metadata.gz: f137310902b24d7370a9c05cd06a01223c8d023993aa064b1b4ad5a61e6c3ae4
4
+ data.tar.gz: 14bcca94a36b8b2716478fa114202d23722118c7745e14e52647ff3eaec3086c
5
5
  SHA512:
6
- metadata.gz: a8e60957af84063a067e91b2db6683e623264b5b63a5fe453fd618ba5242b06add54a1a158da147a89a50fdc6988656b70858a2a89d68b08f98689d879ef4cd2
7
- data.tar.gz: ef8b3515bcd49d54e086e7f30db8a1563f481d9c5df76d27c315b8fca22f54837d506beecdbb08e7169963868fc525b3bcf6b4229188bbc143e3dae69244c34d
6
+ metadata.gz: 31e825500d42c0f357d87f9d89b5da6d97d4479c1caf6f3bb51e560588209b2820fb70c6250f69b5a35abdf03747a3d52acf409495aa73bbce60e384998bf4cc
7
+ data.tar.gz: 980999e9641fa14070cf0193348b83cd7daac027d29ec9cbc57c10b7d72410b4ba7a808836539b44442a77b865b9ca8b0692fbc8892ade7ba1dcc3e105677913
data/CHANGELOG.md CHANGED
@@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
 
6
6
  This changelog was automatically generated using [Caretaker](https://github.com/DevelopersToolbox/caretaker) by [Wolf Software](https://github.com/WolfSoftware)
7
7
 
8
+ ### [v0.1.2](https://github.com/DevelopersToolbox/github-lister-core/compare/v0.1.1...v0.1.2)
9
+
10
+ > Released on March, 10th 2021
11
+
12
+ - Fixed error where additional information wasn't being decoded from sawyer::resource and returned as JSON [`[head]`](https://github.com/DevelopersToolbox/github-lister-core/commit/)
13
+
8
14
  ### [v0.1.1](https://github.com/DevelopersToolbox/github-lister-core/compare/v0.1.0...v0.1.1)
9
15
 
10
16
  > Released on March, 8th 2021
11
17
 
12
- - Fixing a couple of errors that slipped passed QA testing [`[head]`](https://github.com/DevelopersToolbox/github-lister-core/commit/)
18
+ - Fixing a couple of errors that slipped passed QA testing [`[680fb05]`](https://github.com/DevelopersToolbox/github-lister-core/commit/680fb05098074f347e2057b5c1d444ccb046a709)
13
19
 
14
20
  ### [v0.1.0](https://github.com/DevelopersToolbox/github-lister-core/releases/v0.1.0)
15
21
 
data/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -13,7 +13,8 @@ class GithubListerCore
13
13
  # Extra the topics slug from the payload and return it
14
14
  #
15
15
  def languages_private(client, repo)
16
- function_wrapper(client, 'languages', repo)
16
+ languages = function_wrapper(client, 'languages', repo)
17
+ decode_sawyer_resource(languages)
17
18
  end
18
19
 
19
20
  #
@@ -21,7 +22,7 @@ class GithubListerCore
21
22
  #
22
23
  # This method smells of :reek:FeatureEnvy
23
24
  def add_languages_private(client, repos)
24
- (repo_list ||= []) << Parallel.each(repos, :in_threads => repos.count) { |repo| repo[:languages] = languages_internal(client, repo[:full_name]) }
25
+ (repo_list ||= []) << Parallel.each(repos, :in_threads => repos.count) { |repo| repo[:languages] = languages_private(client, repo[:full_name]) }
25
26
  repo_list.flatten
26
27
  end
27
28
  end
@@ -16,14 +16,14 @@ class GithubListerCore
16
16
  rescue NotFoundError => _exception
17
17
  end
18
18
  # rubocop:enable Lint/SuppressedException
19
- release || []
19
+ decode_sawyer_resource(release) || {}
20
20
  end
21
21
 
22
22
  #
23
23
  # Add topics to each repo
24
24
  #
25
25
  # This method smells of :reek:FeatureEnvy
26
- def add_latest_release(client, repos)
26
+ def add_latest_release_private(client, repos)
27
27
  (repo_list ||= []) << Parallel.each(repos, :in_threads => repos.count) { |repo| repo[:latest_release] = latest_release_private(client, repo[:full_name]) }
28
28
  repo_list.flatten
29
29
  end
@@ -38,14 +38,14 @@ class GithubListerCore
38
38
  rescue NotFoundError => _exception
39
39
  end
40
40
  # rubocop:enable Lint/SuppressedException
41
- releases || []
41
+ decode_sawyer_resource(releases) || []
42
42
  end
43
43
 
44
44
  #
45
45
  # Add topics to each repo
46
46
  #
47
47
  # This method smells of :reek:FeatureEnvy
48
- def add_releases(client, repos)
48
+ def add_releases_private(client, repos)
49
49
  (repo_list ||= []) << Parallel.each(repos, :in_threads => repos.count) { |repo| repo[:releases] = releases_private(client, repo[:full_name]) }
50
50
  repo_list.flatten
51
51
  end
@@ -9,8 +9,28 @@ class GithubListerCore
9
9
 
10
10
  private
11
11
 
12
+ def decode_sawyer_array(array)
13
+ results = []
14
+
15
+ array.each do |element|
16
+ results.append(decode_sawyer_resource(element))
17
+ end
18
+ results
19
+ end
20
+
21
+ def decode_sawyer_resource(item)
22
+ case item
23
+ when Sawyer::Resource
24
+ item.to_h
25
+ when Array
26
+ decode_sawyer_array(item)
27
+ else
28
+ item
29
+ end
30
+ end
31
+
12
32
  def clean_from_parallel(item, sorted = nil)
13
- return [] if item.nil?
33
+ return {} if item.nil?
14
34
 
15
35
  item = item.flatten.map(&:to_h).uniq
16
36
  item = item.sort_by { |repo| repo[sorted].downcase } if sorted
@@ -1,3 +1,3 @@
1
1
  class GithubListerCore
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
data/testing/get-raw.rb CHANGED
@@ -10,7 +10,9 @@ $LOAD_PATH.unshift('./lib')
10
10
  require 'bundler/setup'
11
11
  require 'github-lister-core'
12
12
 
13
- config = {}
13
+ # rubocop:disable Lint/UselessAssignment
14
+ config = { :token => 'Add token here' }
15
+ # rubocop:enable Lint/UselessAssignment
14
16
 
15
17
  def count_results(results)
16
18
  puts JSON.parse(results).size
@@ -21,16 +23,16 @@ def display_results(results)
21
23
  end
22
24
 
23
25
  # count_results(GithubListerCore.user_repos(config))
24
- display_results(GithubListerCore.user_repos(config))
26
+ # display_results(GithubListerCore.user_repos(config))
25
27
 
26
28
  # count_results(GithubListerCore.org_repos(config))
27
- display_results(GithubListerCore.org_repos(config))
29
+ # display_results(GithubListerCore.org_repos(config))
28
30
 
29
31
  # count_results(GithubListerCore.org_members_repos(config))
30
- display_results(GithubListerCore.org_members_repos(config))
32
+ # display_results(GithubListerCore.org_members_repos(config))
31
33
 
32
34
  # count_results(GithubListerCore.all_repos(config))
33
- display_results(GithubListerCore.all_repos(config))
35
+ # display_results(GithubListerCore.all_repos(config))
34
36
 
35
37
  # count_results(GithubListerCore.org_membership(config))
36
- display_results(GithubListerCore.org_membership(config))
38
+ # display_results(GithubListerCore.org_membership(config))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-lister-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Gurney aka Wolf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler