mortise 0.1.0 → 0.2.0
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/mortise.rb +1 -0
- data/lib/mortise/checker.rb +13 -4
- data/lib/mortise/errors.rb +23 -0
- data/lib/mortise/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49e66b80ab1833e48468b3c0dbe6b64909397c73
|
4
|
+
data.tar.gz: e238f828e3bba07e3ed7f1189653cd94ba37a7c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b508e119a6c467a499bc9d08bb7391ecc4b4eb706b8bea2accd079a667de98806366929a25ac7f138db9980f6137816e0a3c448109452a82cb71aa16f26898
|
7
|
+
data.tar.gz: 6eea1ed441e99f33fe111048e8d61dc83e4803865c5878585c5be76ad71d89e5f09ba2211e305429b9d313960a347bd5ca603a93317d7df93012a222bb86948e
|
data/lib/mortise.rb
CHANGED
data/lib/mortise/checker.rb
CHANGED
@@ -15,10 +15,7 @@ module Mortise
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def raw
|
18
|
-
@raw ||= JSON.parse
|
19
|
-
body: { url: url, key: key },
|
20
|
-
headers: { 'Content-Type' => 'application/x-www-form-urlencoded',
|
21
|
-
'Cache-Control' => 'no-cache' }).body
|
18
|
+
@raw ||= JSON.parse response.body
|
22
19
|
end
|
23
20
|
|
24
21
|
def issues
|
@@ -38,5 +35,17 @@ module Mortise
|
|
38
35
|
def defaults
|
39
36
|
{ tenon_uri: 'https://tenon.io/api/' }
|
40
37
|
end
|
38
|
+
|
39
|
+
def response
|
40
|
+
fail(ERRORS[tenon_response.code], tenon_response.body) if tenon_response.code != 200
|
41
|
+
|
42
|
+
tenon_response
|
43
|
+
end
|
44
|
+
|
45
|
+
def tenon_response
|
46
|
+
@tenon_response ||= HTTParty.post(tenon_uri, body: { url: url, key: key },
|
47
|
+
headers: { 'Content-Type' => 'application/x-www-form-urlencoded',
|
48
|
+
'Cache-Control' => 'no-cache' })
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Mortise
|
2
|
+
class Error < StandardError
|
3
|
+
end
|
4
|
+
|
5
|
+
class BadRequestError < Error
|
6
|
+
end
|
7
|
+
|
8
|
+
class UnauthorizedError < Error
|
9
|
+
end
|
10
|
+
|
11
|
+
class InternalServerError < Error
|
12
|
+
end
|
13
|
+
|
14
|
+
class ConnectionTimeOutError < Error
|
15
|
+
end
|
16
|
+
|
17
|
+
ERRORS = {
|
18
|
+
400 => BadRequestError,
|
19
|
+
401 => UnauthorizedError,
|
20
|
+
500 => InternalServerError,
|
21
|
+
522 => ConnectionTimeOutError
|
22
|
+
}
|
23
|
+
end
|
data/lib/mortise/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mortise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- lib/mortise.rb
|
85
85
|
- lib/mortise/checker.rb
|
86
|
+
- lib/mortise/errors.rb
|
86
87
|
- lib/mortise/issue.rb
|
87
88
|
- lib/mortise/version.rb
|
88
89
|
- mortise.gemspec
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.2.2
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: Ruby client for the Tenon accessibility checker
|