learn-web 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/learn_web/client.rb +2 -0
- data/lib/learn_web/client/event.rb +31 -0
- data/lib/learn_web/client/event/submission.rb +19 -0
- data/lib/learn_web/client/lesson/current_lesson.rb +1 -1
- data/lib/learn_web/client/lesson/next_lesson.rb +1 -1
- data/lib/learn_web/client/request.rb +9 -1
- data/lib/learn_web/client/validate_repo/slug.rb +2 -1
- data/lib/learn_web/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac81838b897625bf99d52ec8bfbc4e247e92c783
|
4
|
+
data.tar.gz: 2d939ba9e0d3a4a5f399e5665c3059a9c8d49490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cef560c5e879d2608ada091e3634683312c69ecc4ed02fe6fdc1eda6253f1f3938cfc586de9be40e2fb052d0ce2163157d14697e79c26e19ac77b65fd25b2b37
|
7
|
+
data.tar.gz: 6ab8a648f17ae299ec0d9daad1a1abf6aa923e402efda058ca562085e2c663fe568f296bb8023f0561add9e68765be0f5acbd72ae75b696bd0bfd01109459f69
|
data/lib/learn_web/client.rb
CHANGED
@@ -6,6 +6,7 @@ require 'learn_web/client/lesson'
|
|
6
6
|
require 'learn_web/client/validate_repo'
|
7
7
|
require 'learn_web/client/fork'
|
8
8
|
require 'learn_web/client/environment'
|
9
|
+
require 'learn_web/client/event'
|
9
10
|
|
10
11
|
module LearnWeb
|
11
12
|
class Client
|
@@ -22,6 +23,7 @@ module LearnWeb
|
|
22
23
|
include LearnWeb::Client::Fork
|
23
24
|
include LearnWeb::Client::User
|
24
25
|
include LearnWeb::Client::Environment
|
26
|
+
include LearnWeb::Client::Event
|
25
27
|
|
26
28
|
def initialize(token:, silent_output: false)
|
27
29
|
@token = token
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'learn_web/client/event/submission'
|
2
|
+
|
3
|
+
module LearnWeb
|
4
|
+
class Client
|
5
|
+
module Event
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
IRONBROKER_URL = 'http://ironbroker-v2.flatironschool.com'
|
9
|
+
|
10
|
+
def client
|
11
|
+
@client ||= Faraday.new(url: IRONBROKER_URL) do |faraday|
|
12
|
+
faraday.adapter Faraday.default_adapter
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def submission_endpoint
|
17
|
+
'/e/learn_gem'
|
18
|
+
end
|
19
|
+
|
20
|
+
def submit_event(params)
|
21
|
+
response = post(
|
22
|
+
submission_endpoint,
|
23
|
+
body: params,
|
24
|
+
client: client
|
25
|
+
)
|
26
|
+
|
27
|
+
LearnWeb::Client::Event::Submission.new(response)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module LearnWeb
|
2
|
+
class Client
|
3
|
+
module Event
|
4
|
+
class Submission
|
5
|
+
attr_reader :response
|
6
|
+
attr_accessor :data
|
7
|
+
|
8
|
+
include LearnWeb::AttributePopulatable
|
9
|
+
include LearnWeb::ResponseParsable
|
10
|
+
|
11
|
+
def initialize(response)
|
12
|
+
@response = response
|
13
|
+
|
14
|
+
parse!
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,7 +4,7 @@ module LearnWeb
|
|
4
4
|
class CurrentLesson
|
5
5
|
attr_reader :response
|
6
6
|
attr_accessor :data, :id, :title, :link, :github_repo, :forked_repo,
|
7
|
-
:assessments, :lab
|
7
|
+
:clone_repo, :assessments, :lab, :dot_learn
|
8
8
|
|
9
9
|
include LearnWeb::AttributePopulatable
|
10
10
|
include LearnWeb::ResponseParsable
|
@@ -4,7 +4,7 @@ module LearnWeb
|
|
4
4
|
class NextLesson
|
5
5
|
attr_reader :response
|
6
6
|
attr_accessor :data, :id, :title, :link, :github_repo, :forked_repo,
|
7
|
-
:assessments, :lab
|
7
|
+
:clone_repo, :assessments, :lab, :dot_learn
|
8
8
|
|
9
9
|
include LearnWeb::AttributePopulatable
|
10
10
|
include LearnWeb::ResponseParsable
|
@@ -6,7 +6,8 @@ module LearnWeb
|
|
6
6
|
|
7
7
|
def request(method, url, options = {})
|
8
8
|
begin
|
9
|
-
@conn
|
9
|
+
connection = options[:client] || @conn
|
10
|
+
connection.send(method) do |req|
|
10
11
|
req.url url
|
11
12
|
build_request(req, options)
|
12
13
|
end
|
@@ -18,6 +19,7 @@ module LearnWeb
|
|
18
19
|
def build_request(request, options)
|
19
20
|
build_headers(request, options[:headers])
|
20
21
|
build_params(request, options[:params])
|
22
|
+
build_body(request, options[:body])
|
21
23
|
end
|
22
24
|
|
23
25
|
def build_headers(request, headers)
|
@@ -35,6 +37,12 @@ module LearnWeb
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
40
|
+
|
41
|
+
def build_body(request, body)
|
42
|
+
if body
|
43
|
+
request.body = Oj.dump(body, mode: :compat)
|
44
|
+
end
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
@@ -2,7 +2,8 @@ module LearnWeb
|
|
2
2
|
class Client
|
3
3
|
module ValidateRepo
|
4
4
|
class Slug
|
5
|
-
attr_accessor :data, :repo_slug, :lab, :lesson_id, :later_lesson
|
5
|
+
attr_accessor :data, :repo_slug, :lab, :lesson_id, :later_lesson,
|
6
|
+
:repo_name, :dot_learn
|
6
7
|
attr_reader :response
|
7
8
|
|
8
9
|
include AttributePopulatable
|
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.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- lib/learn_web/client/environment.rb
|
87
87
|
- lib/learn_web/client/environment/setup_list.rb
|
88
88
|
- lib/learn_web/client/environment/verification.rb
|
89
|
+
- lib/learn_web/client/event.rb
|
90
|
+
- lib/learn_web/client/event/submission.rb
|
89
91
|
- lib/learn_web/client/fork.rb
|
90
92
|
- lib/learn_web/client/fork/request.rb
|
91
93
|
- lib/learn_web/client/lesson.rb
|