crowdflower 0.6.3 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/crowdflower.gemspec +29 -28
- data/lib/crowdflower/base.rb +13 -4
- data/lib/crowdflower/job.rb +1 -0
- data/lib/crowdflower/judgment.rb +2 -2
- metadata +10 -9
data/.gitignore
ADDED
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ EOF
|
|
15
15
|
gem.email = "brian@doloreslabs.com"
|
16
16
|
gem.homepage = "http://github.com/dolores/ruby-crowdflower"
|
17
17
|
gem.authors = ["Brian P O'Rourke", "Chris Van Pelt"]
|
18
|
-
gem.add_dependency 'httparty', '>= 0.4
|
18
|
+
gem.add_dependency 'httparty', '>= 0.7.4'
|
19
19
|
end
|
20
20
|
|
21
21
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/crowdflower.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{crowdflower}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian P O'Rourke", "Chris Van Pelt"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-24}
|
13
13
|
s.description = %q{A toolkit for interacting with CrowdFlower via the REST API.
|
14
14
|
|
15
15
|
This is alpha software. Have fun!
|
@@ -18,32 +18,34 @@ This is alpha software. Have fun!
|
|
18
18
|
s.email = %q{brian@doloreslabs.com}
|
19
19
|
s.extra_rdoc_files = [
|
20
20
|
"LICENSE",
|
21
|
-
|
21
|
+
"README.md"
|
22
22
|
]
|
23
23
|
s.files = [
|
24
24
|
".document",
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
25
|
+
".gitignore",
|
26
|
+
"CONTRIBUTORS",
|
27
|
+
"HISTORY.md",
|
28
|
+
"LICENSE",
|
29
|
+
"README.md",
|
30
|
+
"Rakefile",
|
31
|
+
"VERSION",
|
32
|
+
"bindev/cl_skel.rb",
|
33
|
+
"bindev/crowdflower.rb",
|
34
|
+
"crowdflower.gemspec",
|
35
|
+
"lib/crowdflower.rb",
|
36
|
+
"lib/crowdflower/base.rb",
|
37
|
+
"lib/crowdflower/job.rb",
|
38
|
+
"lib/crowdflower/judgment.rb",
|
39
|
+
"lib/crowdflower/order.rb",
|
40
|
+
"lib/crowdflower/unit.rb",
|
41
|
+
"lib/crowdflower/worker.rb",
|
42
|
+
"test/integration_tests.rb",
|
43
|
+
"test/sample.csv"
|
43
44
|
]
|
44
45
|
s.homepage = %q{http://github.com/dolores/ruby-crowdflower}
|
46
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
47
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.
|
48
|
+
s.rubygems_version = %q{1.6.2}
|
47
49
|
s.summary = %q{a toolkit for the CrowdFlower API}
|
48
50
|
s.test_files = [
|
49
51
|
"test/integration_tests.rb"
|
@@ -53,12 +55,11 @@ This is alpha software. Have fun!
|
|
53
55
|
s.specification_version = 3
|
54
56
|
|
55
57
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<httparty>, [">= 0.4
|
58
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.7.4"])
|
57
59
|
else
|
58
|
-
s.add_dependency(%q<httparty>, [">= 0.4
|
60
|
+
s.add_dependency(%q<httparty>, [">= 0.7.4"])
|
59
61
|
end
|
60
62
|
else
|
61
|
-
s.add_dependency(%q<httparty>, [">= 0.4
|
63
|
+
s.add_dependency(%q<httparty>, [">= 0.7.4"])
|
62
64
|
end
|
63
65
|
end
|
64
|
-
|
data/lib/crowdflower/base.rb
CHANGED
@@ -4,12 +4,15 @@ module CrowdFlower
|
|
4
4
|
|
5
5
|
class UsageError < StandardError ; end
|
6
6
|
|
7
|
+
class APIWarning < StandardError ; end
|
8
|
+
|
7
9
|
class APIError < StandardError
|
8
10
|
attr_reader :details
|
9
11
|
|
10
12
|
def initialize(hash)
|
11
13
|
@details = hash
|
12
|
-
|
14
|
+
|
15
|
+
super(hash.inspect)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
@@ -163,11 +166,17 @@ module CrowdFlower
|
|
163
166
|
end
|
164
167
|
end
|
165
168
|
|
166
|
-
|
167
|
-
if response[
|
168
|
-
|
169
|
+
def self.verify_response(response)
|
170
|
+
if response.respond_to?(:[])
|
171
|
+
if error = (response["errors"] || response["error"])
|
172
|
+
raise CrowdFlower::APIError.new(error)
|
173
|
+
elsif warning = response["warning"]
|
174
|
+
raise CrowdFlower::APIWarning.new(warning)
|
175
|
+
end
|
169
176
|
elsif response.response.kind_of? Net::HTTPUnauthorized
|
170
177
|
raise CrowdFlower::APIError.new('message' => response.to_s)
|
178
|
+
elsif (500...600).include?(response.code)
|
179
|
+
raise CrowdFlower::APIError.new('message' => response.to_s)
|
171
180
|
end
|
172
181
|
end
|
173
182
|
|
data/lib/crowdflower/job.rb
CHANGED
data/lib/crowdflower/judgment.rb
CHANGED
@@ -27,8 +27,8 @@ module CrowdFlower
|
|
27
27
|
# *Admin-only && MTurk-only*
|
28
28
|
#
|
29
29
|
# @param [String,Integer] id The CrowdFlower id for the judgment to reject.
|
30
|
-
def reject( id, reedo = false )
|
31
|
-
connection.put( "#{resource_uri}/#{id}/reject", :headers => { "Content-Length" => "0" }, :body => { :redo => reedo ? "true" : "false" } )
|
30
|
+
def reject( id, reedo = false, do_amt_reject = false )
|
31
|
+
connection.put( "#{resource_uri}/#{id}/reject", :headers => { "Content-Length" => "0" }, :body => { :redo => reedo ? "true" : "false", :do_amt_reject => do_amt_reject ? "true" : "false" } )
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdflower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 7
|
10
|
+
version: 0.6.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian P O'Rourke
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-24 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 11
|
31
31
|
segments:
|
32
32
|
- 0
|
33
|
+
- 7
|
33
34
|
- 4
|
34
|
-
|
35
|
-
version: 0.4.3
|
35
|
+
version: 0.7.4
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
description: |+
|
@@ -50,6 +50,7 @@ extra_rdoc_files:
|
|
50
50
|
- README.md
|
51
51
|
files:
|
52
52
|
- .document
|
53
|
+
- .gitignore
|
53
54
|
- CONTRIBUTORS
|
54
55
|
- HISTORY.md
|
55
56
|
- LICENSE
|
@@ -73,8 +74,8 @@ homepage: http://github.com/dolores/ruby-crowdflower
|
|
73
74
|
licenses: []
|
74
75
|
|
75
76
|
post_install_message:
|
76
|
-
rdoc_options:
|
77
|
-
|
77
|
+
rdoc_options:
|
78
|
+
- --charset=UTF-8
|
78
79
|
require_paths:
|
79
80
|
- lib
|
80
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|