crowdflower 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/crowdflower.gemspec +2 -2
- data/lib/crowdflower/base.rb +3 -4
- data/test/integration_tests.rb +7 -6
- metadata +4 -4
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.5.
|
8
|
+
s.version = "0.5.6"
|
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-23}
|
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!
|
data/lib/crowdflower/base.rb
CHANGED
@@ -14,8 +14,8 @@ module CrowdFlower
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# a convenience method for backward compatibility
|
17
|
-
def self.connect!(key,
|
18
|
-
Base.connect!(key,
|
17
|
+
def self.connect!(key, domain_base = "https://api.crowdflower.com", version = 1)
|
18
|
+
Base.connect!(key, domain_base, version)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.connect_domain!(key, domain_base, version = 1)
|
@@ -126,8 +126,7 @@ module CrowdFlower
|
|
126
126
|
attr_accessor :default_connection
|
127
127
|
end
|
128
128
|
|
129
|
-
def self.connect!(key,
|
130
|
-
domain_base = development ? "https://api.localdev.crowdflower.com:8443" : "https://api.crowdflower.com"
|
129
|
+
def self.connect!(key, domain_base = "https://api.crowdflower.com", version = 1)
|
131
130
|
connect_domain!(key, domain_base, version)
|
132
131
|
end
|
133
132
|
|
data/test/integration_tests.rb
CHANGED
@@ -5,8 +5,9 @@ require 'crowdflower'
|
|
5
5
|
require 'json'
|
6
6
|
|
7
7
|
API_KEY = ENV["API_KEY"]
|
8
|
+
DOMAIN_BASE = ENV["DOMAIN_BASE"] || "https://api.localdev.crowdflower.com:8443"
|
8
9
|
|
9
|
-
unless API_KEY && API_KEY.size >
|
10
|
+
unless API_KEY && API_KEY.size > 3
|
10
11
|
puts <<EOF
|
11
12
|
|
12
13
|
These integration tests interact with api.crowdflower.com.
|
@@ -53,7 +54,7 @@ def assert_exception_raised expected_exception_class
|
|
53
54
|
rescue expected_exception_class
|
54
55
|
return
|
55
56
|
end
|
56
|
-
raise "exception #{
|
57
|
+
raise "exception #{expected_exception_class} has not been raised"
|
57
58
|
end
|
58
59
|
|
59
60
|
|
@@ -63,8 +64,8 @@ end
|
|
63
64
|
|
64
65
|
|
65
66
|
say "defining multiple api keys"
|
66
|
-
(job_subclass_with_valid_custom_key = Class.new(CrowdFlower::Job)).connect! API_KEY,
|
67
|
-
(job_subclass_with_invalid_custom_key = Class.new(CrowdFlower::Job)).connect! 'invalid api key',
|
67
|
+
(job_subclass_with_valid_custom_key = Class.new(CrowdFlower::Job)).connect! API_KEY, DOMAIN_BASE
|
68
|
+
(job_subclass_with_invalid_custom_key = Class.new(CrowdFlower::Job)).connect! 'invalid api key', DOMAIN_BASE
|
68
69
|
job_subclass_with_no_custom_key = Class.new(CrowdFlower::Job)
|
69
70
|
|
70
71
|
say "no default api key"
|
@@ -74,14 +75,14 @@ assert_exception_raised(CrowdFlower::APIError) {job_subclass_with_invalid_custom
|
|
74
75
|
assert job_subclass_with_valid_custom_key.create("should be ok").units.ping['count']
|
75
76
|
|
76
77
|
say "invalid default api key"
|
77
|
-
CrowdFlower.connect! "invalid default api key",
|
78
|
+
CrowdFlower.connect! "invalid default api key", DOMAIN_BASE
|
78
79
|
assert_exception_raised(CrowdFlower::APIError) {CrowdFlower::Job.create("job creation should fail")}
|
79
80
|
assert_exception_raised(CrowdFlower::APIError) {job_subclass_with_no_custom_key.create("job creation should fail")}
|
80
81
|
assert_exception_raised(CrowdFlower::APIError) {job_subclass_with_invalid_custom_key.create("job creation should fail")}
|
81
82
|
assert job_subclass_with_valid_custom_key.create("should be ok").units.ping['count']
|
82
83
|
|
83
84
|
say "Connecting to the API"
|
84
|
-
CrowdFlower.connect! API_KEY,
|
85
|
+
CrowdFlower.connect! API_KEY, DOMAIN_BASE
|
85
86
|
|
86
87
|
assert CrowdFlower::Job.create("should be ok").units.ping['count']
|
87
88
|
assert job_subclass_with_no_custom_key.create("should be ok").units.ping['count']
|
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
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 6
|
10
|
+
version: 0.5.6
|
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-23 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|