rturk 2.11.0 → 2.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e315bf746bf3734838ccc4b111232cb716d31ca
4
- data.tar.gz: 0c168e252589bc94ec2c052ed9daad5f2a372cfb
3
+ metadata.gz: edad107308fd7fd6e6a1e970cb449111b46739d3
4
+ data.tar.gz: 77b8eb0b5b2ae6b5dd6e1999121637fa73ff56f3
5
5
  SHA512:
6
- metadata.gz: 73b53fbc9af91652ed7bc54d8a30e8e3f3b0617d16909e2e79bb371dba1916c2be25236afeb3de1e724f21c19281d37e1ed46ffb513b18834038ae5eb6bba548
7
- data.tar.gz: f639e6d9564ed50418a7f57a9e6b1172f85dbcbf49220d4efcbe3af44647c3ae90ae7d311f63b377bb4bac5103bd6616ffa7c4b69da7dc94e464183b5876b49a
6
+ metadata.gz: 6629843938d1a3bda23a2e5b16c64b34299ccd0e34338d697f65971b856efe25ac71f4b94a76a739992390925ae4c5f71f2bb32250dccd1a03d52689e13decab
7
+ data.tar.gz: 2e92f8fe66c640170223ba7ac99526378cb9e94e9e5825d16021db5bd960d64ff4846d062fd7388e5f423a9fc6ea7173c40bb2b6d16483e8ab1ff5686a567aca
@@ -1,3 +1,12 @@
1
+ 2.11.1
2
+ ---
3
+ * Fix some API breaking changes on CreateHit and RegisterHit
4
+
5
+ 2.11.0
6
+ ---
7
+ * adding QuestionForm support to rturk #34 alexch#11, cantino#34
8
+ * Note, this changes Question to ExternalQuestion for clarity
9
+
1
10
  2.10.3
2
11
  ---
3
12
  * Lock in last dependencies that work with Ruby 1.8.7 - This is the last release to support Ruby 1.8.7
@@ -22,7 +22,14 @@ module RTurk
22
22
 
23
23
  def create(opts = {}, &blk)
24
24
  hit = self.new(opts, &blk)
25
- response = hit.request
25
+ hit.request
26
+ end
27
+
28
+ def alias_attr(new_attr, original)
29
+ alias_method(new_attr, original) if method_defined? original
30
+ new_writer = "#{new_attr}="
31
+ original_writer = "#{original}="
32
+ alias_method(new_writer, original_writer) if method_defined? original_writer
26
33
  end
27
34
 
28
35
  end
@@ -84,6 +91,5 @@ module RTurk
84
91
  end
85
92
  end
86
93
 
87
-
88
94
  end
89
95
  end
@@ -3,6 +3,8 @@ require File.join(File.dirname(__FILE__), 'register_hit_type')
3
3
  module RTurk
4
4
  class CreateHIT < RegisterHITType
5
5
  attr_accessor :hit_type_id, :max_assignments, :lifetime, :annotation
6
+ alias_attr :note, :annotation
7
+ alias_attr :assignments, :max_assignments
6
8
 
7
9
  def parse(response)
8
10
  RTurk::CreateHITResponse.new(response)
@@ -2,6 +2,7 @@ module RTurk
2
2
  class RegisterHITType < Operation
3
3
 
4
4
  attr_accessor :title, :description, :reward, :currency, :duration, :keywords, :auto_approval_delay
5
+ alias_attr :auto_approval, :auto_approval_delay
5
6
 
6
7
 
7
8
  # @param [Symbol, Hash] qualification_key opts The unique qualification key
@@ -1,3 +1,3 @@
1
1
  module RTurk
2
- VERSION = "2.11.0"
2
+ VERSION = "2.11.1"
3
3
  end
@@ -11,15 +11,15 @@ describe "using mechanical turk with RTurk" do
11
11
  end
12
12
 
13
13
  it "should let me build and send a hit" do
14
- hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
14
+ new_hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
15
15
  hit.max_assignments = 5
16
16
  hit.description = 'blah'
17
17
  hit.question("http://mpercival.com", :frame_height => 600)
18
18
  hit.reward = 0.05
19
19
  hit.qualifications.add :approval_rate, {:gt => 80}
20
20
  end
21
- hit.max_assignments.should eql(5)
22
- response = hit.request
21
+ new_hit.max_assignments.should eql(5)
22
+ response = new_hit.request
23
23
  response.hit_id.should_not be_nil
24
24
  end
25
25
 
@@ -31,12 +31,12 @@ describe "using mechanical turk with RTurk" do
31
31
  end
32
32
 
33
33
  it "should let me build and send a hit with mostly default values" do
34
- hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
34
+ new_hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
35
35
  hit.description = 'blah'
36
36
  hit.question("http://mpercival.com", :frame_height => 600)
37
37
  hit.reward = 0.05
38
38
  end
39
- response = hit.request
39
+ response = new_hit.request
40
40
  response.hit_id.should_not be_nil
41
41
  end
42
42
 
@@ -51,6 +51,22 @@ describe "using mechanical turk with RTurk" do
51
51
  response.hit.url.should eql('http://workersandbox.mturk.com/mturk/preview?groupId=NYVZTQ1QVKJZXCYZCZVZ')
52
52
  end
53
53
 
54
+ it "should not break with old API" do
55
+ # Testing that annotation and note are the same
56
+ new_hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan") do |hit|
57
+ hit.max_assignments = 5
58
+ hit.description = 'blah'
59
+ hit.question("http://mpercival.com", :frame_height => 600)
60
+ hit.reward = 0.05
61
+ hit.qualifications.add :approval_rate, {:gt => 80}
62
+ hit.note = "My note"
63
+ end
64
+ new_hit.max_assignments.should eql(5)
65
+ new_hit.assignments.should eql(5)
66
+ new_hit.note.should eql("My note")
67
+ new_hit.annotation.should eql("My note")
68
+ end
69
+
54
70
  it "should let me create a hit with just option arguments" do
55
71
  hit = RTurk::CreateHIT.new(:title => "Look at some pictures from 4Chan",
56
72
  :description => "Pics from the b-tards",
@@ -81,12 +97,12 @@ describe "using mechanical turk with RTurk" do
81
97
  end
82
98
 
83
99
  it "should let me build and send a hit with an internal question" do
84
- hit = RTurk::CreateHIT.new(:title => "Who is your favorite Beatle?") do |hit|
100
+ new_hit = RTurk::CreateHIT.new(:title => "Who is your favorite Beatle?") do |hit|
85
101
  hit.description = 'blah'
86
102
  hit.reward = 0.05
87
103
  hit.question_form ExampleQuestionForm.new
88
104
  end
89
- response = hit.request
105
+ response = new_hit.request
90
106
  response.hit_id.should_not be_nil
91
107
  end
92
108
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rturk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Percival