crowdflower 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -30,8 +30,8 @@ task :refresh_builder => [:build] do
30
30
  `cd ../builder && bin/thor merb:gem:redeploy`
31
31
  end
32
32
 
33
- require 'rake/rdoctask'
34
- Rake::RDocTask.new do |rdoc|
33
+ require 'rdoc/task'
34
+ RDoc::Task.new do |rdoc|
35
35
  if File.exist?('VERSION.yml')
36
36
  config = YAML.load(File.read('VERSION.yml'))
37
37
  version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.8
1
+ 0.7.0
data/crowdflower.gemspec CHANGED
@@ -1,55 +1,46 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
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
- s.name = %q{crowdflower}
8
- s.version = "0.6.8"
7
+ s.name = "crowdflower"
8
+ s.version = "0.7.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-03-24}
13
- s.description = %q{A toolkit for interacting with CrowdFlower via the REST API.
14
-
15
- This is alpha software. Have fun!
16
-
17
- }
18
- s.email = %q{brian@doloreslabs.com}
12
+ s.date = "2014-04-01"
13
+ s.description = "A toolkit for interacting with CrowdFlower via the REST API.\n\nThis is alpha software. Have fun!\n\n"
14
+ s.email = "brian@doloreslabs.com"
19
15
  s.extra_rdoc_files = [
20
16
  "LICENSE",
21
- "README.md"
17
+ "README.md"
22
18
  ]
23
19
  s.files = [
24
20
  ".document",
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"
21
+ "CONTRIBUTORS",
22
+ "HISTORY.md",
23
+ "LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bindev/cl_skel.rb",
28
+ "bindev/crowdflower.rb",
29
+ "crowdflower.gemspec",
30
+ "lib/crowdflower.rb",
31
+ "lib/crowdflower/base.rb",
32
+ "lib/crowdflower/job.rb",
33
+ "lib/crowdflower/judgment.rb",
34
+ "lib/crowdflower/order.rb",
35
+ "lib/crowdflower/unit.rb",
36
+ "lib/crowdflower/worker.rb",
37
+ "test/integration_tests.rb",
38
+ "test/sample.csv"
44
39
  ]
45
- s.homepage = %q{http://github.com/dolores/ruby-crowdflower}
46
- s.rdoc_options = ["--charset=UTF-8"]
40
+ s.homepage = "http://github.com/dolores/ruby-crowdflower"
47
41
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.6.2}
49
- s.summary = %q{a toolkit for the CrowdFlower API}
50
- s.test_files = [
51
- "test/integration_tests.rb"
52
- ]
42
+ s.rubygems_version = "1.8.23"
43
+ s.summary = "a toolkit for the CrowdFlower API"
53
44
 
54
45
  if s.respond_to? :specification_version then
55
46
  s.specification_version = 3
@@ -63,3 +54,4 @@ This is alpha software. Have fun!
63
54
  s.add_dependency(%q<httparty>, [">= 0.7.4"])
64
55
  end
65
56
  end
57
+
@@ -127,5 +127,20 @@ module CrowdFlower
127
127
  connection.post("#{resource_uri}/#{@id}/channels", {:body => { :channels => channels } } )
128
128
  end
129
129
 
130
+ def tags
131
+ connection.get("#{resource_uri}/#{@id}/tags")
132
+ end
133
+
134
+ def update_tags(tags)
135
+ connection.put("#{resource_uri}/#{@id}/tags", {:body => { :tags => tags } } )
136
+ end
137
+
138
+ def add_tags(tags)
139
+ connection.post("#{resource_uri}/#{@id}/tags", {:body => { :tags => tags } } )
140
+ end
141
+
142
+ def remove_tags(tags)
143
+ connection.delete("#{resource_uri}/#{@id}/tags", {:body => { :tags => tags } } )
144
+ end
130
145
  end
131
146
  end
@@ -40,9 +40,21 @@ module CrowdFlower
40
40
  connection.get("#{resource_uri}/split", {:query => {:on => on, :with => with}})
41
41
  end
42
42
 
43
+ def update(unit_id, params)
44
+ connection.put("#{resource_uri}/#{unit_id}", {:body => {:unit => params}})
45
+ end
46
+
47
+ def make_gold(unit_id)
48
+ update(unit_id, :golden => "true")
49
+ end
50
+
43
51
  def cancel(unit_id)
44
52
  connection.post("#{resource_uri}/#{unit_id}/cancel.json")
45
53
  end
54
+
55
+ def delete(unit_id)
56
+ connection.delete("#{resource_uri}/#{unit_id}")
57
+ end
46
58
 
47
59
  def request_more_judgments(unit_id, nb_judgments = 1)
48
60
  connection.post("#{resource_uri}/#{unit_id}/request_more_judgments.json", :body => {:nb_judgments => nb_judgments})
@@ -88,7 +88,8 @@ assert CrowdFlower::Job.create("should be ok").units.ping['count']
88
88
  assert job_subclass_with_no_custom_key.create("should be ok").units.ping['count']
89
89
  assert job_subclass_with_valid_custom_key.create("should be ok").units.ping['count']
90
90
  assert_exception_raised(CrowdFlower::APIError) {job_subclass_with_invalid_custom_key.create("job creation should fail")}
91
- assert CrowdFlower::Base.connection.public_url == "localdev.crowdflower.com:80"
91
+ # Add this test to check your URL
92
+ #assert CrowdFlower::Base.connection.public_url == "localdev.crowdflower.com:80"
92
93
 
93
94
  say "Uploading a test CSV"
94
95
  job = CrowdFlower::Job.upload(File.dirname(__FILE__) + "/sample.csv", "text/csv")
@@ -143,6 +144,14 @@ assert job.channels['enabled_channels'].sort == ['amt', 'mob']
143
144
  job.enable_channels ['mob']
144
145
  assert job.channels['enabled_channels'].sort == ['amt', 'mob']
145
146
 
147
+ say "Tags"
148
+ assert job.tags.empty?
149
+ job.update_tags ["testing_123", "testing_456"]
150
+ assert job.tags.map{|t| t["name"]}.sort == ["testing_123", "testing_456"]
151
+ job.remove_tags ["testing_123"]
152
+ assert job.tags.map{|t| t["name"]} == ["testing_456"]
153
+ job.add_tags ["testing_789"]
154
+ assert job.tags.map{|t| t["name"]} == ["testing_456", "testing_789"]
146
155
 
147
156
  say "Ordering the job."
148
157
  order = CrowdFlower::Order.new(job)
metadata CHANGED
@@ -1,56 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: crowdflower
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 6
9
- - 8
10
- version: 0.6.8
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Brian P O'Rourke
14
9
  - Chris Van Pelt
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-03-24 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2014-04-01 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: httparty
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
26
18
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 11
31
- segments:
32
- - 0
33
- - 7
34
- - 4
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
35
22
  version: 0.7.4
36
23
  type: :runtime
37
- version_requirements: *id001
38
- description: |+
39
- A toolkit for interacting with CrowdFlower via the REST API.
40
-
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.7.4
31
+ description: ! 'A toolkit for interacting with CrowdFlower via the REST API.
32
+
33
+
41
34
  This is alpha software. Have fun!
42
-
35
+
36
+
37
+ '
43
38
  email: brian@doloreslabs.com
44
39
  executables: []
45
-
46
40
  extensions: []
47
-
48
- extra_rdoc_files:
41
+ extra_rdoc_files:
49
42
  - LICENSE
50
43
  - README.md
51
- files:
44
+ files:
52
45
  - .document
53
- - .gitignore
54
46
  - CONTRIBUTORS
55
47
  - HISTORY.md
56
48
  - LICENSE
@@ -69,39 +61,28 @@ files:
69
61
  - lib/crowdflower/worker.rb
70
62
  - test/integration_tests.rb
71
63
  - test/sample.csv
72
- has_rdoc: true
73
64
  homepage: http://github.com/dolores/ruby-crowdflower
74
65
  licenses: []
75
-
76
66
  post_install_message:
77
- rdoc_options:
78
- - --charset=UTF-8
79
- require_paths:
67
+ rdoc_options: []
68
+ require_paths:
80
69
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
70
+ required_ruby_version: !ruby/object:Gem::Requirement
82
71
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
77
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
99
82
  requirements: []
100
-
101
83
  rubyforge_project:
102
- rubygems_version: 1.3.7
84
+ rubygems_version: 1.8.23
103
85
  signing_key:
104
86
  specification_version: 3
105
87
  summary: a toolkit for the CrowdFlower API
106
- test_files:
107
- - test/integration_tests.rb
88
+ test_files: []
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- tags/.loadpath
7
- /.project
8
- /.loadpath