yql_simple 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +16 -0
- data/Gemfile +3 -0
- data/README.md +105 -0
- data/Rakefile +33 -0
- data/TODO.md +21 -0
- data/examples/Gemfile +3 -0
- data/examples/gem_usage.rb +17 -0
- data/lib/yql_simple.rb +1 -0
- data/lib/yql_simple/base.rb +170 -0
- data/lib/yql_simple/version.rb +4 -0
- data/spec/yql_simple_spec.rb +123 -0
- data/yql_simple.gemspec +34 -0
- metadata +119 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Configuration file for travis-ci.org
|
2
|
+
|
3
|
+
# Define a custom build script
|
4
|
+
# You can specify the main build command to run instead of just rake:
|
5
|
+
script: "bundle exec rspec spec"
|
6
|
+
|
7
|
+
# specify which ruby version to use
|
8
|
+
rvm:
|
9
|
+
- 1.8.7
|
10
|
+
- 1.9.2
|
11
|
+
- jruby
|
12
|
+
# - 1.8.6 not working
|
13
|
+
|
14
|
+
# turn off all notifications
|
15
|
+
notifications:
|
16
|
+
disabled: true
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
Simple Ruby gem for YQL
|
2
|
+
-----------------------
|
3
|
+
-----------------------
|
4
|
+
|
5
|
+
This is currently more an experiment of ruby gem building than a real ruby gem!!! The gem is usable but still may not be useful for anybody other than myself! Considered yourself at danger if you use it :)
|
6
|
+
|
7
|
+
This is my first implementation of a simple wrapper for [YQL](http://developer.yahoo.com/yql/) queries. It does not do anything fancy. Instead it just sends an HTTP request to YQL with the given query and returns the results as either a ruby Hash or Nokogiri::XML::Document.
|
8
|
+
|
9
|
+
I am using [bundler](http://gembundler.com) for the fetching the dependencies, [RSpec](http://relishapp.com/rspec) for the testing, and [RDoc](http://rdoc.sourceforge.net/doc/index.html) for code documentation.
|
10
|
+
|
11
|
+
|
12
|
+
Useful Reads for Gem Building
|
13
|
+
-----------------------------
|
14
|
+
|
15
|
+
* [Developing a RubyGem using Bundler](https://github.com/radar/guides/blob/master/gem-development.md)
|
16
|
+
* [Making Ruby Gems](http://timelessrepo.com/making-ruby-gems)
|
17
|
+
* [Using .gemspecs as Intended](http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/)
|
18
|
+
|
19
|
+
|
20
|
+
Continuous Integration
|
21
|
+
-----------------------------
|
22
|
+
|
23
|
+
Shows the current built status of this gem, as reported by [Travis CI](http://travis-ci.org/)
|
24
|
+
|
25
|
+
[![Build Status](https://secure.travis-ci.org/spier/gem_yql_simple.png)](http://travis-ci.org/spier/gem_yql_simple)
|
26
|
+
|
27
|
+
|
28
|
+
Installation
|
29
|
+
-----------------------------
|
30
|
+
|
31
|
+
The gem is not released yet, so it is not on [http://rubygems.org](http://rubygems.org) or similar.
|
32
|
+
If you really want to try it, what I would not recommend, then you have to build it yourself from source.
|
33
|
+
|
34
|
+
If you are using bundler you can do the following to install directly from the source:
|
35
|
+
|
36
|
+
gem "yql_simple", :git => "git://github.com/spier/gem_yql_simple.git"
|
37
|
+
|
38
|
+
Usage
|
39
|
+
-----------------------------
|
40
|
+
|
41
|
+
Example of doing a twitter search, using the yql_simple gem. You can also find this exaple in the *examples* folder.
|
42
|
+
|
43
|
+
#!/usr/bin/env ruby
|
44
|
+
require "rubygems"
|
45
|
+
require "bundler/setup"
|
46
|
+
|
47
|
+
require "yql_simple"
|
48
|
+
|
49
|
+
query_string = 'SELECT * FROM twitter.search WHERE q="#ruby" LIMIT 5'
|
50
|
+
response = YqlSimple.query(query_string)
|
51
|
+
|
52
|
+
response["query"]["results"]["results"].each do |tweet|
|
53
|
+
date = Time.parse(tweet["created_at"]).strftime("%Y-%m-%d %H:%M")
|
54
|
+
puts "[#{date}] #{tweet["from_user"]}: #{tweet["text"]}"
|
55
|
+
end
|
56
|
+
|
57
|
+
This will output something like this:
|
58
|
+
|
59
|
+
[2011-05-15 13:12] eyoosuf: Rails and Django for Quick thinking Developers, PHP for Lazy Developers #PHP #RUBY #ROR #PYTHON #Rails #Django
|
60
|
+
[2011-05-15 12:57] rudkovsky: Looking for a job! #rails #ruby #job
|
61
|
+
[2011-05-15 12:48] IndianGuru: Podcaster Miles Forrest interviewing RubyLearning;'s mentor Victor Goff this 18th #ruby
|
62
|
+
[2011-05-15 12:41] openairjoy: outdoor: http://openairjoy.com/05/09/woodstock-chimes-ruby-throated-hummingbird-windchime.html Woodstock Chimes R #Chimes #Hummingbird #Ruby
|
63
|
+
[2011-05-15 12:27] Elusive_Joe: I'm not entirely successfully installed gitorious at work. It seems this is the problem of #gitorious with #ruby 1.9.2
|
64
|
+
|
65
|
+
|
66
|
+
Releases
|
67
|
+
-----------------------------
|
68
|
+
|
69
|
+
0.0.2
|
70
|
+
- added OAuth supported for 2-legged OAuth with YQL
|
71
|
+
|
72
|
+
0.0.1 (unreleased)
|
73
|
+
- added minimal RDoc documentation
|
74
|
+
- RDoc will be generated with `rake rdoc` or when installing the gem
|
75
|
+
- test installation via bundler and :git
|
76
|
+
|
77
|
+
|
78
|
+
Notes for Contributors
|
79
|
+
-----------------------------
|
80
|
+
|
81
|
+
* build and install
|
82
|
+
|
83
|
+
(sudo) rake install
|
84
|
+
|
85
|
+
* run the tests (this will check for a folder 'spec' and run rspec against all _spec files)
|
86
|
+
|
87
|
+
rake spec
|
88
|
+
|
89
|
+
* generate rdoc (the rdoc documentation will be generated in ./doc)
|
90
|
+
|
91
|
+
rake rdoc
|
92
|
+
|
93
|
+
* get a list of rake tasks
|
94
|
+
|
95
|
+
rake -T
|
96
|
+
|
97
|
+
* building the gem
|
98
|
+
gem build yql_simple.gemspec
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
Alternative Gems
|
103
|
+
-----------------------------
|
104
|
+
|
105
|
+
https://github.com/nas/yql
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
# get the rake tasks build, install, and release from Bundler
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
# see example
|
8
|
+
# https://github.com/twitter/twitter-text-rb/blob/master/Rakefile
|
9
|
+
desc 'generate API documentation to doc/rdocs/index.html'
|
10
|
+
require 'rdoc/task'
|
11
|
+
|
12
|
+
Rake::RDocTask.new do |rd|
|
13
|
+
namespace :doc do
|
14
|
+
rd.main = "README.rdoc"
|
15
|
+
rd.rdoc_dir = 'doc'
|
16
|
+
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
17
|
+
|
18
|
+
rd.options << '--inline-source'
|
19
|
+
rd.options << '--line-numbers'
|
20
|
+
rd.options << '--all'
|
21
|
+
|
22
|
+
# For the --diagram and --fileboxes options to work you need GraphViz otherwise, delete those.
|
23
|
+
# rd.options << '--fileboxes'
|
24
|
+
# rd.options << '--diagram'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# see http://duckpunching.com/rspec-2-0-rake-tasks
|
29
|
+
desc "Run specs (tests)"
|
30
|
+
RSpec::Core::RakeTask.new do |t|
|
31
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
32
|
+
# Put spec opts in a file named .rspec in root
|
33
|
+
end
|
data/TODO.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
- implement OAuth with YQL (will give the user more calls to YQL)
|
2
|
+
- how to test the validity of the OAuth parameters?
|
3
|
+
|
4
|
+
- add more test
|
5
|
+
|
6
|
+
- make the desired node in the YQL response selectable e.g. query/results/item
|
7
|
+
|
8
|
+
- add [YQL Streaming](http://developer.yahoo.com/yql/guide/yql-odt-streaming.html)
|
9
|
+
|
10
|
+
- how to properly raise exceptions?
|
11
|
+
https://github.com/outsidein/api-rb/blob/master/lib/outside_in/resource/base.rb#L46
|
12
|
+
|
13
|
+
- get a YQL application key here
|
14
|
+
https://developer.apps.yahoo.com/projects
|
15
|
+
|
16
|
+
- externalize the env= URL parameter and allow the use of other customer YQL tables that are not part of the YQL community tables (they can already be used in the YQL query itself but not via an URL parameter)
|
17
|
+
- enable switching SSL on/off
|
18
|
+
- should the top level wrapper of YqlSimple be a class or a module?
|
19
|
+
- handle YQL status codes (which indicate errors)
|
20
|
+
- write some tests for YQL exceptions
|
21
|
+
- currently the ./examples folder is added to the gem. not really good. how to exclude it?
|
data/examples/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
|
5
|
+
require "yql_simple"
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of doing a twitter search via YQL
|
9
|
+
#
|
10
|
+
|
11
|
+
query_string = 'SELECT * FROM twitter.search WHERE q="#ruby" LIMIT 5'
|
12
|
+
response = YqlSimple.query(query_string)
|
13
|
+
|
14
|
+
response["query"]["results"]["results"].each do |tweet|
|
15
|
+
date = Time.parse(tweet["created_at"]).strftime("%Y-%m-%d %H:%M")
|
16
|
+
puts "[#{date}] #{tweet["from_user"]}: #{tweet["text"]}"
|
17
|
+
end
|
data/lib/yql_simple.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'yql_simple/base'
|
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'pp'
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
# Load all required dependencies here manually.
|
6
|
+
# No bundler usage, as this would make the gem dependent on bundler!
|
7
|
+
|
8
|
+
# require 'json'
|
9
|
+
# require 'nokogiri'
|
10
|
+
# require 'curb'
|
11
|
+
require 'httparty'
|
12
|
+
require 'oauth'
|
13
|
+
require 'json'
|
14
|
+
require 'logger'
|
15
|
+
|
16
|
+
module YqlSimple
|
17
|
+
|
18
|
+
class Client
|
19
|
+
include HTTParty
|
20
|
+
base_uri 'https://query.yahooapis.com/v1/public/yql'
|
21
|
+
|
22
|
+
# @@yql_api_url = "https://query.yahooapis.com/v1/public/yql"
|
23
|
+
@@env = "store://datatables.org/alltableswithkeys"
|
24
|
+
|
25
|
+
# attr_accessor :yql_api_url
|
26
|
+
# attr_accessor :env
|
27
|
+
|
28
|
+
#get
|
29
|
+
def self.env
|
30
|
+
@@env
|
31
|
+
end
|
32
|
+
|
33
|
+
#set
|
34
|
+
def self.env= (new_env)
|
35
|
+
@@env = new_env
|
36
|
+
end
|
37
|
+
|
38
|
+
# #get
|
39
|
+
# def self.yql_api_url
|
40
|
+
# @@yql_api_url
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# #set
|
44
|
+
# def self.yql_api_url=(new_yql_api_url)
|
45
|
+
# @@yql_api_url = new_yql_api_url
|
46
|
+
# end
|
47
|
+
|
48
|
+
def initialize()
|
49
|
+
# def initialize(apikey)
|
50
|
+
@log = Logger.new(STDOUT)
|
51
|
+
@log.level = Logger::WARN
|
52
|
+
# @apikey = apikey
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
class SimpleClient < Client
|
58
|
+
include HTTParty
|
59
|
+
base_uri 'https://query.yahooapis.com/v1/public/yql'
|
60
|
+
|
61
|
+
# Runs the given <b>yql_query</b> and returns the complete response.
|
62
|
+
# Depending on the <b>format</b> parameter the result is either a ruby Hash (parsed from JSON) or a Nokogiri::XML::Document. The default is 'json'.
|
63
|
+
# The <b>diagnostics</b parameter specifies whether or not to return query diagnostics. The default is 'false'.
|
64
|
+
#
|
65
|
+
def query(yql_query, format='json', diagnostics='false')
|
66
|
+
# TODO tried to make the necessary parameters more flexibel. failed for now :)
|
67
|
+
# format = (hash.nil? or hash[:format.to_s].nil?) ? 'json' : hash[:format.to_s]
|
68
|
+
# format = (hash && hash[:format]) || 'json'
|
69
|
+
|
70
|
+
@log.info "SimpleClient query()"
|
71
|
+
|
72
|
+
# try to run YQL query. If an error occures return an empty array
|
73
|
+
begin
|
74
|
+
|
75
|
+
#
|
76
|
+
# Httparty version
|
77
|
+
#
|
78
|
+
options = {
|
79
|
+
:query => {
|
80
|
+
:env => SimpleClient.env, #"store://datatables.org/alltableswithkeys",
|
81
|
+
:diagnostics => diagnostics,
|
82
|
+
:format => format,
|
83
|
+
:q => yql_query
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
yahoo_response = self.class.get('/', options)
|
88
|
+
|
89
|
+
#
|
90
|
+
# Curl Version
|
91
|
+
#
|
92
|
+
|
93
|
+
# # put together request URL
|
94
|
+
# full_request_url = "#{@@yql_api_url}?diagnostics=#{diagnostics}"
|
95
|
+
# full_request_url += "&#{@@env}"
|
96
|
+
# full_request_url += "&format=#{format}"
|
97
|
+
# full_request_url += "&q=#{CGI.escape(yql_query)}"
|
98
|
+
|
99
|
+
# request = Curl::Easy.http_get(full_request_url)
|
100
|
+
# request.perform
|
101
|
+
# # pp request.header_str
|
102
|
+
# if format == 'json'
|
103
|
+
# yahoo_response = JSON.parse(request.body_str)
|
104
|
+
# elsif format == 'xml'
|
105
|
+
# yahoo_response = Nokogiri::XML(request.body_str)
|
106
|
+
# end
|
107
|
+
|
108
|
+
rescue Exception => ex
|
109
|
+
puts ex
|
110
|
+
end
|
111
|
+
|
112
|
+
return yahoo_response
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
# from https://github.com/jnunemaker/twitter/blob/b9fcb86e9b5857940e290863474f8137fa899a49/lib/twitter/oauth.rb
|
119
|
+
class OAuthClient < Client
|
120
|
+
attr_reader :ctoken, :csecret, :consumer
|
121
|
+
|
122
|
+
def initialize(ctoken, csecret)
|
123
|
+
super()
|
124
|
+
@ctoken = ctoken
|
125
|
+
@csecret = csecret
|
126
|
+
end
|
127
|
+
|
128
|
+
def consumer
|
129
|
+
@consumer ||= OAuth::Consumer.new(@ctoken, @csecret, config())
|
130
|
+
end
|
131
|
+
|
132
|
+
def config
|
133
|
+
{
|
134
|
+
:site => "https://api.login.yahoo.com",
|
135
|
+
:scheme => :header,
|
136
|
+
:http_method => :post,
|
137
|
+
:request_token_path => "/oauth/v2/get_request_token",
|
138
|
+
:access_token_path => "/oauth/v2/get_access_token"
|
139
|
+
}
|
140
|
+
end
|
141
|
+
|
142
|
+
def access_token
|
143
|
+
@access_token ||= OAuth::AccessToken.new(consumer())
|
144
|
+
end
|
145
|
+
|
146
|
+
def query(yql_query, format='json', diagnostics='false')
|
147
|
+
@log.info "OAuthClient query()"
|
148
|
+
|
149
|
+
# TODO these options are not used yet!!!
|
150
|
+
options = {
|
151
|
+
:env => "store://datatables.org/alltableswithkeys",
|
152
|
+
:diagnostics => diagnostics,
|
153
|
+
:format => format,
|
154
|
+
:q => yql_query
|
155
|
+
}
|
156
|
+
|
157
|
+
# yahoo_response = self.class.get('/', options)
|
158
|
+
options_string = options.map{|k,v| "#{k}=#{CGI.escape(v)}"}.join("&")
|
159
|
+
|
160
|
+
response = access_token.get("http://query.yahooapis.com/v1/yql?#{options_string}")
|
161
|
+
# response = access_token.get("http://query.yahooapis.com/v1/yql",options)
|
162
|
+
return JSON[response.body]
|
163
|
+
end
|
164
|
+
|
165
|
+
def to_str
|
166
|
+
"ctoken: #{@ctoken}, csecret: #{@csecret}"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# require all gems from Bundler (default and development)
|
2
|
+
Bundler.require(:default, :development)
|
3
|
+
|
4
|
+
# the gem itself is available by default
|
5
|
+
# require 'yql_simple'
|
6
|
+
|
7
|
+
# the number of core tables changes but it should be more than 100
|
8
|
+
YQL_CORE_TABLE_COUNT = 100
|
9
|
+
|
10
|
+
# my oauth credentials
|
11
|
+
# TODO set up a dummy account here, as this will be public
|
12
|
+
OAUTH_CONSUMER_KEY = 'dj0yJmk9V3hYVGNTeTNHQ3ZsJmQ9WVdrOWRIQllVRGxNTjJrbWNHbzlNVEV5TlRZd01qSTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wMg--'
|
13
|
+
OAUTH_CONSUMER_SECRET = '4a183185ddc8bd6934f11116cf96895547d97508'
|
14
|
+
|
15
|
+
# Tests
|
16
|
+
# Docs: http://relishapp.com/rspec
|
17
|
+
describe YqlSimple do
|
18
|
+
|
19
|
+
# create a new instance of SimpleClient
|
20
|
+
simple_client = YqlSimple::SimpleClient.new()
|
21
|
+
|
22
|
+
it "OAuth success" do
|
23
|
+
query_string = "SHOW TABLES"
|
24
|
+
|
25
|
+
# create client
|
26
|
+
oauth_client = YqlSimple::OAuthClient.new(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET)
|
27
|
+
|
28
|
+
response = oauth_client.query(query_string, "json", "true")
|
29
|
+
|
30
|
+
core_tables = response["query"]["results"]["table"].select{|entry| not entry.is_a?(Hash)}
|
31
|
+
core_tables.size.should >= YQL_CORE_TABLE_COUNT
|
32
|
+
|
33
|
+
# ----------
|
34
|
+
|
35
|
+
# all commits from the github feed should have an author key
|
36
|
+
query_string = 'SELECT * FROM feed WHERE url="https://github.com/spier/gem_yql_simple/commits/master.atom"'
|
37
|
+
response = oauth_client.query(query_string, 'json')
|
38
|
+
response["query"]["results"]["entry"][0].should have_key("author")
|
39
|
+
end
|
40
|
+
|
41
|
+
# it "OAuth failure" do
|
42
|
+
# query_string = "SHOW TABLES"
|
43
|
+
#
|
44
|
+
# # create client with wrong credentials
|
45
|
+
# oauth_client = YqlSimple::OAuthClient.new("I_AM_WRONG","I_AM_WRONG")
|
46
|
+
# puts oauth_client.to_str
|
47
|
+
#
|
48
|
+
# lambda { oauth_client.query(query_string, "json", "true") }.should raise_error()
|
49
|
+
# end
|
50
|
+
|
51
|
+
|
52
|
+
it "test diagnostics parameter" do
|
53
|
+
query_string = "SHOW TABLES"
|
54
|
+
|
55
|
+
# diagnostics on
|
56
|
+
response = simple_client.query(query_string, "json", "true")
|
57
|
+
# pp response
|
58
|
+
response["query"].should have_key("diagnostics")
|
59
|
+
|
60
|
+
# diagnostics off
|
61
|
+
response = simple_client.query(query_string, "json", "false")
|
62
|
+
response["query"].should_not have_key("diagnostics")
|
63
|
+
end
|
64
|
+
|
65
|
+
# when using HTTParty the response is already a Ruby object
|
66
|
+
|
67
|
+
# it "test XML response" do
|
68
|
+
# query_string = "SHOW TABLES"
|
69
|
+
#
|
70
|
+
# response = YqlSimple.query(query_string, 'xml')
|
71
|
+
#
|
72
|
+
# response.class.should be_a(Nokogiri::XML::Document.class)
|
73
|
+
# end
|
74
|
+
|
75
|
+
it "test JSON response" do
|
76
|
+
query_string = "SHOW TABLES"
|
77
|
+
|
78
|
+
response = simple_client.query(query_string, 'json')
|
79
|
+
|
80
|
+
response.class.should be_a(Hash.class)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "test for YQL core tables" do
|
84
|
+
query_string = "SHOW TABLES"
|
85
|
+
|
86
|
+
response = simple_client.query(query_string, 'json')
|
87
|
+
|
88
|
+
core_tables = response["query"]["results"]["table"].select{|entry| not entry.is_a?(Hash)}
|
89
|
+
core_tables.size.should >= YQL_CORE_TABLE_COUNT
|
90
|
+
end
|
91
|
+
|
92
|
+
it "test some simple YQL calls" do
|
93
|
+
# should return a status code of 200
|
94
|
+
# query_string = 'SELECT * FROM data.headers WHERE url="https://github.com/spier/gem_yql_simple"'
|
95
|
+
# response = YqlSimple.query(query_string, 'json')
|
96
|
+
# pp response
|
97
|
+
# response["query"]["results"]["resources"]["status"].should == "200"
|
98
|
+
|
99
|
+
# all commits from the github feed should have an author key
|
100
|
+
query_string = 'SELECT * FROM feed WHERE url="https://github.com/spier/gem_yql_simple/commits/master.atom"'
|
101
|
+
response = simple_client.query(query_string, 'json')
|
102
|
+
response["query"]["results"]["entry"][0].should have_key("author")
|
103
|
+
|
104
|
+
# YQL queries to github are forbidden
|
105
|
+
expected_error_msg = 'Redirected to a robots.txt restricted URL: https://github.com/spier/gem_yql_simple'
|
106
|
+
query_string = 'SELECT * FROM html WHERE url="https://github.com/spier/gem_yql_simple"'
|
107
|
+
response = simple_client.query(query_string, 'json',"true")
|
108
|
+
response["query"]["diagnostics"]["url"]["error"].should == expected_error_msg
|
109
|
+
end
|
110
|
+
|
111
|
+
it "test variable access" do
|
112
|
+
# test set env
|
113
|
+
env = "something"
|
114
|
+
YqlSimple::SimpleClient.env = env
|
115
|
+
YqlSimple::SimpleClient.env.should == env
|
116
|
+
|
117
|
+
# # test set yql_api_url
|
118
|
+
# yql_api = "url_to_api"
|
119
|
+
# YqlSimple.yql_api_url = yql_api
|
120
|
+
# YqlSimple.yql_api_url.should == yql_api
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
data/yql_simple.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "yql_simple/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
# general gem information
|
7
|
+
s.name = "yql_simple"
|
8
|
+
s.version = YqlSimple::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Sebastian Spier"]
|
11
|
+
s.email = ["blog@airness.de"]
|
12
|
+
s.homepage = "https://github.com/spier/gem_yql_simple"
|
13
|
+
s.description = s.summary = %q{Simple wrapper for calls to YQL}
|
14
|
+
|
15
|
+
s.rdoc_options << '--title' << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
16
|
+
#s.rubyforge_project = "yql_simple"
|
17
|
+
|
18
|
+
# all dependencies of this gem
|
19
|
+
# s.add_dependency "nokogiri"
|
20
|
+
s.add_dependency "json"
|
21
|
+
# s.add_dependency "curb"
|
22
|
+
s.add_dependency "httparty"
|
23
|
+
s.add_dependency "oauth"
|
24
|
+
|
25
|
+
# dependencies when developing this gem
|
26
|
+
s.add_development_dependency "rspec"
|
27
|
+
s.add_development_dependency "rake"
|
28
|
+
|
29
|
+
# all files that will be added to this gem. git is used for this
|
30
|
+
s.files = `git ls-files`.split("\n")
|
31
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
32
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yql_simple
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sebastian Spier
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: &2803540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2803540
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: httparty
|
27
|
+
requirement: &2803330 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2803330
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: oauth
|
38
|
+
requirement: &2803120 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2803120
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &2802910 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2802910
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &2802700 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2802700
|
69
|
+
description: Simple wrapper for calls to YQL
|
70
|
+
email:
|
71
|
+
- blog@airness.de
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .travis.yml
|
78
|
+
- Gemfile
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- TODO.md
|
82
|
+
- examples/Gemfile
|
83
|
+
- examples/gem_usage.rb
|
84
|
+
- lib/yql_simple.rb
|
85
|
+
- lib/yql_simple/base.rb
|
86
|
+
- lib/yql_simple/version.rb
|
87
|
+
- spec/yql_simple_spec.rb
|
88
|
+
- yql_simple.gemspec
|
89
|
+
homepage: https://github.com/spier/gem_yql_simple
|
90
|
+
licenses: []
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options:
|
93
|
+
- --title
|
94
|
+
- --main
|
95
|
+
- README.rdoc
|
96
|
+
- --line-numbers
|
97
|
+
- --inline-source
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.8.6
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: Simple wrapper for calls to YQL
|
118
|
+
test_files:
|
119
|
+
- spec/yql_simple_spec.rb
|