Permalink
Browse files

closes #32

  • Loading branch information...
James Lamont
James Lamont committed Jul 10, 2013
1 parent 560dfa8 commit d6f027f519980f37f1484d1a8147f117be6eb4c7
View
@@ -30,7 +30,7 @@ def request_params
def domain
if @domain.blank?
- 'https://www.getvero.com'
+ 'https://api.getvero.com'
else
@domain =~ /http[s]?\:\/\/.+/ ? @domain : "http://#{@domain}"
end
@@ -3,18 +3,18 @@
describe Vero::Api::Workers::Events::TrackAPI do
context "request without properties" do
- subject { Vero::Api::Workers::Events::TrackAPI.new('https://www.getvero.com', {}) }
+ subject { Vero::Api::Workers::Events::TrackAPI.new('https://api.getvero.com', {}) }
it "should inherit from Vero::Api::Workers::BaseCaller" do
subject.should be_a(Vero::Api::Workers::BaseAPI)
end
it "should map to current version of Vero API" do
- subject.send(:url).should == "https://www.getvero.com/api/v2/events/track.json"
+ subject.send(:url).should == "https://api.getvero.com/api/v2/events/track.json"
end
end
context "request with properties" do
- subject { Vero::Api::Workers::Events::TrackAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'}) }
+ subject { Vero::Api::Workers::Events::TrackAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'}) }
describe :validate! do
it "should raise an error if event_name is a blank String" do
options = {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => nil}
@@ -49,7 +49,7 @@
describe :request do
it "should send a JSON request to the Vero API" do
- RestClient.should_receive(:post).with("https://www.getvero.com/api/v2/events/track.json", {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'}.to_json, {:content_type => :json, :accept => :json})
+ RestClient.should_receive(:post).with("https://api.getvero.com/api/v2/events/track.json", {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'}.to_json, {:content_type => :json, :accept => :json})
RestClient.stub(:post).and_return(200)
subject.send(:request)
end
@@ -58,7 +58,7 @@
describe "integration test" do
it "should not raise any errors" do
- obj = Vero::Api::Workers::Events::TrackAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'})
+ obj = Vero::Api::Workers::Events::TrackAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :event_name => 'test_event'})
RestClient.stub(:post).and_return(200)
expect { obj.perform }.to_not raise_error
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Vero::Api::Workers::Users::EditAPI do
- subject { Vero::Api::Workers::Users::EditAPI.new('https://www.getvero.com', {}) }
+ subject { Vero::Api::Workers::Users::EditAPI.new('https://api.getvero.com', {}) }
it "should inherit from Vero::Api::Workers::BaseCaller" do
subject.should be_a(Vero::Api::Workers::BaseAPI)
end
it "should map to current version of Vero API" do
- subject.send(:url).should == "https://www.getvero.com/api/v2/users/edit.json"
+ subject.send(:url).should == "https://api.getvero.com/api/v2/users/edit.json"
end
- subject { Vero::Api::Workers::Users::EditAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}) }
+ subject { Vero::Api::Workers::Users::EditAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}) }
describe :validate! do
it "should not raise an error when the keys are Strings" do
options = {"auth_token" => 'abcd', "email" => 'test@test.com', "changes" => { "email" => 'test@test.com' }}
@@ -21,7 +21,7 @@
describe :request do
it "should send a request to the Vero API" do
- RestClient.should_receive(:put).with("https://www.getvero.com/api/v2/users/edit.json", {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}.to_json, {:content_type => :json, :accept => :json})
+ RestClient.should_receive(:put).with("https://api.getvero.com/api/v2/users/edit.json", {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}.to_json, {:content_type => :json, :accept => :json})
RestClient.stub(:put).and_return(200)
subject.send(:request)
end
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Vero::Api::Workers::Users::EditTagsAPI do
- subject { Vero::Api::Workers::Users::EditTagsAPI.new('https://www.getvero.com', {}) }
+ subject { Vero::Api::Workers::Users::EditTagsAPI.new('https://api.getvero.com', {}) }
it "should inherit from Vero::Api::Workers::BaseCaller" do
subject.should be_a(Vero::Api::Workers::BaseAPI)
end
it "should map to current version of Vero API" do
- subject.send(:url).should == "https://www.getvero.com/api/v2/users/tags/edit.json"
+ subject.send(:url).should == "https://api.getvero.com/api/v2/users/tags/edit.json"
end
- subject { Vero::Api::Workers::Users::EditTagsAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :add => ["test"]}) }
+ subject { Vero::Api::Workers::Users::EditTagsAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :add => ["test"]}) }
describe :validate! do
it "should raise an error if email is a blank String" do
@@ -60,7 +60,7 @@
describe :request do
it "should send a request to the Vero API" do
- RestClient.should_receive(:put).with("https://www.getvero.com/api/v2/users/tags/edit.json", {:auth_token => 'abcd', :email => 'test@test.com', :add => ["test"]}.to_json, {:content_type => :json, :accept => :json})
+ RestClient.should_receive(:put).with("https://api.getvero.com/api/v2/users/tags/edit.json", {:auth_token => 'abcd', :email => 'test@test.com', :add => ["test"]}.to_json, {:content_type => :json, :accept => :json})
RestClient.stub(:put).and_return(200)
subject.send(:request)
end
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Vero::Api::Workers::Users::TrackAPI do
- subject { Vero::Api::Workers::Users::TrackAPI.new('https://www.getvero.com', {}) }
+ subject { Vero::Api::Workers::Users::TrackAPI.new('https://api.getvero.com', {}) }
it "should inherit from Vero::Api::Workers::BaseCaller" do
subject.should be_a(Vero::Api::Workers::BaseAPI)
end
it "should map to current version of Vero API" do
- subject.send(:url).should == "https://www.getvero.com/api/v2/users/track.json"
+ subject.send(:url).should == "https://api.getvero.com/api/v2/users/track.json"
end
- subject { Vero::Api::Workers::Users::TrackAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :email => 'test@test.com'}) }
+ subject { Vero::Api::Workers::Users::TrackAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :email => 'test@test.com'}) }
describe :validate! do
it "should raise an error if email and id are are blank String" do
options = {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :id => nil, :email => nil}
@@ -53,7 +53,7 @@
describe :request do
it "should send a request to the Vero API" do
- RestClient.should_receive(:post).with("https://www.getvero.com/api/v2/users/track.json", {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :email => 'test@test.com'}.to_json, {:content_type => :json, :accept => :json})
+ RestClient.should_receive(:post).with("https://api.getvero.com/api/v2/users/track.json", {:auth_token => 'abcd', :identity => {:email => 'test@test.com'}, :email => 'test@test.com'}.to_json, {:content_type => :json, :accept => :json})
RestClient.stub(:post).and_return(200)
subject.send(:request)
end
@@ -1,16 +1,16 @@
require 'spec_helper'
describe Vero::Api::Workers::Users::UnsubscribeAPI do
- subject { Vero::Api::Workers::Users::UnsubscribeAPI.new('https://www.getvero.com', {}) }
+ subject { Vero::Api::Workers::Users::UnsubscribeAPI.new('https://api.getvero.com', {}) }
it "should inherit from Vero::Api::Workers::BaseCaller" do
subject.should be_a(Vero::Api::Workers::BaseAPI)
end
it "should map to current version of Vero API" do
- subject.send(:url).should == "https://www.getvero.com/api/v2/users/unsubscribe.json"
+ subject.send(:url).should == "https://api.getvero.com/api/v2/users/unsubscribe.json"
end
- subject { Vero::Api::Workers::Users::UnsubscribeAPI.new('https://www.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}) }
+ subject { Vero::Api::Workers::Users::UnsubscribeAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }}) }
describe :validate! do
it "should not raise an error when the keys are Strings" do
options = {"auth_token" => 'abcd', "email" => 'test@test.com', "changes" => { "email" => 'test@test.com' }}
@@ -21,7 +21,7 @@
describe :request do
it "should send a request to the Vero API" do
- RestClient.should_receive(:post).with("https://www.getvero.com/api/v2/users/unsubscribe.json", {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }})
+ RestClient.should_receive(:post).with("https://api.getvero.com/api/v2/users/unsubscribe.json", {:auth_token => 'abcd', :email => 'test@test.com', :changes => { :email => 'test@test.com' }})
RestClient.stub(:post).and_return(200)
subject.send(:request)
end
View
@@ -2,7 +2,7 @@
describe Vero::Api::Events do
let (:subject) { Vero::Api::Events }
-
+
describe :track! do
it "should call the TrackAPI object via the configured sender" do
input = {:event_name => "test_event", :identity => {:email => "james@getvero.com"}, :data => {:test => "test"}}
@@ -14,7 +14,7 @@
Vero::App.stub(:default_context).and_return(mock_context)
- Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Events::TrackAPI, true, "https://www.getvero.com", expected)
+ Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Events::TrackAPI, true, "https://api.getvero.com", expected)
subject.track!(input)
end
@@ -23,7 +23,7 @@
describe Vero::Api::Users do
let (:subject) { Vero::Api::Users }
-
+
describe :track! do
it "should call the TrackAPI object via the configured sender" do
input = {:email => "james@getvero.com", :data => {:age => 25}}
@@ -35,7 +35,7 @@
Vero::App.stub(:default_context).and_return(mock_context)
- Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::TrackAPI, true, "https://www.getvero.com", expected)
+ Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::TrackAPI, true, "https://api.getvero.com", expected)
subject.track!(input)
end
@@ -52,7 +52,7 @@
Vero::App.stub(:default_context).and_return(mock_context)
- Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::EditAPI, true, "https://www.getvero.com", expected)
+ Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::EditAPI, true, "https://api.getvero.com", expected)
subject.edit_user!(input)
end
@@ -69,7 +69,7 @@
Vero::App.stub(:default_context).and_return(mock_context)
- Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::EditTagsAPI, true, "https://www.getvero.com", expected)
+ Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::EditTagsAPI, true, "https://api.getvero.com", expected)
subject.edit_user_tags!(input)
end
@@ -86,7 +86,7 @@
Vero::App.stub(:default_context).and_return(mock_context)
- Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::UnsubscribeAPI, true, "https://www.getvero.com", expected)
+ Vero::Sender.should_receive(:send).with(Vero::Api::Workers::Users::UnsubscribeAPI, true, "https://api.getvero.com", expected)
subject.unsubscribe!(input)
end
View
@@ -59,10 +59,10 @@
end
describe :domain do
- it "should return https://www.getvero.com when not set" do
- @config.domain.should == 'https://www.getvero.com'
+ it "should return https://api.getvero.com when not set" do
+ @config.domain.should == 'https://api.getvero.com'
@config.domain = 'blah.com'
- @config.domain.should_not == 'https://www.getvero.com'
+ @config.domain.should_not == 'https://api.getvero.com'
end
it "should return the domain value" do
View
@@ -9,7 +9,7 @@
:data => { :test => 1 },
:development_mode => true
}
- @url = "https://www.getvero.com/api/v1/track.json"
+ @url = "https://api.getvero.com/api/v1/track.json"
@user = User.new
@content_type_params = {:content_type => :json, :accept => :json}
@@ -51,7 +51,7 @@
:data => { :test => 1 },
:extras => {}
}
- @url = "https://www.getvero.com/api/v1/track.json"
+ @url = "https://api.getvero.com/api/v1/track.json"
end
it "should not send a track request when the required parameters are invalid" do
@@ -69,13 +69,13 @@
RestClient.stub(:post).and_return(200)
- # RestClient.should_receive(:post).with("https://www.getvero.com/api/v2/events/track.json", {:data=>{:test=>1}, :event_name=>"test_event", :identity=>{:email=>"durkster@gmail.com", :age=>20, :_user_type=>"User"}, :auth_token=>"YWJjZDEyMzQ6ZWZnaDU2Nzg=", :development_mode=>true}.to_json, @content_type_params)
+ # RestClient.should_receive(:post).with("https://api.getvero.com/api/v2/events/track.json", {:data=>{:test=>1}, :event_name=>"test_event", :identity=>{:email=>"durkster@gmail.com", :age=>20, :_user_type=>"User"}, :auth_token=>"YWJjZDEyMzQ6ZWZnaDU2Nzg=", :development_mode=>true}.to_json, @content_type_params)
Vero::Api::Events.stub(:track!).and_return(200)
Vero::Api::Events.should_receive(:track!).with(@request_params, context)
@user.track!(@request_params[:event_name], @request_params[:data]).should == 200
- # RestClient.should_receive(:post).with("https://www.getvero.com/api/v2/events/track.json", {:data=>{}, :event_name=>"test_event", :identity=>{:email=>"durkster@gmail.com", :age=>20, :_user_type=>"User"}, :auth_token=>"YWJjZDEyMzQ6ZWZnaDU2Nzg=", :development_mode=>true}.to_json, @content_type_params)
+ # RestClient.should_receive(:post).with("https://api.getvero.com/api/v2/events/track.json", {:data=>{}, :event_name=>"test_event", :identity=>{:email=>"durkster@gmail.com", :age=>20, :_user_type=>"User"}, :auth_token=>"YWJjZDEyMzQ6ZWZnaDU2Nzg=", :development_mode=>true}.to_json, @content_type_params)
Vero::Api::Events.stub(:track!).and_return(200)
Vero::Api::Events.should_receive(:track!).with(@request_params.merge(:data => {}), context)
@@ -123,7 +123,7 @@
:email => 'durkster@gmail.com',
:data => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"}
}
- @url = "https://www.getvero.com/api/v2/users/track.json"
+ @url = "https://api.getvero.com/api/v2/users/track.json"
end
it "should send an `identify` request when async is set to false" do
@@ -177,7 +177,7 @@
:email => 'durkster@gmail.com',
:changes => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"},
}
- @url = "https://www.getvero.com/api/v2/users/edit.json"
+ @url = "https://api.getvero.com/api/v2/users/edit.json"
end
it "should be able to choose an email address" do
@@ -249,7 +249,7 @@
:add => [],
:remove => []
}
- @url = "https://www.getvero.com/api/v2/users/tags/edit.json"
+ @url = "https://api.getvero.com/api/v2/users/tags/edit.json"
end
it "should send an `update_user_tags` request when async is set to false" do
@@ -286,7 +286,7 @@
@request_params = {
:email => 'durkster@gmail.com'
}
- @url = "https://www.getvero.com/api/v2/users/unsubscribe.json"
+ @url = "https://api.getvero.com/api/v2/users/unsubscribe.json"
end
it "should send an `update_user` request when async is set to false" do
@@ -418,7 +418,7 @@
:data => { :test => 1 },
:development_mode => true
}
- url = "https://www.getvero.com/api/v1/track.json"
+ url = "https://api.getvero.com/api/v1/track.json"
context = Vero::Context.new(Vero::App.default_context)
context.subject = user

0 comments on commit d6f027f

Please sign in to comment.