houdini 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/houdini/base.rb +3 -5
- data/lib/houdini/model.rb +5 -1
- data/lib/houdini/version.rb +1 -1
- data/lib/houdini.rb +3 -2
- data/spec/dummy/config/application.rb +1 -1
- data/spec/requests/integration_spec.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/houdini/base.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
module Houdini
|
2
|
-
Undefined = Class.new(NameError)
|
3
2
|
RequestError = Class.new(NameError)
|
4
|
-
AuthenticationError = Class.new(NameError)
|
5
3
|
HostError = Class.new(NameError)
|
6
4
|
|
7
|
-
HOST = '
|
5
|
+
HOST = 'v0.houdiniapi.com'
|
8
6
|
|
9
7
|
class Base
|
10
8
|
def self.request(params)
|
@@ -12,7 +10,7 @@ module Houdini
|
|
12
10
|
puts "sending #{params.to_json} to houdini"
|
13
11
|
validate_config
|
14
12
|
|
15
|
-
url = File.join("https://", HOST, "tasks")
|
13
|
+
url = File.join("https://", HOST, "tasks.json")
|
16
14
|
uri = URI.parse(url)
|
17
15
|
http = Net::HTTP.new(uri.host, uri.port)
|
18
16
|
http.use_ssl = true
|
@@ -28,7 +26,7 @@ module Houdini
|
|
28
26
|
private
|
29
27
|
|
30
28
|
def self.validate_config
|
31
|
-
raise HostError, "Houdini.app_host should
|
29
|
+
raise HostError, "Houdini.app_host should specify http:// or https://" unless Houdini.app_host.match(/^https?\:\/\//)
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
data/lib/houdini/model.rb
CHANGED
@@ -30,7 +30,11 @@ module Houdini
|
|
30
30
|
:api_key => Houdini.api_key,
|
31
31
|
:task_design => houdini_task.short_name,
|
32
32
|
:task_design_version => houdini_task.version,
|
33
|
-
:postback_url => houdini_postbacks_url(self.class.name, self.id, houdini_task.short_name,
|
33
|
+
:postback_url => houdini_postbacks_url(self.class.name, self.id, houdini_task.short_name, {
|
34
|
+
:protocol => Houdini.app_uri.scheme,
|
35
|
+
:host => Houdini.app_uri.host,
|
36
|
+
:port => Houdini.app_uri.port
|
37
|
+
})
|
34
38
|
}
|
35
39
|
|
36
40
|
params[:task_info] = houdini_task.task_info.inject({}) do |hash, (info_name, model_attribute)|
|
data/lib/houdini/version.rb
CHANGED
data/lib/houdini.rb
CHANGED
@@ -9,7 +9,7 @@ require 'houdini/engine'
|
|
9
9
|
|
10
10
|
|
11
11
|
module Houdini
|
12
|
-
mattr_accessor :environment, :api_key, :
|
12
|
+
mattr_accessor :environment, :api_key, :app_url, :app_uri
|
13
13
|
# Convenience methods
|
14
14
|
def self.perform!(task_name, object)
|
15
15
|
object.send_to_houdini(task_name)
|
@@ -18,6 +18,7 @@ module Houdini
|
|
18
18
|
def self.setup(environment, options)
|
19
19
|
self.environment = environment.to_s
|
20
20
|
self.api_key = options[:api_key]
|
21
|
-
self.
|
21
|
+
self.app_url = options[:app_host] || options[:app_url]
|
22
|
+
self.app_uri = URI.parse(self.app_url)
|
22
23
|
end
|
23
24
|
end
|
@@ -13,7 +13,7 @@ describe "Text Classification" do
|
|
13
13
|
params = {
|
14
14
|
"api_key" => Houdini.api_key,
|
15
15
|
"environment" => Houdini.environment,
|
16
|
-
"postback_url" => "http
|
16
|
+
"postback_url" => "http://example.com:80/houdini/Article/1/edit_for_grammar/postbacks",
|
17
17
|
"task_design" => "edit_for_grammar",
|
18
18
|
"task_design_version" => 1,
|
19
19
|
"task_info" => {
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: houdini
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Conley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-27 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|