Sha256: 9816f112099ebc252aa2cd5c1c337a363d6d6cedbb9815028707792ab1c8fa82

Contents?: true

Size: 859 Bytes

Versions: 61

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

require "octokit"

require_relative "../base"
require_relative "../../exception_handler"
require_relative "auth"
require_relative "../../utils"

module Neetob
  class CLI
    module Github
      class Base < CLI::Base
        include Utils
        attr_accessor :client

        def initialize
          super()
          auth_client = Auth.new(**read_and_parse_auth_params_from_env)
          unless auth_client.token_persisted?
            auth_client.start_oauth2_device_flow
          end
          @client = Octokit::Client.new(access_token: auth_client.access_token)
        end

        private

          def read_and_parse_auth_params_from_env
            hash_with_keys_of_string_type = JSON.parse(ENV["AUTH_PARAMS"])
            symbolize_keys(hash_with_keys_of_string_type)
          end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
neetob-0.5.16 lib/neetob/cli/github/base.rb
neetob-0.5.15 lib/neetob/cli/github/base.rb
neetob-0.5.14 lib/neetob/cli/github/base.rb
neetob-0.5.13 lib/neetob/cli/github/base.rb
neetob-0.5.12 lib/neetob/cli/github/base.rb
neetob-0.5.11 lib/neetob/cli/github/base.rb
neetob-0.5.10 lib/neetob/cli/github/base.rb
neetob-0.5.9 lib/neetob/cli/github/base.rb
neetob-0.5.8 lib/neetob/cli/github/base.rb
neetob-0.5.7 lib/neetob/cli/github/base.rb
neetob-0.5.6 lib/neetob/cli/github/base.rb
neetob-0.5.5 lib/neetob/cli/github/base.rb
neetob-0.5.4 lib/neetob/cli/github/base.rb
neetob-0.5.3 lib/neetob/cli/github/base.rb
neetob-0.5.2 lib/neetob/cli/github/base.rb
neetob-0.5.1 lib/neetob/cli/github/base.rb
neetob-0.5.0 lib/neetob/cli/github/base.rb
neetob-0.4.37 lib/neetob/cli/github/base.rb
neetob-0.4.36 lib/neetob/cli/github/base.rb
neetob-0.4.35 lib/neetob/cli/github/base.rb