vero 0.5.10 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vero (0.5.9)
4
+ vero (0.5.11)
5
5
  girl_friday (>= 0.11.2)
6
6
  json
7
7
  rest-client
@@ -38,7 +38,7 @@ GEM
38
38
  multi_json (~> 1.0)
39
39
  arel (3.0.2)
40
40
  builder (3.0.4)
41
- connection_pool (1.0.0)
41
+ connection_pool (1.1.0)
42
42
  delayed_job (3.0.5)
43
43
  activesupport (~> 3.0)
44
44
  delayed_job_active_record (0.4.4)
@@ -111,7 +111,6 @@ GEM
111
111
  rubinius-actor (0.0.2)
112
112
  rubinius-core-api
113
113
  rubinius-core-api (0.0.1)
114
- rubinius-core-api (0.0.1-java)
115
114
  sinatra (1.3.6)
116
115
  rack (~> 1.4)
117
116
  rack-protection (~> 1.3)
@@ -137,7 +136,7 @@ PLATFORMS
137
136
  DEPENDENCIES
138
137
  delayed_job
139
138
  delayed_job_active_record
140
- rails (>= 3)
139
+ rails (~> 3.0)
141
140
  resque
142
141
  rspec
143
142
  vero!
@@ -184,3 +184,15 @@ First, ensure you've correctly configured the gem following the instructions as
184
184
  vero.users.unsubscribe!({:email => "james@getvero.com"})
185
185
  end
186
186
  end
187
+
188
+ ## License Information
189
+
190
+ This gem is distributed under the MIT License.
191
+
192
+ Copyright (C) 2013 Vero (Invc Me Inc.)
193
+
194
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
195
+
196
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
197
+
198
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -24,6 +24,7 @@ module Vero
24
24
  autoload :EditAPI, 'vero/api/users/edit_api'
25
25
  autoload :EditTagsAPI, 'vero/api/users/edit_tags_api'
26
26
  autoload :UnsubscribeAPI, 'vero/api/users/unsubscribe_api'
27
+ autoload :ReidentifyAPI, 'vero/api/users/reidentify_api'
27
28
  end
28
29
  end
29
30
 
@@ -11,6 +11,15 @@ module Vero
11
11
  self.context.config
12
12
  end
13
13
 
14
+ def run_api(api_klass, options)
15
+ validate_configured!
16
+ options.merge!(config.request_params)
17
+
18
+ unless config.disabled
19
+ Vero::Sender.send(api_klass, config.async, config.domain, options)
20
+ end
21
+ end
22
+
14
23
  protected
15
24
  def validate_configured!
16
25
  unless config.configured?
@@ -25,12 +34,7 @@ module Vero
25
34
  end
26
35
 
27
36
  def track!(options)
28
- validate_configured!
29
-
30
- options.merge!(config.request_params)
31
- unless config.disabled
32
- Vero::Sender.send Vero::Api::Workers::Events::TrackAPI, config.async, config.domain, options
33
- end
37
+ run_api(Vero::Api::Workers::Events::TrackAPI, options)
34
38
  end
35
39
  end
36
40
 
@@ -52,41 +56,23 @@ module Vero
52
56
  end
53
57
 
54
58
  def track!(options)
55
- validate_configured!
56
-
57
- options.merge!(config.request_params)
58
- unless config.disabled
59
- Vero::Sender.send Vero::Api::Workers::Users::TrackAPI, config.async, config.domain, options
60
- end
59
+ run_api(Vero::Api::Workers::Users::TrackAPI, options)
61
60
  end
62
61
 
63
62
  def edit_user!(options)
64
- validate_configured!
65
- options.merge!(config.request_params)
66
-
67
- unless config.disabled
68
- Vero::Sender.send Vero::Api::Workers::Users::EditAPI, config.async, config.domain, options
69
- end
63
+ run_api(Vero::Api::Workers::Users::EditAPI, options)
70
64
  end
71
65
 
72
66
  def edit_user_tags!(options)
73
- validate_configured!
74
-
75
- options.merge!(config.request_params)
76
-
77
- unless config.disabled
78
- Vero::Sender.send Vero::Api::Workers::Users::EditTagsAPI, config.async, config.domain, options
79
- end
67
+ run_api(Vero::Api::Workers::Users::EditTagsAPI, options)
80
68
  end
81
69
 
82
70
  def unsubscribe!(options)
83
- validate_configured!
84
-
85
- options.merge!(config.request_params)
71
+ run_api(Vero::Api::Workers::Users::UnsubscribeAPI, options)
72
+ end
86
73
 
87
- unless config.disabled
88
- Vero::Sender.send Vero::Api::Workers::Users::UnsubscribeAPI, config.async, config.domain, options
89
- end
74
+ def reidentify!(options)
75
+ run_api(Vero::Api::Workers::Users::ReidentifyAPI, options)
90
76
  end
91
77
  end
92
78
  end
@@ -0,0 +1,22 @@
1
+ module Vero
2
+ module Api
3
+ module Workers
4
+ module Users
5
+ class ReidentifyAPI < BaseAPI
6
+ def url
7
+ "#{@domain}/api/v2/users/reidentify.json"
8
+ end
9
+
10
+ def request
11
+ RestClient.put(url, self.request_params_as_json, self.request_content_type)
12
+ end
13
+
14
+ def validate!
15
+ raise ArgumentError.new("Missing :id") if options[:id].to_s.blank?
16
+ raise ArgumentError.new("Missing :new_id") if options[:new_id].to_s.blank?
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Vero
2
- VERSION = '0.5.10'
2
+ VERSION = '0.5.11'
3
3
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vero::Api::Workers::Users::ReidentifyAPI do
4
+ subject { Vero::Api::Workers::Users::ReidentifyAPI.new('https://api.getvero.com', {}) }
5
+ it "should inherit from Vero::Api::Workers::BaseCaller" do
6
+ subject.should be_a(Vero::Api::Workers::BaseAPI)
7
+ end
8
+
9
+ it "should map to current version of Vero API" do
10
+ subject.send(:url).should == "https://api.getvero.com/api/v2/users/reidentify.json"
11
+ end
12
+
13
+ subject { Vero::Api::Workers::Users::ReidentifyAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :id => 'test@test.com', :new_id => 'test2@test.com'}) }
14
+ describe :validate! do
15
+ it "should not raise an error when the keys are Strings" do
16
+ options = {"auth_token" => 'abcd', "id" => 'test@test.com', "new_id" => 'test2@test.com'}
17
+ subject.options = options
18
+ expect { subject.send(:validate!) }.to_not raise_error(ArgumentError)
19
+ end
20
+
21
+ it "should raise an error if id is missing" do
22
+ subject.options = {:auth_token => 'abcd', :new_id => 'test2@test.com'}
23
+ expect { subject.send(:validate!) }.to raise_error
24
+ end
25
+
26
+ it "should raise an error if new_id is missing" do
27
+ subject.options = {:auth_token => 'abcd', :id => 'test@test.com'}
28
+ expect { subject.send(:validate!) }.to raise_error
29
+ end
30
+ end
31
+
32
+ describe :request do
33
+ it "should send a request to the Vero API" do
34
+ RestClient.should_receive(:put).with("https://api.getvero.com/api/v2/users/reidentify.json", {:auth_token => 'abcd', :id => 'test@test.com', :new_id => 'test2@test.com'}.to_json, {:content_type => :json, :accept => :json})
35
+ RestClient.stub(:put).and_return(200)
36
+ subject.send(:request)
37
+ end
38
+ end
39
+
40
+ describe "integration test" do
41
+ it "should not raise any errors" do
42
+ RestClient.stub(:put).and_return(200)
43
+ expect { subject.perform }.to_not raise_error
44
+ end
45
+ end
46
+ end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.authors = ['James Lamont']
14
14
 
15
15
  dependencies = [
16
- [:development, 'rails', ">= 3"],
16
+ [:development, 'rails', "~> 3.0"],
17
17
  [:development, 'rspec'],
18
18
  [:development, 'delayed_job'],
19
19
  [:development, 'delayed_job_active_record'],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-10 00:00:00.000000000 Z
12
+ date: 2014-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '3'
21
+ version: '3.0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '3'
29
+ version: '3.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +152,7 @@ files:
152
152
  - lib/vero/api/events/track_api.rb
153
153
  - lib/vero/api/users/edit_api.rb
154
154
  - lib/vero/api/users/edit_tags_api.rb
155
+ - lib/vero/api/users/reidentify_api.rb
155
156
  - lib/vero/api/users/track_api.rb
156
157
  - lib/vero/api/users/unsubscribe_api.rb
157
158
  - lib/vero/api.rb
@@ -180,6 +181,7 @@ files:
180
181
  - spec/lib/api/events/track_api_spec.rb
181
182
  - spec/lib/api/users/edit_api_spec.rb
182
183
  - spec/lib/api/users/edit_tags_api_spec.rb
184
+ - spec/lib/api/users/reidentify_spec.rb
183
185
  - spec/lib/api/users/track_api_spec.rb
184
186
  - spec/lib/api/users/unsubscribe_api_spec.rb
185
187
  - spec/lib/api_spec.rb
@@ -223,6 +225,7 @@ test_files:
223
225
  - spec/lib/api/events/track_api_spec.rb
224
226
  - spec/lib/api/users/edit_api_spec.rb
225
227
  - spec/lib/api/users/edit_tags_api_spec.rb
228
+ - spec/lib/api/users/reidentify_spec.rb
226
229
  - spec/lib/api/users/track_api_spec.rb
227
230
  - spec/lib/api/users/unsubscribe_api_spec.rb
228
231
  - spec/lib/api_spec.rb