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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houdini (0.2.1)
4
+ houdini (0.2.2)
5
5
  rails (~> 3.0.0)
6
6
 
7
7
  GEM
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 = 'houdini2-staging.heroku.com'
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 not include http://" if Houdini.app_host.match(/http/)
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, :host => Houdini.app_host)
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)|
@@ -1,3 +1,3 @@
1
1
  module Houdini
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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, :app_host
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.app_host = options[:app_host]
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
@@ -44,7 +44,7 @@ module Dummy
44
44
 
45
45
  Houdini.setup(:sandbox,
46
46
  :api_key => "wOVK7OFeRJVfmjqBk603",
47
- :app_host => 'example.com'
47
+ :app_host => 'http://example.com'
48
48
  )
49
49
 
50
50
  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://#{Houdini.app_host}/houdini/Article/1/edit_for_grammar/postbacks",
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
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-26 00:00:00 -04:00
18
+ date: 2011-03-27 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency