Sha256: 22bea6a26aa1249be0f3765442db145c4ee439d76f7cbf44bf1ed32b9a61abfe

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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'

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

    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

1 entries across 1 versions & 1 rubygems

Version Path
learn-web-1.5.1 lib/learn_web/client.rb