Sha256: 0b7e3187ff0aeff0ca107a91e835acfd4b493d8c448a7b1a0b73b91ff0218fa2

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'learn_web/client/request'
require 'learn_web/client/connection'
require 'learn_web/client/user'
require 'learn_web/client/pull_request'
require 'learn_web/client/lesson'
require 'learn_web/client/validate_repo'
require 'learn_web/client/fork'
require 'learn_web/client/environment'
require 'learn_web/client/event'
require 'learn_web/client/ssh_keys'

module LearnWeb
  class Client
    attr_reader :token, :conn, :silent_output

    LEARN_URL = ENV.fetch('LEARN_CO_URL', 'https://learn.co').freeze
    API_ROOT  = '/api/v1'

    include LearnWeb::Client::Request
    include LearnWeb::Client::Connection
    include LearnWeb::Client::PullRequest
    include LearnWeb::Client::Lesson
    include LearnWeb::Client::ValidateRepo
    include LearnWeb::Client::Fork
    include LearnWeb::Client::User
    include LearnWeb::Client::Environment
    include LearnWeb::Client::Event
    include LearnWeb::Client::SshKeys

    def initialize(token:, silent_output: false)
      @token = token
      @silent_output = silent_output
      @conn = Faraday.new(url: LEARN_URL) do |faraday|
        faraday.adapter Faraday.default_adapter
      end
    end

    def valid_token?
      !!me.data
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
learn-web-1.5.5 lib/learn_web/client.rb
learn-web-1.5.4 lib/learn_web/client.rb
learn-web-1.5.3 lib/learn_web/client.rb
learn-web-1.5.2 lib/learn_web/client.rb