crowdflower 0.3.0 → 0.4.1

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/CONTRIBUTORS ADDED
@@ -0,0 +1,4 @@
1
+ * Chris Van Pelt (vanpelt)
2
+ * Brian P O'Rourke (bpo)
3
+ * Mark Sands (marksands)
4
+ * Mark Erdmann (markerdmann)
data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.4.0 (2010-03-25)
2
+ * Allow key configuration from YAML
3
+ * ruby-crowdflower is now just 'crowdflower'
4
+ * Unit#create now creates non-gold units by default
5
+ * Cleaned and removed the httparty monkey patches
6
+ * Job#create now creates an empty job with a title
7
+
1
8
  ## 0.2.2 (2010-02-03)
2
9
  * Simple Job#update addition
3
10
 
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # ruby-crowdflower
2
+
3
+ A toolkit for interacting with CrowdFlower via the REST API.
4
+
5
+ This is alpha software. Have fun!
6
+
7
+ Example Usage
8
+ -------------
9
+
10
+ Specifiy either your api key or a yaml file containing the key:
11
+
12
+ CrowdFlower.connect!( 'CrowdFlower.yml' )
13
+
14
+ Upload a CSV file for a job:
15
+
16
+ CrowdFlower::Job.upload( File.dirname(__FILE__) + "/data.csv", "text/csv" )
17
+
18
+ Copy an existing job into a new one:
19
+
20
+ new_job = job.copy( :all_units => true )
21
+
22
+ Check the status of a job:
23
+
24
+ job.status["tainted_judgments"]
25
+
26
+
27
+
28
+ Contributing
29
+ ------------
30
+
31
+ 1. Fork ruby-crowdflower
32
+ 2. Create a topic branch - `git checkout -b my_branch`
33
+ 3. Make your feature addition or bug fix and add tests for it.
34
+ 4. Commit, but do not mess with the rakefile, version, or history.
35
+ 5. Push to your branch - `git push origin my_branch`
36
+ 6. Create an Issue with a link to your branch
37
+
38
+ Copyright
39
+ ---------
40
+
41
+ Copyright © 2010 [Dolores Labs](http://www.doloreslabs.com/). See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.1
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.3.0"
8
+ s.version = "0.4.1"
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{2010-03-17}
12
+ s.date = %q{2010-10-18}
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,19 +18,19 @@ This is alpha software. Have fun!
18
18
  s.email = %q{brian@doloreslabs.com}
19
19
  s.extra_rdoc_files = [
20
20
  "LICENSE",
21
- "README.rdoc"
21
+ "README.md"
22
22
  ]
23
23
  s.files = [
24
24
  ".document",
25
25
  ".gitignore",
26
+ "CONTRIBUTORS",
26
27
  "HISTORY.md",
27
28
  "LICENSE",
28
- "README.rdoc",
29
+ "README.md",
29
30
  "Rakefile",
30
31
  "VERSION",
31
32
  "bindev/cl_skel.rb",
32
33
  "bindev/crowdflower.rb",
33
- "crowdflower-0.2.3.gem",
34
34
  "crowdflower.gemspec",
35
35
  "lib/crowdflower.rb",
36
36
  "lib/crowdflower/base.rb",
@@ -44,7 +44,7 @@ This is alpha software. Have fun!
44
44
  s.homepage = %q{http://github.com/dolores/ruby-crowdflower}
45
45
  s.rdoc_options = ["--charset=UTF-8"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.6}
47
+ s.rubygems_version = %q{1.3.7}
48
48
  s.summary = %q{a toolkit for the CrowdFlower API}
49
49
  s.test_files = [
50
50
  "test/integration_tests.rb"
@@ -54,7 +54,7 @@ This is alpha software. Have fun!
54
54
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
55
55
  s.specification_version = 3
56
56
 
57
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
58
  s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
59
59
  else
60
60
  s.add_dependency(%q<httparty>, [">= 0.4.3"])
@@ -35,6 +35,12 @@ module CrowdFlower
35
35
  def self.connect!(key, development = false)
36
36
  @@domain = development ? "http://api.localhost.com:4000/v1" : "https://api.crowdflower.com/v1"
37
37
  @@key = key
38
+ begin # pass yaml file
39
+ key = YAML.load_file(key)
40
+ @@key = key[:key] || key["key"]
41
+ rescue # pass key
42
+ @@key = key
43
+ end
38
44
  end
39
45
 
40
46
  def self.key
@@ -34,9 +34,9 @@ module CrowdFlower
34
34
  end
35
35
 
36
36
  # Creates a new empty Job in CrowdFlower.
37
- def self.create
37
+ def self.create(title)
38
38
  connect
39
- res = post("#{resource_uri}/upload", :query => {:job => {:without_data => "true" } } )
39
+ res = post("#{resource_uri}.json", :query => {:job => {:title => title } }, :headers => { "Content-Length" => "0" } )
40
40
  if res["error"]
41
41
  raise CrowdFlower::APIError.new(res["error"])
42
42
  end
@@ -114,6 +114,10 @@ module CrowdFlower
114
114
  raise CrowdFlower::APIError.new(res["error"])
115
115
  end
116
116
  end
117
+
118
+ def delete
119
+ Job.delete("#{resource_uri}/#{@id}.json")
120
+ end
117
121
 
118
122
  private
119
123
  def self.custom_content_type(content_type)
@@ -24,7 +24,7 @@ module CrowdFlower
24
24
  Unit.get("#{resource_uri}/#{id}/judgments")
25
25
  end
26
26
 
27
- def create(data, gold = nil)
27
+ def create(data, gold = false)
28
28
  Unit.post(resource_uri, {:query => {:unit => {:data => data.to_json, :golden => gold}}})
29
29
  end
30
30
 
data/lib/crowdflower.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'httparty'
2
- require 'crowdflower/base'
3
- require 'crowdflower/job'
4
- require 'crowdflower/unit'
5
- require 'crowdflower/judgment'
6
- require 'crowdflower/order'
2
+
3
+ %w{base job unit judgment order}.each do |file|
4
+ require File.dirname(__FILE__) +"/crowdflower/" + file
5
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdflower
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 13
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 3
8
- - 0
9
- version: 0.3.0
8
+ - 4
9
+ - 1
10
+ version: 0.4.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Brian P O'Rourke
@@ -15,16 +16,18 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-03-17 00:00:00 -07:00
19
+ date: 2010-10-18 00:00:00 -07:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: httparty
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
25
27
  requirements:
26
28
  - - ">="
27
29
  - !ruby/object:Gem::Version
30
+ hash: 9
28
31
  segments:
29
32
  - 0
30
33
  - 4
@@ -44,18 +47,18 @@ extensions: []
44
47
 
45
48
  extra_rdoc_files:
46
49
  - LICENSE
47
- - README.rdoc
50
+ - README.md
48
51
  files:
49
52
  - .document
50
53
  - .gitignore
54
+ - CONTRIBUTORS
51
55
  - HISTORY.md
52
56
  - LICENSE
53
- - README.rdoc
57
+ - README.md
54
58
  - Rakefile
55
59
  - VERSION
56
60
  - bindev/cl_skel.rb
57
61
  - bindev/crowdflower.rb
58
- - crowdflower-0.2.3.gem
59
62
  - crowdflower.gemspec
60
63
  - lib/crowdflower.rb
61
64
  - lib/crowdflower/base.rb
@@ -75,23 +78,27 @@ rdoc_options:
75
78
  require_paths:
76
79
  - lib
77
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
78
82
  requirements:
79
83
  - - ">="
80
84
  - !ruby/object:Gem::Version
85
+ hash: 3
81
86
  segments:
82
87
  - 0
83
88
  version: "0"
84
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
85
91
  requirements:
86
92
  - - ">="
87
93
  - !ruby/object:Gem::Version
94
+ hash: 3
88
95
  segments:
89
96
  - 0
90
97
  version: "0"
91
98
  requirements: []
92
99
 
93
100
  rubyforge_project:
94
- rubygems_version: 1.3.6
101
+ rubygems_version: 1.3.7
95
102
  signing_key:
96
103
  specification_version: 3
97
104
  summary: a toolkit for the CrowdFlower API
data/README.rdoc DELETED
@@ -1,20 +0,0 @@
1
- = ruby-crowdflower
2
-
3
- A toolkit for interacting with CrowdFlower via the REST API.
4
-
5
- This is alpha software. Have fun!
6
-
7
- == Note on Patches/Pull Requests
8
-
9
- * Fork the project.
10
- * Make your feature addition or bug fix.
11
- * Add tests for it. This is important so I don't break it in a
12
- future version unintentionally.
13
- * Commit, do not mess with rakefile, version, or history.
14
- (if you want to have your own version, that is fine but
15
- bump version in a commit by itself I can ignore when I pull)
16
- * Send me a pull request. Bonus points for topic branches.
17
-
18
- == Copyright
19
-
20
- Copyright (c) 2009 Dolores Labs. See LICENSE for details.
Binary file