validator.nu 0.0.1 → 0.0.2
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/README.rdoc +13 -1
- data/VERSION +1 -1
- data/lib/validator.nu.rb +14 -10
- data/spec/validator_spec.rb +1 -0
- data/validator.nu.gemspec +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
= validator.nu
|
2
2
|
|
3
|
-
|
3
|
+
ruby client library for the validator.nu HTML5 validation API
|
4
|
+
|
5
|
+
== Installation & Usage
|
6
|
+
|
7
|
+
gem install validator.nu
|
8
|
+
require 'validator.nu'
|
9
|
+
Validator.nu("http://google.com")
|
10
|
+
|
11
|
+
== Todo
|
12
|
+
|
13
|
+
* implement POST html document functionality of the API
|
14
|
+
* transmit compressed data
|
15
|
+
* output pure JSON ?
|
4
16
|
|
5
17
|
== Note on Patches/Pull Requests
|
6
18
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/validator.nu.rb
CHANGED
@@ -38,23 +38,27 @@ module Validator
|
|
38
38
|
class RemoteException < StandardError; end;
|
39
39
|
|
40
40
|
HOST = "validator.nu"
|
41
|
-
PORT = 80
|
41
|
+
PORT = 80
|
42
42
|
|
43
|
-
def nu(url_or_document)
|
44
|
-
get(url_or_document)
|
43
|
+
def nu(url_or_document, options={})
|
44
|
+
get(url_or_document, options)
|
45
45
|
end
|
46
46
|
|
47
47
|
|
48
|
-
|
48
|
+
# TODO - some implementation notes.
|
49
|
+
# http.set_debug_output STDERR
|
50
|
+
# http.use_ssl = true if SSL
|
51
|
+
# headers = method.to_s == 'errors' ? { 'Content-Type' => 'application/x-gzip', 'Accept' => 'application/x-gzip' } : {}
|
52
|
+
# compressed_data = CGI::escape(Zlib::Deflate.deflate(data, Zlib::BEST_SPEED))
|
53
|
+
# STDERR.puts uri
|
54
|
+
def get(url, options)
|
49
55
|
begin
|
50
|
-
|
51
|
-
|
52
|
-
|
56
|
+
host = options[:host] || HOST
|
57
|
+
port = options[:port] || PORT
|
58
|
+
http = Net::HTTP.new(host, port)
|
59
|
+
STDERR.puts host
|
53
60
|
uri = "/?&doc=#{CGI::escape(url)}&out=json"
|
54
|
-
# headers = method.to_s == 'errors' ? { 'Content-Type' => 'application/x-gzip', 'Accept' => 'application/x-gzip' } : {}
|
55
61
|
|
56
|
-
# compressed_data = CGI::escape(Zlib::Deflate.deflate(data, Zlib::BEST_SPEED))
|
57
|
-
# STDERR.puts uri
|
58
62
|
response = http.start do |http|
|
59
63
|
http.get(uri)
|
60
64
|
end
|
data/spec/validator_spec.rb
CHANGED
data/validator.nu.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{validator.nu}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Rice"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-07}
|
13
13
|
s.description = %q{ruby client library for the validator.nu HTML5 validation API}
|
14
14
|
s.email = %q{me@davidjrice.co.uk}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David Rice
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-07 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|