crowdflower 0.5.8 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/crowdflower.gemspec +3 -4
- data/lib/crowdflower/base.rb +2 -1
- data/lib/crowdflower/job.rb +3 -2
- data/lib/crowdflower/unit.rb +1 -1
- data/test/integration_tests.rb +3 -3
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.9
|
data/crowdflower.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{crowdflower}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
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-02-
|
12
|
+
s.date = %q{2011-02-27}
|
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!
|
@@ -43,14 +43,13 @@ This is alpha software. Have fun!
|
|
43
43
|
]
|
44
44
|
s.homepage = %q{http://github.com/dolores/ruby-crowdflower}
|
45
45
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.
|
46
|
+
s.rubygems_version = %q{1.4.2}
|
47
47
|
s.summary = %q{a toolkit for the CrowdFlower API}
|
48
48
|
s.test_files = [
|
49
49
|
"test/integration_tests.rb"
|
50
50
|
]
|
51
51
|
|
52
52
|
if s.respond_to? :specification_version then
|
53
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
53
|
s.specification_version = 3
|
55
54
|
|
56
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/crowdflower/base.rb
CHANGED
@@ -37,10 +37,11 @@ module CrowdFlower
|
|
37
37
|
def initialize(key, domain_base, version, ssl_port = 443, public_port = 80)
|
38
38
|
@domain_base = domain_base
|
39
39
|
@version = version
|
40
|
-
@domain = "#{@domain_base}/v#{version}"
|
41
40
|
@key = key
|
42
41
|
@ssl_port = ssl_port
|
43
42
|
@public_port = public_port
|
43
|
+
port = @domain_base =~ /^https/ ? @ssl_port : @public_port
|
44
|
+
@domain = "#{@domain_base}:#{port}/v#{version}"
|
44
45
|
begin # pass yaml file
|
45
46
|
key = YAML.load_file(key)
|
46
47
|
@key = key[:key] || key["key"]
|
data/lib/crowdflower/job.rb
CHANGED
@@ -21,7 +21,7 @@ module CrowdFlower
|
|
21
21
|
get(resource_uri)
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.upload(file, content_type, job = nil)
|
24
|
+
def self.upload(file, content_type, job = nil, opts = {})
|
25
25
|
connect
|
26
26
|
|
27
27
|
job_uri = job ? "/#{job.kind_of?(Job) ? job.id : job}" : ""
|
@@ -29,7 +29,8 @@ module CrowdFlower
|
|
29
29
|
upload_uri = "#{resource_uri}/#{job_uri}/upload".squeeze("/")
|
30
30
|
res = conn.post(upload_uri,
|
31
31
|
:body => File.read(file),
|
32
|
-
:headers => {"content-type" => content_type}
|
32
|
+
:headers => {"content-type" => content_type},
|
33
|
+
:query => opts)
|
33
34
|
|
34
35
|
verify_response res
|
35
36
|
job.kind_of?(Job) ? job : self.new(res["id"], conn)
|
data/lib/crowdflower/unit.rb
CHANGED
@@ -29,7 +29,7 @@ module CrowdFlower
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def create(data, gold = false)
|
32
|
-
connection.post(resource_uri, {:
|
32
|
+
connection.post(resource_uri, {:body => {:unit => {:data => data.to_json, :golden => gold}}})
|
33
33
|
end
|
34
34
|
|
35
35
|
def copy(unit_id, job_id, data = {})
|
data/test/integration_tests.rb
CHANGED
@@ -125,13 +125,13 @@ wait_until { job2.get["units_count"] == 8 }
|
|
125
125
|
say "Checking the status of the job."
|
126
126
|
assert job.status["tainted_judgments"] == 0
|
127
127
|
|
128
|
-
say "Registering a webhook."
|
129
|
-
job.update :webhook_uri => "http://localhost:8080/crowdflower"
|
130
|
-
|
131
128
|
say "Adding title, instructions, and problem to the job."
|
132
129
|
job.update({:title => 'testtt',
|
133
130
|
:instructions => 'testttt fdsf sfds fsdfs fesfsdf',
|
134
131
|
:cml => '<cml:text label="Text" class="unmodified" validates="required"/>'})
|
132
|
+
|
133
|
+
say "Registering a webhook."
|
134
|
+
job.update :webhook_uri => "http://localhost:8080/crowdflower"
|
135
135
|
|
136
136
|
say "Checking channels"
|
137
137
|
assert !job.channels['available_channels'].empty?
|
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: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
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-02-
|
19
|
+
date: 2011-02-27 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|