Sha256: b9b58a9b4a1389e796af23bad2340ec8bfb0acb36ce150912f8be38641e8b5fd

Contents?: true

Size: 1.89 KB

Versions: 6

Compression:

Stored size: 1.89 KB

Contents

#
# Pull information specific to organisations (org repos are in repos.rb)
#
class GithubListerCore
    class << self
        #
        # Everything below here is private
        #

        private

        # rubocop:disable Metrics/MethodLength
        def get_org_list(options)
            org_param = get_option(options, [:org_name, :org])

            raise MissingOrganisationError.new unless org_param

            case org_param
            when Array
                orgs = org_param
            when String
                orgs = convert_to_array(org_param)
            else
                raise InvalidParameterError.new
            end
            orgs
        end
        # rubocop:enable Metrics/MethodLength

        #
        # Get a list of organisations that a user is a member of
        #
        # This method smells of :reek:DuplicateMethodCall

        def org_repos_from_github(client, org)
            function_wrapper(client, 'organization_repositories', org)
        end

        def org_repos_in_parallel(client, orgs)
            (repos ||= []) << Parallel.map(orgs, :in_threads => orgs.count) { |org| org_repos_from_github(client, org) }
            clean_from_parallel(repos, :full_name)
        end

        # Get the org list for a list of users
        def org_membership_from_github(client, org)
            function_wrapper(client, 'organizations', org)
        end

        def org_membership_in_parallel(client, users)
            (orgs ||= []) << Parallel.map(users, :in_threads => users.count) { |user| org_membership_from_github(client, user) }
            clean_from_parallel(orgs, :login)
        end

        def org_membership_private(client, users)
            org_membership_in_parallel(client, users)
        end

        def org_membership_slugs_private(client, users)
            org_membership_in_parallel(client, users).map { |hash| hash[:login] }.compact
        end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github-lister-core-0.1.6 lib/github-lister-core/organisations.rb
github-lister-core-0.1.4 lib/github-lister-core/organisations.rb
github-lister-core-0.1.3 lib/github-lister-core/organisations.rb
github-lister-core-0.1.2 lib/github-lister-core/organisations.rb
github-lister-core-0.1.1 lib/github-lister-core/organisations.rb
github-lister-core-0.1.0 lib/github-lister-core/organisations.rb