yql 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -2
- data/Manifest.txt +2 -1
- data/lib/yql.rb +3 -3
- data/lib/yql/response.rb +36 -0
- metadata +4 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/yql.rb
CHANGED
@@ -2,11 +2,11 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
require '
|
5
|
+
require 'cgi'
|
6
6
|
require 'net/http'
|
7
7
|
require 'net/https'
|
8
8
|
require 'rexml/document'
|
9
9
|
require 'yql/error.rb'
|
10
|
-
require 'yql/client.rb'
|
11
10
|
require 'yql/query_builder.rb'
|
12
|
-
require 'yql/response.rb'
|
11
|
+
require 'yql/response.rb'
|
12
|
+
require 'yql/client.rb'
|
data/lib/yql/response.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Yql
|
2
|
+
|
3
|
+
class Response
|
4
|
+
|
5
|
+
def initialize(response, format)
|
6
|
+
@response = response
|
7
|
+
@format = format
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
raise Yql::ResponseFailure, body.inspect unless success?
|
12
|
+
output
|
13
|
+
end
|
14
|
+
|
15
|
+
def body
|
16
|
+
@response.body
|
17
|
+
end
|
18
|
+
|
19
|
+
def code
|
20
|
+
@response.code
|
21
|
+
end
|
22
|
+
|
23
|
+
def success?
|
24
|
+
code == '200'
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def output
|
30
|
+
return body unless @format == 'xml'
|
31
|
+
REXML::Document.new(body)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
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
|
- Nasir Jamal
|
@@ -31,8 +31,9 @@ files:
|
|
31
31
|
- Manifest.txt
|
32
32
|
- README.rdoc
|
33
33
|
- lib/yql.rb
|
34
|
-
- lib/yql/client.rb
|
35
34
|
- lib/yql/error.rb
|
35
|
+
- lib/yql/response.rb
|
36
|
+
- lib/yql/client.rb
|
36
37
|
- lib/yql/query_builder.rb
|
37
38
|
has_rdoc: true
|
38
39
|
homepage: http://github.com/nas/yql
|