houdini 0.2.4 → 0.3.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/.gitignore +3 -1
- data/Gemfile.lock +97 -88
- data/README.markdown +31 -27
- data/app/controllers/houdini/postbacks_controller.rb +7 -9
- data/config/routes.rb +2 -2
- data/houdini.gemspec +3 -2
- data/lib/houdini.rb +35 -7
- data/lib/houdini/model.rb +14 -49
- data/lib/houdini/postback_processor.rb +21 -0
- data/lib/houdini/task.rb +46 -10
- data/lib/houdini/task_manager.rb +20 -0
- data/lib/houdini/version.rb +1 -1
- data/spec/dummy/app/models/article.rb +12 -14
- data/spec/houdini/model_spec.rb +27 -0
- data/spec/houdini/postback_processor_spec.rb +44 -0
- data/spec/houdini/task_manager_spec.rb +26 -0
- data/spec/houdini/task_spec.rb +136 -0
- data/spec/houdini_spec.rb +25 -0
- data/spec/requests/integration_spec.rb +21 -19
- data/spec/spec_helper.rb +3 -3
- metadata +76 -118
- data/lib/houdini/base.rb +0 -35
- data/spec/controllers/houdini/postbacks_controller_spec.rb +0 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -10
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +0 -2
- data/spec/dummy/public/javascripts/controls.js +0 -965
- data/spec/dummy/public/javascripts/dragdrop.js +0 -974
- data/spec/dummy/public/javascripts/effects.js +0 -1123
- data/spec/dummy/public/javascripts/prototype.js +0 -6001
- data/spec/dummy/public/javascripts/rails.js +0 -175
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/houdini_rails_spec.rb +0 -4
data/spec/spec_helper.rb
CHANGED
@@ -16,9 +16,9 @@ Capybara.default_driver = :rack_test
|
|
16
16
|
Capybara.default_selector = :css
|
17
17
|
|
18
18
|
# Run migrations
|
19
|
-
db_path = File.expand_path("../dummy/db/test.sqlite3/", __FILE__)
|
20
|
-
`rm #{db_path}` if File.exists?(db_path)
|
21
|
-
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
19
|
+
# db_path = File.expand_path("../dummy/db/test.sqlite3/", __FILE__)
|
20
|
+
# `rm #{db_path}` if File.exists?(db_path)
|
21
|
+
# ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
22
22
|
|
23
23
|
# Load support files
|
24
24
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
metadata
CHANGED
@@ -1,94 +1,77 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: houdini
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 4
|
10
|
-
version: 0.2.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Chris Conley
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-20 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rails
|
23
|
-
|
16
|
+
requirement: &2155252860 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 7
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>'
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 3.0.0
|
34
|
-
prerelease: false
|
35
22
|
type: :runtime
|
36
|
-
|
37
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2155252860
|
25
|
+
- !ruby/object:Gem::Dependency
|
38
26
|
name: rspec-rails
|
39
|
-
|
27
|
+
requirement: &2155243400 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 5
|
48
|
-
- 0
|
49
|
-
version: 2.5.0
|
50
|
-
prerelease: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.8.1
|
51
33
|
type: :development
|
52
|
-
|
53
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2155243400
|
36
|
+
- !ruby/object:Gem::Dependency
|
54
37
|
name: capybara
|
55
|
-
|
38
|
+
requirement: &2155242160 !ruby/object:Gem::Requirement
|
56
39
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 13
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 4
|
64
|
-
- 1
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
65
43
|
version: 0.4.1
|
66
|
-
prerelease: false
|
67
44
|
type: :development
|
68
|
-
|
69
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2155242160
|
47
|
+
- !ruby/object:Gem::Dependency
|
70
48
|
name: sqlite3-ruby
|
71
|
-
|
49
|
+
requirement: &2155240700 !ruby/object:Gem::Requirement
|
72
50
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
- 0
|
79
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
80
56
|
prerelease: false
|
57
|
+
version_requirements: *2155240700
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &2155239280 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.8.7
|
81
66
|
type: :development
|
82
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2155239280
|
83
69
|
description: Rails 3 Engine for using the Houdini Mechanical Turk API
|
84
70
|
email: chris@houdiniapi.com
|
85
71
|
executables: []
|
86
|
-
|
87
72
|
extensions: []
|
88
|
-
|
89
73
|
extra_rdoc_files: []
|
90
|
-
|
91
|
-
files:
|
74
|
+
files:
|
92
75
|
- .document
|
93
76
|
- .gitignore
|
94
77
|
- .rspec
|
@@ -101,12 +84,12 @@ files:
|
|
101
84
|
- config/routes.rb
|
102
85
|
- houdini.gemspec
|
103
86
|
- lib/houdini.rb
|
104
|
-
- lib/houdini/base.rb
|
105
87
|
- lib/houdini/engine.rb
|
106
88
|
- lib/houdini/model.rb
|
89
|
+
- lib/houdini/postback_processor.rb
|
107
90
|
- lib/houdini/task.rb
|
91
|
+
- lib/houdini/task_manager.rb
|
108
92
|
- lib/houdini/version.rb
|
109
|
-
- spec/controllers/houdini/postbacks_controller_spec.rb
|
110
93
|
- spec/dummy/Rakefile
|
111
94
|
- spec/dummy/app/controllers/application_controller.rb
|
112
95
|
- spec/dummy/app/helpers/application_helper.rb
|
@@ -123,9 +106,6 @@ files:
|
|
123
106
|
- spec/dummy/config/environments/development.rb
|
124
107
|
- spec/dummy/config/environments/production.rb
|
125
108
|
- spec/dummy/config/environments/test.rb
|
126
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
127
|
-
- spec/dummy/config/initializers/inflections.rb
|
128
|
-
- spec/dummy/config/initializers/mime_types.rb
|
129
109
|
- spec/dummy/config/initializers/secret_token.rb
|
130
110
|
- spec/dummy/config/initializers/session_store.rb
|
131
111
|
- spec/dummy/config/locales/en.yml
|
@@ -133,57 +113,45 @@ files:
|
|
133
113
|
- spec/dummy/db/migrate/001_create_posts.rb
|
134
114
|
- spec/dummy/db/migrate/002_create_product_reviews.rb
|
135
115
|
- spec/dummy/db/migrate/003_create_articles.rb
|
136
|
-
- spec/dummy/public/404.html
|
137
|
-
- spec/dummy/public/422.html
|
138
|
-
- spec/dummy/public/500.html
|
139
|
-
- spec/dummy/public/favicon.ico
|
140
|
-
- spec/dummy/public/javascripts/application.js
|
141
|
-
- spec/dummy/public/javascripts/controls.js
|
142
|
-
- spec/dummy/public/javascripts/dragdrop.js
|
143
|
-
- spec/dummy/public/javascripts/effects.js
|
144
|
-
- spec/dummy/public/javascripts/prototype.js
|
145
|
-
- spec/dummy/public/javascripts/rails.js
|
146
|
-
- spec/dummy/public/stylesheets/.gitkeep
|
147
116
|
- spec/dummy/script/rails
|
148
|
-
- spec/
|
117
|
+
- spec/houdini/model_spec.rb
|
118
|
+
- spec/houdini/postback_processor_spec.rb
|
119
|
+
- spec/houdini/task_manager_spec.rb
|
120
|
+
- spec/houdini/task_spec.rb
|
121
|
+
- spec/houdini_spec.rb
|
149
122
|
- spec/requests/integration_spec.rb
|
150
123
|
- spec/spec_helper.rb
|
151
|
-
has_rdoc: true
|
152
124
|
homepage: http://github.com/chrisconley/houdini-gem
|
153
125
|
licenses: []
|
154
|
-
|
155
126
|
post_install_message:
|
156
127
|
rdoc_options: []
|
157
|
-
|
158
|
-
require_paths:
|
128
|
+
require_paths:
|
159
129
|
- lib
|
160
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
131
|
none: false
|
162
|
-
requirements:
|
163
|
-
- -
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
166
|
-
segments:
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
segments:
|
167
137
|
- 0
|
168
|
-
|
169
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
hash: 796620986588829082
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
140
|
none: false
|
171
|
-
requirements:
|
172
|
-
- -
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
|
175
|
-
segments:
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
segments:
|
176
146
|
- 0
|
177
|
-
|
147
|
+
hash: 796620986588829082
|
178
148
|
requirements: []
|
179
|
-
|
180
149
|
rubyforge_project:
|
181
|
-
rubygems_version: 1.
|
150
|
+
rubygems_version: 1.8.10
|
182
151
|
signing_key:
|
183
152
|
specification_version: 3
|
184
153
|
summary: Rails 3 Engine for using the Houdini Mechanical Turk API
|
185
|
-
test_files:
|
186
|
-
- spec/controllers/houdini/postbacks_controller_spec.rb
|
154
|
+
test_files:
|
187
155
|
- spec/dummy/Rakefile
|
188
156
|
- spec/dummy/app/controllers/application_controller.rb
|
189
157
|
- spec/dummy/app/helpers/application_helper.rb
|
@@ -200,9 +168,6 @@ test_files:
|
|
200
168
|
- spec/dummy/config/environments/development.rb
|
201
169
|
- spec/dummy/config/environments/production.rb
|
202
170
|
- spec/dummy/config/environments/test.rb
|
203
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
204
|
-
- spec/dummy/config/initializers/inflections.rb
|
205
|
-
- spec/dummy/config/initializers/mime_types.rb
|
206
171
|
- spec/dummy/config/initializers/secret_token.rb
|
207
172
|
- spec/dummy/config/initializers/session_store.rb
|
208
173
|
- spec/dummy/config/locales/en.yml
|
@@ -210,18 +175,11 @@ test_files:
|
|
210
175
|
- spec/dummy/db/migrate/001_create_posts.rb
|
211
176
|
- spec/dummy/db/migrate/002_create_product_reviews.rb
|
212
177
|
- spec/dummy/db/migrate/003_create_articles.rb
|
213
|
-
- spec/dummy/public/404.html
|
214
|
-
- spec/dummy/public/422.html
|
215
|
-
- spec/dummy/public/500.html
|
216
|
-
- spec/dummy/public/favicon.ico
|
217
|
-
- spec/dummy/public/javascripts/application.js
|
218
|
-
- spec/dummy/public/javascripts/controls.js
|
219
|
-
- spec/dummy/public/javascripts/dragdrop.js
|
220
|
-
- spec/dummy/public/javascripts/effects.js
|
221
|
-
- spec/dummy/public/javascripts/prototype.js
|
222
|
-
- spec/dummy/public/javascripts/rails.js
|
223
|
-
- spec/dummy/public/stylesheets/.gitkeep
|
224
178
|
- spec/dummy/script/rails
|
225
|
-
- spec/
|
179
|
+
- spec/houdini/model_spec.rb
|
180
|
+
- spec/houdini/postback_processor_spec.rb
|
181
|
+
- spec/houdini/task_manager_spec.rb
|
182
|
+
- spec/houdini/task_spec.rb
|
183
|
+
- spec/houdini_spec.rb
|
226
184
|
- spec/requests/integration_spec.rb
|
227
185
|
- spec/spec_helper.rb
|
data/lib/houdini/base.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module Houdini
|
2
|
-
RequestError = Class.new(NameError)
|
3
|
-
HostError = Class.new(NameError)
|
4
|
-
|
5
|
-
HOST = 'v0.houdiniapi.com'
|
6
|
-
|
7
|
-
class Base
|
8
|
-
def self.request(params)
|
9
|
-
|
10
|
-
puts "sending #{params.to_json} to houdini"
|
11
|
-
validate_config
|
12
|
-
|
13
|
-
url = File.join("https://", HOST, "tasks.json")
|
14
|
-
uri = URI.parse(url)
|
15
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
16
|
-
http.use_ssl = true
|
17
|
-
response, body = http.post(uri.path, params.to_json)
|
18
|
-
|
19
|
-
if response.code != "200"
|
20
|
-
raise RequestError, "The request to houdini failed with code #{response.code}: #{body}"
|
21
|
-
end
|
22
|
-
|
23
|
-
[response, body]
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def self.validate_config
|
29
|
-
#TODO: validate params in Houdini.setup
|
30
|
-
raise HostError, "Houdini.app_url should specify http:// or https://" unless Houdini.app_url.match(/^https?\:\/\//)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
end
|
File without changes
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
data/spec/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
File without changes
|