Sha256: 3e39dc31be32696d690dc3fd97bf696bae655c0457f691b7d3235f05c03e1cef

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

require "base64"

module NeetoCompliance
  class GithubAccess
    def self.token
      Base64.decode64(
        File.read("Gemfile.common.rb")
          .split("encoded_github_auth_string =")[1]
          .split("%{")[1]
          .split("}")[0]
          .gsub("\\r", "\r")
          .gsub("\\n", "\n")
       ).split(":")[1]
    end

    def self.latest_commit_sha(uri)
      JSON.parse(get(uri))["sha"]
    end

    def self.get(uri)
      response = Net::HTTP.get_response(
        URI(uri), {
          "Authorization" => "Bearer #{token}"
        }).body
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
neeto-compliance-1.0.58 lib/neeto_compliance/github_access.rb
neetob-0.1.2 neeto_compliance/lib/neeto_compliance/github_access.rb
neetob-0.1.1 /Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/github_access.rb
neetob-0.1.0 /Users/chiragshah/Workspace/bigbinary/neeto/neetob/neeto_compliance/lib/neeto_compliance/github_access.rb