hastests 0.5.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.
- data/.document +5 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +27 -0
- data/Rakefile +54 -0
- data/lib/hastests.rb +1 -0
- data/lib/hastests/data.rb +24 -0
- data/test/helper.rb +18 -0
- metadata +160 -0
data/.document
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
source "http://rubygems.org"
|
|
2
|
+
# Add dependencies required to use your gem here.
|
|
3
|
+
# Example:
|
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
|
5
|
+
|
|
6
|
+
# Add dependencies to develop your gem here.
|
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
|
8
|
+
group :development do
|
|
9
|
+
gem "shoulda", ">= 0"
|
|
10
|
+
gem "bundler", "~> 1.0.0"
|
|
11
|
+
gem "jeweler", "~> 1.6.4"
|
|
12
|
+
gem "rcov", ">= 0"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
gem "rest-client"
|
|
16
|
+
gem "json"
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Spawngrid, Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
= HasTests API
|
|
2
|
+
|
|
3
|
+
Library for accessing HasTests API (http://hastests.com) services from Ruby
|
|
4
|
+
|
|
5
|
+
== Example
|
|
6
|
+
|
|
7
|
+
require 'rubygems'
|
|
8
|
+
require 'hastests'
|
|
9
|
+
|
|
10
|
+
>> ht = Hastests::Data.new("internet.email().list()")
|
|
11
|
+
|
|
12
|
+
# Random sampling:
|
|
13
|
+
|
|
14
|
+
>> ht.generate()["data"]
|
|
15
|
+
>> ht.generate()["data"]
|
|
16
|
+
>> ht.generate()["data"]
|
|
17
|
+
|
|
18
|
+
# Repeatable sampling:
|
|
19
|
+
|
|
20
|
+
>> ht.generate(123)["data"]
|
|
21
|
+
>> ht.generate(123)["data"]
|
|
22
|
+
>> ht.generate(123)["data"]
|
|
23
|
+
|
|
24
|
+
== Copyright
|
|
25
|
+
|
|
26
|
+
Copyright (c) 2011, Spawngrid, Inc.
|
|
27
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'bundler'
|
|
5
|
+
begin
|
|
6
|
+
Bundler.setup(:default, :development)
|
|
7
|
+
rescue Bundler::BundlerError => e
|
|
8
|
+
$stderr.puts e.message
|
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
10
|
+
exit e.status_code
|
|
11
|
+
end
|
|
12
|
+
require 'rake'
|
|
13
|
+
|
|
14
|
+
require 'jeweler'
|
|
15
|
+
Jeweler::Tasks.new do |gem|
|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
|
+
gem.name = "hastests"
|
|
18
|
+
gem.homepage = "http://github.com/spawngrid/hastests-ruby"
|
|
19
|
+
gem.license = "MIT"
|
|
20
|
+
gem.summary = %Q{HasTests API Client}
|
|
21
|
+
gem.description = %Q{HasTests API Client for Ruby}
|
|
22
|
+
gem.email = "team@spawngrid.com"
|
|
23
|
+
gem.authors = ["Spawngrid, Inc."]
|
|
24
|
+
gem.version = "0.5.0"
|
|
25
|
+
# dependencies defined in Gemfile
|
|
26
|
+
end
|
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
28
|
+
|
|
29
|
+
require 'rake/testtask'
|
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
|
31
|
+
test.libs << 'lib' << 'test'
|
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
|
33
|
+
test.verbose = true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
require 'rcov/rcovtask'
|
|
37
|
+
Rcov::RcovTask.new do |test|
|
|
38
|
+
test.libs << 'test'
|
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
|
40
|
+
test.verbose = true
|
|
41
|
+
test.rcov_opts << '--exclude "gems/*"'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
task :default => :test
|
|
45
|
+
|
|
46
|
+
require 'rake/rdoctask'
|
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
49
|
+
|
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
51
|
+
rdoc.title = "hastests #{version}"
|
|
52
|
+
rdoc.rdoc_files.include('README*')
|
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
54
|
+
end
|
data/lib/hastests.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'hastests/data'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'rest_client'
|
|
4
|
+
|
|
5
|
+
module Hastests
|
|
6
|
+
API_URL = 'http://api.hastests.com/'
|
|
7
|
+
class Service
|
|
8
|
+
end
|
|
9
|
+
class Data < Service
|
|
10
|
+
def initialize(script)
|
|
11
|
+
@script = script
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def generate(seed=nil)
|
|
15
|
+
params = {:q => @script}
|
|
16
|
+
if seed!=nil
|
|
17
|
+
params[:seed]=seed
|
|
18
|
+
end
|
|
19
|
+
response = RestClient.get(Hastests::API_URL + 'data', :params => params,
|
|
20
|
+
:headers => {:connection => "Keep-Alive"})
|
|
21
|
+
return JSON.parse(response.body)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/test/helper.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
begin
|
|
4
|
+
Bundler.setup(:default, :development)
|
|
5
|
+
rescue Bundler::BundlerError => e
|
|
6
|
+
$stderr.puts e.message
|
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
8
|
+
exit e.status_code
|
|
9
|
+
end
|
|
10
|
+
require 'test/unit'
|
|
11
|
+
require 'shoulda'
|
|
12
|
+
|
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
15
|
+
require 'hastests'
|
|
16
|
+
|
|
17
|
+
class Test::Unit::TestCase
|
|
18
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hastests
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 11
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 5
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.5.0
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Spawngrid, Inc.
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-12-14 00:00:00 Z
|
|
19
|
+
dependencies:
|
|
20
|
+
- !ruby/object:Gem::Dependency
|
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
22
|
+
none: false
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
hash: 3
|
|
27
|
+
segments:
|
|
28
|
+
- 0
|
|
29
|
+
version: "0"
|
|
30
|
+
type: :runtime
|
|
31
|
+
requirement: *id001
|
|
32
|
+
prerelease: false
|
|
33
|
+
name: rest-client
|
|
34
|
+
- !ruby/object:Gem::Dependency
|
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
36
|
+
none: false
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
hash: 3
|
|
41
|
+
segments:
|
|
42
|
+
- 0
|
|
43
|
+
version: "0"
|
|
44
|
+
type: :runtime
|
|
45
|
+
requirement: *id002
|
|
46
|
+
prerelease: false
|
|
47
|
+
name: json
|
|
48
|
+
- !ruby/object:Gem::Dependency
|
|
49
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
50
|
+
none: false
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
hash: 3
|
|
55
|
+
segments:
|
|
56
|
+
- 0
|
|
57
|
+
version: "0"
|
|
58
|
+
type: :development
|
|
59
|
+
requirement: *id003
|
|
60
|
+
prerelease: false
|
|
61
|
+
name: shoulda
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
65
|
+
requirements:
|
|
66
|
+
- - ~>
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
hash: 23
|
|
69
|
+
segments:
|
|
70
|
+
- 1
|
|
71
|
+
- 0
|
|
72
|
+
- 0
|
|
73
|
+
version: 1.0.0
|
|
74
|
+
type: :development
|
|
75
|
+
requirement: *id004
|
|
76
|
+
prerelease: false
|
|
77
|
+
name: bundler
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
80
|
+
none: false
|
|
81
|
+
requirements:
|
|
82
|
+
- - ~>
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
hash: 7
|
|
85
|
+
segments:
|
|
86
|
+
- 1
|
|
87
|
+
- 6
|
|
88
|
+
- 4
|
|
89
|
+
version: 1.6.4
|
|
90
|
+
type: :development
|
|
91
|
+
requirement: *id005
|
|
92
|
+
prerelease: false
|
|
93
|
+
name: jeweler
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
96
|
+
none: false
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
hash: 3
|
|
101
|
+
segments:
|
|
102
|
+
- 0
|
|
103
|
+
version: "0"
|
|
104
|
+
type: :development
|
|
105
|
+
requirement: *id006
|
|
106
|
+
prerelease: false
|
|
107
|
+
name: rcov
|
|
108
|
+
description: HasTests API Client for Ruby
|
|
109
|
+
email: team@spawngrid.com
|
|
110
|
+
executables: []
|
|
111
|
+
|
|
112
|
+
extensions: []
|
|
113
|
+
|
|
114
|
+
extra_rdoc_files:
|
|
115
|
+
- LICENSE.txt
|
|
116
|
+
- README.rdoc
|
|
117
|
+
files:
|
|
118
|
+
- .document
|
|
119
|
+
- Gemfile
|
|
120
|
+
- LICENSE.txt
|
|
121
|
+
- README.rdoc
|
|
122
|
+
- Rakefile
|
|
123
|
+
- lib/hastests.rb
|
|
124
|
+
- lib/hastests/data.rb
|
|
125
|
+
- test/helper.rb
|
|
126
|
+
homepage: http://github.com/spawngrid/hastests-ruby
|
|
127
|
+
licenses:
|
|
128
|
+
- MIT
|
|
129
|
+
post_install_message:
|
|
130
|
+
rdoc_options: []
|
|
131
|
+
|
|
132
|
+
require_paths:
|
|
133
|
+
- lib
|
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
|
+
none: false
|
|
136
|
+
requirements:
|
|
137
|
+
- - ">="
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
hash: 3
|
|
140
|
+
segments:
|
|
141
|
+
- 0
|
|
142
|
+
version: "0"
|
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
|
+
none: false
|
|
145
|
+
requirements:
|
|
146
|
+
- - ">="
|
|
147
|
+
- !ruby/object:Gem::Version
|
|
148
|
+
hash: 3
|
|
149
|
+
segments:
|
|
150
|
+
- 0
|
|
151
|
+
version: "0"
|
|
152
|
+
requirements: []
|
|
153
|
+
|
|
154
|
+
rubyforge_project:
|
|
155
|
+
rubygems_version: 1.8.5
|
|
156
|
+
signing_key:
|
|
157
|
+
specification_version: 3
|
|
158
|
+
summary: HasTests API Client
|
|
159
|
+
test_files: []
|
|
160
|
+
|