Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
=== 4.5.1 2025-04-07
- Fix Verification URLs

=== 4.5.0 2024-05-16
- Support for warnings in Events API

Expand Down
6 changes: 3 additions & 3 deletions lib/sift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ def self.rest_api_path(version=API_VERSION)
end

# Returns the path for the specified API version
def self.verification_api_send_path(version=API_VERSION)
def self.verification_api_send_path(version=VERIFICATION_API_VERSION)
"/v#{version}/verification/send"
end

# Returns the path for the specified API version
def self.verification_api_resend_path(version=API_VERSION)
def self.verification_api_resend_path(version=VERIFICATION_API_VERSION)
"/v#{version}/verification/resend"
end

# Returns the path for the specified API version
def self.verification_api_check_path(version=API_VERSION)
def self.verification_api_check_path(version=VERIFICATION_API_VERSION)
"/v#{version}/verification/check"
end

Expand Down
14 changes: 7 additions & 7 deletions lib/sift/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def initialize(opts = {})
@api_key = opts[:api_key] || Sift.api_key
@account_id = opts[:account_id] || Sift.account_id
@version = opts[:version] || API_VERSION
@verification_version = opts[:verification_version] || VERIFICATION_API_VERSION
@timeout = opts[:timeout] || 2 # 2-second timeout by default
@path = opts[:path] || Sift.rest_api_path(@version)

Expand Down Expand Up @@ -201,7 +202,7 @@ def user_agent
#
# :path::
# Overrides the URI path for this API call.
#
#
# :include_score_percentiles::
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
#
Expand Down Expand Up @@ -286,7 +287,7 @@ def track(event, properties = {}, opts = {})
#
# :version::
# Overrides the version of the Events API to call.
#
#
# :include_score_percentiles::
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
#
Expand Down Expand Up @@ -350,7 +351,7 @@ def score(user_id, opts = {})
#
# :timeout::
# Overrides the timeout (in seconds) for this call.
#
#
# :include_score_percentiles::
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
#
Expand Down Expand Up @@ -755,7 +756,7 @@ def build_default_headers_post(api_key)

def verification_send(properties = {}, opts = {})
api_key = opts[:api_key] || @api_key
version = opts[:version] || @version
version = opts[:verification_version] || @verification_version
timeout = opts[:timeout] || @timeout

raise("properties cannot be empty") if properties.empty?
Expand All @@ -767,14 +768,13 @@ def verification_send(properties = {}, opts = {})
:headers => build_default_headers_post(api_key)
}
options.merge!(:timeout => timeout) unless timeout.nil?

response = self.class.post(Sift.verification_api_send_path(@version), options)
Response.new(response.body, response.code, response.response)
end

def verification_resend(properties = {}, opts = {})
api_key = opts[:api_key] || @api_key
version = opts[:version] || @version
version = opts[:verification_version] || @verification_version
timeout = opts[:timeout] || @timeout

raise("properties cannot be empty") if properties.empty?
Expand All @@ -793,7 +793,7 @@ def verification_resend(properties = {}, opts = {})

def verification_check(properties = {}, opts = {})
api_key = opts[:api_key] || @api_key
version = opts[:version] || @version
version = opts[:verification_version] || @verification_version
timeout = opts[:timeout] || @timeout

raise("properties cannot be empty") if properties.empty?
Expand Down
3 changes: 2 additions & 1 deletion lib/sift/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module Sift
VERSION = "4.5.0"
VERSION = "4.5.1"
API_VERSION = "205"
VERIFICATION_API_VERSION = "1.1"
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

class VerificationAPI

@@client = Sift::Client.new(:api_key => ENV["API_KEY"], :version=>1.1)
@@client = Sift::Client.new(:api_key => ENV["API_KEY"], :version => 1.1)

def send()
properties = {
"$user_id" => $user_id,
"$send_to" => $user_email,
"$verification_type" => "$email",
"$verification_type" => "$email",
"$brand_name" => "MyTopBrand",
"$language" => "en",
"$site_country" => "IN",
Expand All @@ -28,5 +28,5 @@ def send()

return @@client.verification_send(properties)
end

end