Sha256: ff3e4711e81da0314c758102f843773f9b86e72617c5910f5587b6fd20396a41

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

# encoding: utf-8

module GithubCLI
  # The API class is the main entry point for creating GithubCLI APIs.
  class API

    ENDPOINT = ''

    @@api = nil

    class << self

      attr_reader :config

      def github_api
        @@api ||= begin
          @@api = configure_api
        end
      end

      def configure_api
        @@api = Github.new
        @@api.oauth_token = GithubCLI.config['oauth_token']
        @@api.basic_auth  = GithubCLI.config['basic_auth']
        puts "#{ENV['TEST_HOST']}"
        if ENV['TEST_HOST']
          @@api.endpoint = 'http://' + ENV['TEST_HOST']
        end
        @@api
      end

      def output(format=:table, &block)
        response =  block.call
        formatter = Formatter.new response, :format => format
        formatter.render_output
      end

    end

    class All
      def initialize(params)
        puts Github::Repos.new.all params
      end
    end

  end # API
end # GithubCLI

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github_cli-0.4.4 lib/github_cli/api.rb
github_cli-0.4.3 lib/github_cli/api.rb