Permalink
Browse files

Merge branch 'master' of github.com:dolores/ruby-crowdflower

  • Loading branch information...
2 parents 01a2f51 + 0d816ee commit 70e8307647d107758fe885f42f683c1f06f571b9 Brian Hahn committed Apr 14, 2011
Showing with 38 additions and 34 deletions.
  1. +1 −1 Rakefile
  2. +1 −1 VERSION
  3. +29 −28 crowdflower.gemspec
  4. +7 −4 lib/crowdflower/base.rb
View
@@ -15,7 +15,7 @@ EOF
gem.email = "brian@doloreslabs.com"
gem.homepage = "http://github.com/dolores/ruby-crowdflower"
gem.authors = ["Brian P O'Rourke", "Chris Van Pelt"]
- gem.add_dependency 'httparty', '>= 0.4.3'
+ gem.add_dependency 'httparty', '>= 0.7.4'
end
rescue LoadError
View
@@ -1 +1 @@
-0.5.9
+0.6.0
View
@@ -1,15 +1,15 @@
# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# DO NOT EDIT THIS FILE
+# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{crowdflower}
- s.version = "0.6.3"
+ s.version = "0.6.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brian P O'Rourke", "Chris Van Pelt"]
- s.date = %q{2011-03-08}
+ s.date = %q{2011-03-24}
s.description = %q{A toolkit for interacting with CrowdFlower via the REST API.
This is alpha software. Have fun!
@@ -18,32 +18,34 @@ This is alpha software. Have fun!
s.email = %q{brian@doloreslabs.com}
s.extra_rdoc_files = [
"LICENSE",
- "README.md"
+ "README.md"
]
s.files = [
".document",
- "CONTRIBUTORS",
- "HISTORY.md",
- "LICENSE",
- "README.md",
- "Rakefile",
- "VERSION",
- "bindev/cl_skel.rb",
- "bindev/crowdflower.rb",
- "crowdflower.gemspec",
- "lib/crowdflower.rb",
- "lib/crowdflower/base.rb",
- "lib/crowdflower/job.rb",
- "lib/crowdflower/judgment.rb",
- "lib/crowdflower/order.rb",
- "lib/crowdflower/unit.rb",
- "lib/crowdflower/worker.rb",
- "test/integration_tests.rb",
- "test/sample.csv"
+ ".gitignore",
+ "CONTRIBUTORS",
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "Rakefile",
+ "VERSION",
+ "bindev/cl_skel.rb",
+ "bindev/crowdflower.rb",
+ "crowdflower.gemspec",
+ "lib/crowdflower.rb",
+ "lib/crowdflower/base.rb",
+ "lib/crowdflower/job.rb",
+ "lib/crowdflower/judgment.rb",
+ "lib/crowdflower/order.rb",
+ "lib/crowdflower/unit.rb",
+ "lib/crowdflower/worker.rb",
+ "test/integration_tests.rb",
+ "test/sample.csv"
]
s.homepage = %q{http://github.com/dolores/ruby-crowdflower}
+ s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.4.2}
+ s.rubygems_version = %q{1.6.2}
s.summary = %q{a toolkit for the CrowdFlower API}
s.test_files = [
"test/integration_tests.rb"
@@ -53,12 +55,11 @@ This is alpha software. Have fun!
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
+ s.add_runtime_dependency(%q<httparty>, [">= 0.7.4"])
else
- s.add_dependency(%q<httparty>, [">= 0.4.3"])
+ s.add_dependency(%q<httparty>, [">= 0.7.4"])
end
else
- s.add_dependency(%q<httparty>, [">= 0.4.3"])
+ s.add_dependency(%q<httparty>, [">= 0.7.4"])
end
end
-
@@ -9,7 +9,8 @@ class APIError < StandardError
def initialize(hash)
@details = hash
- super @details.inspect
+
+ super((hash.respond_to?(:[]) && hash["message"]) || hash.inspect)
end
end
@@ -163,11 +164,13 @@ def self.connect
end
end
- def self.verify_response(response)
- if response["errors"]
- raise CrowdFlower::APIError.new(response["errors"])
+ def self.verify_response(response)
+ if response.respond_to?(:[]) && (response["errors"] || response["error"])
+ raise CrowdFlower::APIError.new(response["errors"] || response["error"])
elsif response.response.kind_of? Net::HTTPUnauthorized
raise CrowdFlower::APIError.new('message' => response.to_s)
+ elsif (500...600).include?(response.code)
+ raise CrowdFlower::APIError.new('message' => response.to_s)
end
end

0 comments on commit 70e8307

Please sign in to comment.