learn-web 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/learn_web/client/lesson.rb +14 -0
- data/lib/learn_web/client/lesson/next_lesson.rb +38 -0
- data/lib/learn_web/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b69195430cc8009d33e548d7ec4e0b2b72ed8c88
|
4
|
+
data.tar.gz: 87a125fadd0cdf323b68e8dbaff937ea8ecb3e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf5d80f0170154a9b55a4886918751146b7c6003915361013f7eea71d18baaae7a89aba8cfdb4a03161fc50a5da38e258101f2bad3e243000ec9e71ec640a46
|
7
|
+
data.tar.gz: 765dd246a8a23bee2f12e7466263c92dba87848f9f6763c710252cd47f6415f041f6a069ea4237bc65e7541dee8a28fb37dd1c591f6c7de056ff0d99a8acadb0
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'learn_web/client/lesson/current_lesson'
|
2
|
+
require 'learn_web/client/lesson/next_lesson'
|
2
3
|
|
3
4
|
module LearnWeb
|
4
5
|
class Client
|
@@ -7,6 +8,10 @@ module LearnWeb
|
|
7
8
|
"#{API_ROOT}/users/current_lesson"
|
8
9
|
end
|
9
10
|
|
11
|
+
def next_lesson_endpoint
|
12
|
+
"#{API_ROOT}/users/next_lesson"
|
13
|
+
end
|
14
|
+
|
10
15
|
def current_lesson
|
11
16
|
response = @conn.get do |req|
|
12
17
|
req.url current_lesson_endpoint
|
@@ -15,6 +20,15 @@ module LearnWeb
|
|
15
20
|
|
16
21
|
LearnWeb::Client::Lesson::CurrentLesson.new(response)
|
17
22
|
end
|
23
|
+
|
24
|
+
def next_lesson
|
25
|
+
response = @conn.get do |req|
|
26
|
+
req.url next_lesson_endpoint
|
27
|
+
req.headers['Authorization'] = "Bearer #{token}"
|
28
|
+
end
|
29
|
+
|
30
|
+
LearnWeb::Client::Lesson::NextLesson.new(response)
|
31
|
+
end
|
18
32
|
end
|
19
33
|
end
|
20
34
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module LearnWeb
|
2
|
+
class Client
|
3
|
+
module Lesson
|
4
|
+
class NextLesson
|
5
|
+
attr_reader :response
|
6
|
+
attr_accessor :data, :id, :title, :link, :github_repo, :forked_repo,
|
7
|
+
:assessments, :lab
|
8
|
+
|
9
|
+
include LearnWeb::AttributePopulatable
|
10
|
+
|
11
|
+
def initialize(response)
|
12
|
+
@response = response
|
13
|
+
|
14
|
+
parse!
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse!
|
18
|
+
case response.status
|
19
|
+
when 200
|
20
|
+
self.data = Oj.load(response.body, symbol_keys: true)
|
21
|
+
populate_attributes!
|
22
|
+
when 401
|
23
|
+
puts "It seems your OAuth token is incorrect. Please re-run config with: learn reset"
|
24
|
+
exit
|
25
|
+
when 500
|
26
|
+
puts "Something went wrong. Please try again."
|
27
|
+
exit
|
28
|
+
else
|
29
|
+
puts "Something when wrong. Please try again."
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
|
33
|
+
self
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/learn_web/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/learn_web/client/fork/request.rb
|
87
87
|
- lib/learn_web/client/lesson.rb
|
88
88
|
- lib/learn_web/client/lesson/current_lesson.rb
|
89
|
+
- lib/learn_web/client/lesson/next_lesson.rb
|
89
90
|
- lib/learn_web/client/pull_request.rb
|
90
91
|
- lib/learn_web/client/pull_request/response.rb
|
91
92
|
- lib/learn_web/client/user.rb
|