diff --git a/lib/vero/api/base_api.rb b/lib/vero/api/base_api.rb index d716b6d..0227eef 100644 --- a/lib/vero/api/base_api.rb +++ b/lib/vero/api/base_api.rb @@ -11,8 +11,7 @@ class BaseAPI attr_reader :options def self.perform(domain, options) - caller = new(domain, options) - caller.perform + new(domain, options).perform end def initialize(domain, options) @@ -42,7 +41,13 @@ def proxy.<<(message) end end - def url; end + def url + "#{@domain}/api/v2/#{api_url}" + end + + def api_url + raise NotImplementedError + end def validate! raise "#{self.class.name}#validate! should be overridden" diff --git a/lib/vero/api/events/track_api.rb b/lib/vero/api/events/track_api.rb index 9c54911..aea63b0 100644 --- a/lib/vero/api/events/track_api.rb +++ b/lib/vero/api/events/track_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Events class TrackAPI < BaseAPI - def url - "#{@domain}/api/v2/events/track.json" + def api_url + 'events/track.json' end def request diff --git a/lib/vero/api/users/edit_api.rb b/lib/vero/api/users/edit_api.rb index c0426fe..ff98f96 100644 --- a/lib/vero/api/users/edit_api.rb +++ b/lib/vero/api/users/edit_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class EditAPI < BaseAPI - def url - "#{@domain}/api/v2/users/edit.json" + def api_url + 'users/edit.json' end def request diff --git a/lib/vero/api/users/edit_tags_api.rb b/lib/vero/api/users/edit_tags_api.rb index bce1994..25d81d0 100644 --- a/lib/vero/api/users/edit_tags_api.rb +++ b/lib/vero/api/users/edit_tags_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class EditTagsAPI < BaseAPI - def url - "#{@domain}/api/v2/users/tags/edit.json" + def api_url + 'users/tags/edit.json' end def request diff --git a/lib/vero/api/users/reidentify_api.rb b/lib/vero/api/users/reidentify_api.rb index cb22397..e2e6d56 100644 --- a/lib/vero/api/users/reidentify_api.rb +++ b/lib/vero/api/users/reidentify_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class ReidentifyAPI < BaseAPI - def url - "#{@domain}/api/v2/users/reidentify.json" + def api_url + 'users/reidentify.json' end def request diff --git a/lib/vero/api/users/resubscribe_api.rb b/lib/vero/api/users/resubscribe_api.rb index 9ac6ba8..ae19c16 100644 --- a/lib/vero/api/users/resubscribe_api.rb +++ b/lib/vero/api/users/resubscribe_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class ResubscribeAPI < BaseAPI - def url - "#{@domain}/api/v2/users/resubscribe.json" + def api_url + 'users/resubscribe.json' end def request diff --git a/lib/vero/api/users/track_api.rb b/lib/vero/api/users/track_api.rb index 41b1f10..0eeaa12 100644 --- a/lib/vero/api/users/track_api.rb +++ b/lib/vero/api/users/track_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class TrackAPI < BaseAPI - def url - "#{@domain}/api/v2/users/track.json" + def api_url + 'users/track.json' end def request diff --git a/lib/vero/api/users/unsubscribe_api.rb b/lib/vero/api/users/unsubscribe_api.rb index 7ed6b3d..f02df1b 100644 --- a/lib/vero/api/users/unsubscribe_api.rb +++ b/lib/vero/api/users/unsubscribe_api.rb @@ -5,8 +5,8 @@ module Api module Workers module Users class UnsubscribeAPI < BaseAPI - def url - "#{@domain}/api/v2/users/unsubscribe.json" + def api_url + 'users/unsubscribe.json' end def request