sift 4.5.0 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +49 -0
- data/HISTORY +3 -0
- data/lib/sift/client.rb +7 -7
- data/lib/sift/version.rb +2 -1
- data/lib/sift.rb +3 -3
- data/test_integration_app/verification_api/test_verification_api.rb +3 -3
- metadata +6 -7
- data/.circleci/config.yml +0 -105
- data/.jenkins/Jenkinsfile +0 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be867318fbb8cb5cb85b614e48de3748def9c8d9a6122c066c785d65c6b3b48
|
4
|
+
data.tar.gz: abf0fe3da0bbf939f29cdb1071e9acb7db62473bc9fdc37dcde52631db930abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc2d9d80295f6f4605413d001bb29b4745e28ecc58e9595a526bd8a7d8529d2b63dc14fce063e1ee347bde3b9d9370ad160917a795e59377a54d5eeb50f876b7
|
7
|
+
data.tar.gz: f5f75423865db471ed649a4146a8e3e388203977ec6607c20966c9622f9b074f8e149574f9bbe28db22f44b21203e9ae082b52386bea6f8c2096afd869955a65
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: Ruby-ci
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
env:
|
12
|
+
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
|
13
|
+
API_KEY: ${{ secrets.API_KEY }}
|
14
|
+
|
15
|
+
permissions:
|
16
|
+
contents: read
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
build:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
strategy:
|
22
|
+
matrix:
|
23
|
+
ruby-version: ['2.4.2']
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v4
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rspec --format RspecJunitFormatter --out test_results/rspec.xml --format progress
|
33
|
+
|
34
|
+
run_integration_tests:
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
if: ${{ github.ref == 'refs/heads/master' }}
|
37
|
+
strategy:
|
38
|
+
matrix:
|
39
|
+
ruby-version: [ '2.4.2' ]
|
40
|
+
steps:
|
41
|
+
- uses: actions/checkout@v4
|
42
|
+
- name: Set up Ruby
|
43
|
+
uses: ruby/setup-ruby@v1
|
44
|
+
with:
|
45
|
+
ruby-version: ${{ matrix.ruby-version }}
|
46
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
47
|
+
- name: Run tests
|
48
|
+
run: |
|
49
|
+
bundle exec ruby test_integration_app/main.rb
|
data/HISTORY
CHANGED
data/lib/sift/client.rb
CHANGED
@@ -139,6 +139,7 @@ module Sift
|
|
139
139
|
@api_key = opts[:api_key] || Sift.api_key
|
140
140
|
@account_id = opts[:account_id] || Sift.account_id
|
141
141
|
@version = opts[:version] || API_VERSION
|
142
|
+
@verification_version = opts[:verification_version] || VERIFICATION_API_VERSION
|
142
143
|
@timeout = opts[:timeout] || 2 # 2-second timeout by default
|
143
144
|
@path = opts[:path] || Sift.rest_api_path(@version)
|
144
145
|
|
@@ -201,7 +202,7 @@ module Sift
|
|
201
202
|
#
|
202
203
|
# :path::
|
203
204
|
# Overrides the URI path for this API call.
|
204
|
-
#
|
205
|
+
#
|
205
206
|
# :include_score_percentiles::
|
206
207
|
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
|
207
208
|
#
|
@@ -286,7 +287,7 @@ module Sift
|
|
286
287
|
#
|
287
288
|
# :version::
|
288
289
|
# Overrides the version of the Events API to call.
|
289
|
-
#
|
290
|
+
#
|
290
291
|
# :include_score_percentiles::
|
291
292
|
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
|
292
293
|
#
|
@@ -350,7 +351,7 @@ module Sift
|
|
350
351
|
#
|
351
352
|
# :timeout::
|
352
353
|
# Overrides the timeout (in seconds) for this call.
|
353
|
-
#
|
354
|
+
#
|
354
355
|
# :include_score_percentiles::
|
355
356
|
# include_score_percentiles(optional) : Whether to add new parameter in the query parameter.
|
356
357
|
#
|
@@ -755,7 +756,7 @@ module Sift
|
|
755
756
|
|
756
757
|
def verification_send(properties = {}, opts = {})
|
757
758
|
api_key = opts[:api_key] || @api_key
|
758
|
-
version = opts[:
|
759
|
+
version = opts[:verification_version] || @verification_version
|
759
760
|
timeout = opts[:timeout] || @timeout
|
760
761
|
|
761
762
|
raise("properties cannot be empty") if properties.empty?
|
@@ -767,14 +768,13 @@ module Sift
|
|
767
768
|
:headers => build_default_headers_post(api_key)
|
768
769
|
}
|
769
770
|
options.merge!(:timeout => timeout) unless timeout.nil?
|
770
|
-
|
771
771
|
response = self.class.post(Sift.verification_api_send_path(@version), options)
|
772
772
|
Response.new(response.body, response.code, response.response)
|
773
773
|
end
|
774
774
|
|
775
775
|
def verification_resend(properties = {}, opts = {})
|
776
776
|
api_key = opts[:api_key] || @api_key
|
777
|
-
version = opts[:
|
777
|
+
version = opts[:verification_version] || @verification_version
|
778
778
|
timeout = opts[:timeout] || @timeout
|
779
779
|
|
780
780
|
raise("properties cannot be empty") if properties.empty?
|
@@ -793,7 +793,7 @@ module Sift
|
|
793
793
|
|
794
794
|
def verification_check(properties = {}, opts = {})
|
795
795
|
api_key = opts[:api_key] || @api_key
|
796
|
-
version = opts[:
|
796
|
+
version = opts[:verification_version] || @verification_version
|
797
797
|
timeout = opts[:timeout] || @timeout
|
798
798
|
|
799
799
|
raise("properties cannot be empty") if properties.empty?
|
data/lib/sift/version.rb
CHANGED
data/lib/sift.rb
CHANGED
@@ -10,17 +10,17 @@ module Sift
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Returns the path for the specified API version
|
13
|
-
def self.verification_api_send_path(version=
|
13
|
+
def self.verification_api_send_path(version=VERIFICATION_API_VERSION)
|
14
14
|
"/v#{version}/verification/send"
|
15
15
|
end
|
16
16
|
|
17
17
|
# Returns the path for the specified API version
|
18
|
-
def self.verification_api_resend_path(version=
|
18
|
+
def self.verification_api_resend_path(version=VERIFICATION_API_VERSION)
|
19
19
|
"/v#{version}/verification/resend"
|
20
20
|
end
|
21
21
|
|
22
22
|
# Returns the path for the specified API version
|
23
|
-
def self.verification_api_check_path(version=
|
23
|
+
def self.verification_api_check_path(version=VERIFICATION_API_VERSION)
|
24
24
|
"/v#{version}/verification/check"
|
25
25
|
end
|
26
26
|
|
@@ -2,13 +2,13 @@ require "sift"
|
|
2
2
|
|
3
3
|
class VerificationAPI
|
4
4
|
|
5
|
-
@@client = Sift::Client.new(:api_key => ENV["API_KEY"], :version=>1.1)
|
5
|
+
@@client = Sift::Client.new(:api_key => ENV["API_KEY"], :version => 1.1)
|
6
6
|
|
7
7
|
def send()
|
8
8
|
properties = {
|
9
9
|
"$user_id" => $user_id,
|
10
10
|
"$send_to" => $user_email,
|
11
|
-
"$verification_type"
|
11
|
+
"$verification_type" => "$email",
|
12
12
|
"$brand_name" => "MyTopBrand",
|
13
13
|
"$language" => "en",
|
14
14
|
"$site_country" => "IN",
|
@@ -28,5 +28,5 @@ class VerificationAPI
|
|
28
28
|
|
29
29
|
return @@client.verification_send(properties)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Sadaghiani
|
8
8
|
- Yoav Schatzberg
|
9
9
|
- Jacob Burnim
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -123,11 +123,10 @@ executables: []
|
|
123
123
|
extensions: []
|
124
124
|
extra_rdoc_files: []
|
125
125
|
files:
|
126
|
-
- ".circleci/config.yml"
|
127
126
|
- ".github/pull_request_template.md"
|
127
|
+
- ".github/workflows/ci.yml"
|
128
128
|
- ".github/workflows/publishing_sift_ruby.yml"
|
129
129
|
- ".gitignore"
|
130
|
-
- ".jenkins/Jenkinsfile"
|
131
130
|
- Gemfile
|
132
131
|
- HISTORY
|
133
132
|
- LICENSE
|
@@ -171,7 +170,7 @@ files:
|
|
171
170
|
homepage: http://siftscience.com
|
172
171
|
licenses: []
|
173
172
|
metadata: {}
|
174
|
-
post_install_message:
|
173
|
+
post_install_message:
|
175
174
|
rdoc_options: []
|
176
175
|
require_paths:
|
177
176
|
- lib
|
@@ -187,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
186
|
version: '0'
|
188
187
|
requirements: []
|
189
188
|
rubygems_version: 3.1.6
|
190
|
-
signing_key:
|
189
|
+
signing_key:
|
191
190
|
specification_version: 4
|
192
191
|
summary: Sift Science Ruby API Gem
|
193
192
|
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
orbs:
|
4
|
-
slack: circleci/slack@4.4.2
|
5
|
-
|
6
|
-
commands:
|
7
|
-
export_slack_id:
|
8
|
-
steps:
|
9
|
-
- run:
|
10
|
-
name : Exporting circleci username as slack id.
|
11
|
-
command: echo 'export SLACK_PARAM_MENTIONS="$CIRCLE_USERNAME"' >> "$BASH_ENV"
|
12
|
-
- run:
|
13
|
-
name : CircleCi To Slack user mapping.
|
14
|
-
command: |
|
15
|
-
echo $GITHUB_SLACK_USERMAPPING | base64 --decode > github_slack
|
16
|
-
while read -r line || [[ -n $line ]];
|
17
|
-
do
|
18
|
-
[[ ${line//[[:space:]]/} =~ ^#.* || -z "$line" ]] && continue
|
19
|
-
echo "$line" | tr "=" "\n" | while read -r key; do
|
20
|
-
read -r value
|
21
|
-
if [ "$CIRCLE_USERNAME" = "${key}" ]; then
|
22
|
-
echo "export SLACK_PARAM_MENTIONS='<@${value}>'" >> $BASH_ENV
|
23
|
-
fi
|
24
|
-
done
|
25
|
-
done < github_slack
|
26
|
-
rm github_slack
|
27
|
-
|
28
|
-
slack/notify: &slack_notify
|
29
|
-
branch_pattern: master
|
30
|
-
event: fail
|
31
|
-
channel: ci-build-status
|
32
|
-
template: SLACK_TAG_CI_FAILURE_TEMPLATE
|
33
|
-
|
34
|
-
context: &context
|
35
|
-
- slack-templates
|
36
|
-
- slack_Oauth
|
37
|
-
- Github_Slack_UserMapping
|
38
|
-
|
39
|
-
jobs:
|
40
|
-
build:
|
41
|
-
parallelism: 3 # run three instances of this job in parallel
|
42
|
-
docker:
|
43
|
-
- image: circleci/ruby:2.4.2-jessie-node
|
44
|
-
environment:
|
45
|
-
BUNDLE_JOBS: 3
|
46
|
-
BUNDLE_RETRY: 3
|
47
|
-
BUNDLE_PATH: vendor/bundle
|
48
|
-
steps:
|
49
|
-
- checkout
|
50
|
-
- export_slack_id
|
51
|
-
|
52
|
-
- run:
|
53
|
-
name: Which bundler?
|
54
|
-
command: bundle -v
|
55
|
-
|
56
|
-
- restore_cache:
|
57
|
-
keys:
|
58
|
-
- sift-bundle-{{ checksum "sift.gemspec" }}
|
59
|
-
- sift-bundle-
|
60
|
-
|
61
|
-
- run:
|
62
|
-
name: Bundle Install
|
63
|
-
command: bundle check || bundle install
|
64
|
-
|
65
|
-
- save_cache:
|
66
|
-
key: sift-bundle-{{ checksum "sift.gemspec" }}
|
67
|
-
paths:
|
68
|
-
- vendor/bundle
|
69
|
-
|
70
|
-
- run:
|
71
|
-
name: Run rspec in parallel
|
72
|
-
command: |
|
73
|
-
bundle exec rspec --profile 10 \
|
74
|
-
--format RspecJunitFormatter \
|
75
|
-
--out test_results/rspec.xml \
|
76
|
-
--format progress \
|
77
|
-
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
78
|
-
|
79
|
-
- store_test_results:
|
80
|
-
path: test_results
|
81
|
-
- slack/notify:
|
82
|
-
<<: *slack_notify
|
83
|
-
|
84
|
-
run_integration_tests:
|
85
|
-
docker:
|
86
|
-
- image: circleci/ruby:2.4.2-jessie-node
|
87
|
-
steps:
|
88
|
-
- checkout
|
89
|
-
- run:
|
90
|
-
name: Install bundle and run the tests
|
91
|
-
command: |
|
92
|
-
bundle check || bundle install
|
93
|
-
bundle exec ruby test_integration_app/main.rb
|
94
|
-
|
95
|
-
workflows:
|
96
|
-
ruby-test:
|
97
|
-
jobs:
|
98
|
-
- build:
|
99
|
-
context: *context
|
100
|
-
ruby-integration-tests:
|
101
|
-
jobs:
|
102
|
-
- run_integration_tests:
|
103
|
-
filters:
|
104
|
-
branches:
|
105
|
-
only: master
|
data/.jenkins/Jenkinsfile
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
// Load Jenkins shared library
|
2
|
-
jenkinsBranch = 'v0.37.0'
|
3
|
-
sharedLib = library("shared-lib@${jenkinsBranch}")
|
4
|
-
|
5
|
-
def siftRubyWorkflow = sharedLib.com.sift.ci.SiftRubyWorkflow.new()
|
6
|
-
def ciUtil = sharedLib.com.sift.ci.CIUtil.new()
|
7
|
-
def stackdriver = sharedLib.com.sift.ci.StackDriverMetrics.new()
|
8
|
-
|
9
|
-
// Default GitHub status context for automatically triggered builds
|
10
|
-
def defaultStatusContext = 'Jenkins:auto'
|
11
|
-
|
12
|
-
// Pod template file for Jenkins agent pod
|
13
|
-
// Pod template yaml file is defined in https://github.com/SiftScience/jenkins/tree/master/resources/jenkins-k8s-pod-templates
|
14
|
-
def ruby2PodTemplateFile = 'ruby-2-4-2-pod-template.yaml'
|
15
|
-
def ruby2PodLabel = "ruby2-${BUILD_TAG}"
|
16
|
-
|
17
|
-
|
18
|
-
// GitHub repo name
|
19
|
-
def repoName = 'sift-ruby'
|
20
|
-
|
21
|
-
pipeline {
|
22
|
-
agent none
|
23
|
-
options {
|
24
|
-
timestamps()
|
25
|
-
skipDefaultCheckout()
|
26
|
-
disableConcurrentBuilds()
|
27
|
-
disableRestartFromStage()
|
28
|
-
parallelsAlwaysFailFast()
|
29
|
-
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
|
30
|
-
timeout(time: 1, unit: 'HOURS')
|
31
|
-
}
|
32
|
-
environment {
|
33
|
-
GIT_BRANCH = "${env.CHANGE_BRANCH != null? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
34
|
-
}
|
35
|
-
stages {
|
36
|
-
stage('Initialize') {
|
37
|
-
steps {
|
38
|
-
script {
|
39
|
-
statusContext = defaultStatusContext
|
40
|
-
// Get the commit sha for the build
|
41
|
-
commitSha = ciUtil.commitHashForBuild()
|
42
|
-
ciUtil.updateGithubCommitStatus(repoName, statusContext, 'Started', 'pending', commitSha)
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
stage ('Build and Test Workflows') {
|
47
|
-
steps {
|
48
|
-
script {
|
49
|
-
def workflows = [:]
|
50
|
-
def stage1 = 'Run Integration Tests - ruby'
|
51
|
-
workflows[stage1] = {
|
52
|
-
stage(stage1) {
|
53
|
-
if (env.GIT_BRANCH.equals('master')) {
|
54
|
-
ciUtil.updateGithubCommitStatus(repoName, stage1, 'Started', 'pending', commitSha)
|
55
|
-
try {
|
56
|
-
siftRubyWorkflow.runSiftRubyIntegration(ruby2PodTemplateFile, ruby2PodLabel)
|
57
|
-
ciUtil.updateGithubCommitStatus(repoName, stage1, 'SUCCESS', 'success', commitSha)
|
58
|
-
} catch (Exception e) {
|
59
|
-
ciUtil.updateGithubCommitStatus(repoName, stage1, 'FAILURE', 'failure', commitSha)
|
60
|
-
print("${stage1} failed")
|
61
|
-
throw e
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
def stage2 = 'Test - ruby'
|
67
|
-
workflows[stage2] = {
|
68
|
-
stage(stage2) {
|
69
|
-
ciUtil.updateGithubCommitStatus(repoName, stage2, 'Started', 'pending', commitSha)
|
70
|
-
try {
|
71
|
-
siftRubyWorkflow.runSiftRubyTest(ruby2PodTemplateFile, ruby2PodLabel)
|
72
|
-
ciUtil.updateGithubCommitStatus(repoName, stage2, 'SUCCESS', 'success', commitSha)
|
73
|
-
} catch (Exception e) {
|
74
|
-
ciUtil.updateGithubCommitStatus(repoName, stage2, 'FAILURE', 'failure', commitSha)
|
75
|
-
print("${stage2} failed")
|
76
|
-
throw e
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
parallel workflows
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
post {
|
86
|
-
success {
|
87
|
-
script {
|
88
|
-
ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'success', commitSha)
|
89
|
-
}
|
90
|
-
}
|
91
|
-
unsuccessful {
|
92
|
-
script {
|
93
|
-
ciUtil.updateGithubCommitStatus(repoName, statusContext, currentBuild.currentResult, 'failure', commitSha)
|
94
|
-
ciUtil.notifySlack(repoName, commitSha)
|
95
|
-
}
|
96
|
-
}
|
97
|
-
always {
|
98
|
-
script {
|
99
|
-
stackdriver.updatePipelineStatistics(this)
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|