learn-web 1.0.4 → 1.0.5
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/environment.rb +19 -0
- data/lib/learn_web/client/environment/setup_list.rb +34 -0
- data/lib/learn_web/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a29bd27bf589876bd18bab7205b1551543eaaf5
|
4
|
+
data.tar.gz: bc3a4f490cffb940c0d566cdd5c2b03fc5b17135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a55c7a1aa9230e7ecd36dabc60dbf585e7632ae4b4c53b314cb1b98dbdc8e3e3fda338a5f3a2baf4b05dfb631c7cff4454b7d4cb67c053bae0bc2bc59383b5e
|
7
|
+
data.tar.gz: 5c25beac760b0324729c53a3279d3f38e78368f31fb8b05f975fa5a8b2e8d7bb1140cf8d8ac4b5c85d1b781e3f0ef0c9f8b28e026acb358081df1345abc6541f
|
data/lib/learn_web/client.rb
CHANGED
@@ -3,6 +3,7 @@ require 'learn_web/client/pull_request'
|
|
3
3
|
require 'learn_web/client/lesson'
|
4
4
|
require 'learn_web/client/validate_repo'
|
5
5
|
require 'learn_web/client/fork'
|
6
|
+
require 'learn_web/client/environment'
|
6
7
|
|
7
8
|
module LearnWeb
|
8
9
|
class Client
|
@@ -16,6 +17,7 @@ module LearnWeb
|
|
16
17
|
include LearnWeb::Client::ValidateRepo
|
17
18
|
include LearnWeb::Client::Fork
|
18
19
|
include LearnWeb::Client::User
|
20
|
+
include LearnWeb::Client::Environment
|
19
21
|
|
20
22
|
def initialize(token:, silent_output: false)
|
21
23
|
@token = token
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'learn_web/client/environment/setup_list'
|
2
|
+
|
3
|
+
module LearnWeb
|
4
|
+
class Client
|
5
|
+
module Environment
|
6
|
+
def environment_setup_list_endpoint
|
7
|
+
"#{API_ROOT}/environmentalizer/steps"
|
8
|
+
end
|
9
|
+
|
10
|
+
def environment_setup_list
|
11
|
+
response = @conn.get do |req|
|
12
|
+
req.url environment_setup_list_endpoint
|
13
|
+
end
|
14
|
+
|
15
|
+
LearnWeb::Client::Environment::SetupList.new(response)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module LearnWeb
|
2
|
+
class Client
|
3
|
+
module Environment
|
4
|
+
class SetupList
|
5
|
+
attr_accessor :data, :steps
|
6
|
+
attr_reader :response
|
7
|
+
|
8
|
+
include AttributePopulatable
|
9
|
+
|
10
|
+
def initialize(response)
|
11
|
+
@response = response
|
12
|
+
|
13
|
+
parse!
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def parse!
|
19
|
+
case response.status
|
20
|
+
when 200
|
21
|
+
self.data = Oj.load(response.body, symbol_keys: true)
|
22
|
+
self.steps = self.data
|
23
|
+
when 422, 500
|
24
|
+
puts "Sorry, something went wrong. Please try again."
|
25
|
+
exit
|
26
|
+
else
|
27
|
+
puts "Sorry, something went wrong. Please try again."
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/learn_web/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- lib/learn_web.rb
|
83
83
|
- lib/learn_web/attribute_populatable.rb
|
84
84
|
- lib/learn_web/client.rb
|
85
|
+
- lib/learn_web/client/environment.rb
|
86
|
+
- lib/learn_web/client/environment/setup_list.rb
|
85
87
|
- lib/learn_web/client/fork.rb
|
86
88
|
- lib/learn_web/client/fork/request.rb
|
87
89
|
- lib/learn_web/client/lesson.rb
|