erroneous-api 0.0.2 → 0.0.3
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.
- data/lib/erroneous-api/client.rb +18 -3
- data/lib/erroneous-api/server.rb +8 -1
- data/lib/erroneous-api/version.rb +1 -1
- metadata +3 -3
data/lib/erroneous-api/client.rb
CHANGED
@@ -7,12 +7,16 @@ module ErroneousAPI
|
|
7
7
|
@base_url = base_url
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
class << self
|
11
|
+
attr_accessor :mock_backend
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.mock!(backend)
|
15
|
+
@mock_backend = backend
|
12
16
|
end
|
13
17
|
|
14
18
|
def connection
|
15
|
-
@connection ||=
|
19
|
+
@connection ||= setup_connection
|
16
20
|
end
|
17
21
|
|
18
22
|
def parse_deploy_fail(text)
|
@@ -29,5 +33,16 @@ module ErroneousAPI
|
|
29
33
|
@details = json_response['details']
|
30
34
|
end
|
31
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def setup_connection
|
40
|
+
connection = EY::ApiHMAC::BaseConnection.new
|
41
|
+
if Client.mock_backend
|
42
|
+
connection.backend = Client.mock_backend
|
43
|
+
end
|
44
|
+
connection
|
45
|
+
end
|
46
|
+
|
32
47
|
end
|
33
48
|
end
|
data/lib/erroneous-api/server.rb
CHANGED
@@ -10,10 +10,17 @@ module ErroneousAPI
|
|
10
10
|
attr_accessor :mapper
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.mock!
|
14
|
+
require 'erroneous-api/fake'
|
15
|
+
require 'erroneous-api/client'
|
16
|
+
self.mapper = ErroneousAPI::Fake
|
17
|
+
ErroneousAPI::Client.mock!(self)
|
18
|
+
end
|
19
|
+
|
13
20
|
post '/parse_deploy_fail' do
|
14
21
|
deploy_log = JSON.parse(request.body.read)["deploy_log"]
|
15
22
|
content_type :json
|
16
|
-
result = Server.mapper.parse_deploy_fail(deploy_log)
|
23
|
+
result = ErroneousAPI::Server.mapper.parse_deploy_fail(deploy_log)
|
17
24
|
{
|
18
25
|
:lines => (result[:lines] or raise "Expected parse_deploy_fail to return which :lines (empty array allowed)").to_a,
|
19
26
|
:details => (result[:details] or raise "Expected parse_deploy_fail to return the :details (empty string allowed)"),
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erroneous-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacob Burkhart
|