lib/learn_web/client/lesson.rb in learn-web-1.1.0 vs lib/learn_web/client/lesson.rb in learn-web-1.2.0
- old
+ new
@@ -1,6 +1,7 @@
require 'learn_web/client/lesson/current_lesson'
+require 'learn_web/client/lesson/current_status'
require 'learn_web/client/lesson/next_lesson'
module LearnWeb
class Client
module Lesson
@@ -10,10 +11,14 @@
def next_lesson_endpoint
"#{API_ROOT}/users/next_lesson"
end
+ def current_status_endpoint
+ "#{API_ROOT}/users/current_lesson/status"
+ end
+
def current_lesson
response = get(
current_lesson_endpoint,
headers: { 'Authorization' => "Bearer #{token}" }
)
@@ -27,9 +32,18 @@
headers: { 'Authorization' => "Bearer #{token}" },
params: { 'dir_name' => File.basename(FileUtils.pwd) }
)
LearnWeb::Client::Lesson::NextLesson.new(response)
+ end
+
+ def current_status
+ response = get(
+ current_status_endpoint,
+ headers: { 'Authorization' => "Bearer #{token}" }
+ )
+
+ LearnWeb::Client::Lesson::CurrentStatus.new(response)
end
end
end
end