Sha256: 9fb4e1ed5de768dfabd3dafc5319e49a5840cac40fba9365209860ba4991bb55

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

require 'learn_web/client/lesson/current_lesson'
require 'learn_web/client/lesson/next_lesson'

module LearnWeb
  class Client
    module Lesson
      def current_lesson_endpoint
        "#{API_ROOT}/users/current_lesson"
      end

      def next_lesson_endpoint
        "#{API_ROOT}/users/next_lesson"
      end

      def current_lesson
        response = get(
          current_lesson_endpoint,
          headers: { 'Authorization' => "Bearer #{token}" }
        )

        LearnWeb::Client::Lesson::CurrentLesson.new(response)
      end

      def next_lesson
        response = get(
          next_lesson_endpoint,
          headers: { 'Authorization' => "Bearer #{token}" },
          params: { 'dir_name' => File.basename(FileUtils.pwd) }
        )

        LearnWeb::Client::Lesson::NextLesson.new(response)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
learn-web-1.1.0 lib/learn_web/client/lesson.rb