Module: Sift
- Defined in:
- lib/sift.rb,
lib/sift/error.rb,
lib/sift/client.rb,
lib/sift/router.rb,
lib/sift/version.rb,
lib/sift/client/decision.rb,
lib/sift/utils/hash_getter.rb,
lib/sift/validate/decision.rb,
lib/sift/validate/primitive.rb,
lib/sift/client/decision/apply_to.rb
Defined Under Namespace
Modules: Utils, Validate Classes: ApiError, Client, Error, Response, Router
Constant Summary collapse
- VERSION =
"4.5.0"
- API_VERSION =
"205"
Class Attribute Summary collapse
-
.account_id ⇒ Object
Returns the value of attribute account_id.
-
.api_key ⇒ Object
Returns the value of attribute api_key.
Class Method Summary collapse
-
.content_decisions_api_path(account_id, user_id, content_id) ⇒ Object
Returns the path for Content Decisions API.
- .error(msg) ⇒ Object
- .fatal(msg) ⇒ Object
- .info(msg) ⇒ Object
-
.logger=(logger) ⇒ Object
Sets the Output logger to use within the client.
-
.order_decisions_api_path(account_id, order_id) ⇒ Object
Returns the path for Orders Decisions API.
-
.psp_merchant_api_path(account_id) ⇒ Object
Returns the path for psp Merchant API.
-
.psp_merchant_id_api_path(account_id, merchant_id) ⇒ Object
Returns the path for psp Merchant with id.
-
.rest_api_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version.
-
.score_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the Score API path for the specified user ID and API version.
-
.session_decisions_api_path(account_id, user_id, session_id) ⇒ Object
Returns the path for Session Decisions API.
-
.user_decisions_api_path(account_id, user_id) ⇒ Object
Returns the path for User Decisions API.
-
.user_score_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the User Score API path for the specified user ID and API version.
-
.users_label_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the users API path for the specified user ID and API version.
-
.verification_api_check_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version.
-
.verification_api_resend_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version.
-
.verification_api_send_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version.
- .warn(msg) ⇒ Object
-
.workflow_status_path(account_id, run_id) ⇒ Object
Returns the path for the Workflow Status API.
Class Attribute Details
.account_id ⇒ Object
Returns the value of attribute account_id.
93 94 95 |
# File 'lib/sift.rb', line 93 def account_id @account_id end |
.api_key ⇒ Object
Returns the value of attribute api_key.
88 89 90 |
# File 'lib/sift.rb', line 88 def api_key @api_key end |
Class Method Details
.content_decisions_api_path(account_id, user_id, content_id) ⇒ Object
Returns the path for Content Decisions API
68 69 70 71 72 |
# File 'lib/sift.rb', line 68 def self.content_decisions_api_path(account_id, user_id, content_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/users/#{ERB::Util.url_encode(user_id)}" \ "/content/#{ERB::Util.url_encode(content_id)}/decisions" end |
.error(msg) ⇒ Object
110 111 112 |
# File 'lib/sift.rb', line 110 def self.error(msg) @logger.error(msg) if @logger end |
.fatal(msg) ⇒ Object
114 115 116 |
# File 'lib/sift.rb', line 114 def self.fatal(msg) @logger.fatal(msg) if @logger end |
.info(msg) ⇒ Object
102 103 104 |
# File 'lib/sift.rb', line 102 def self.info(msg) @logger.info(msg) if @logger end |
.logger=(logger) ⇒ Object
Sets the Output logger to use within the client. This can be left uninitializaed but is useful for debugging.
98 99 100 |
# File 'lib/sift.rb', line 98 def self.logger=(logger) @logger = logger end |
.order_decisions_api_path(account_id, order_id) ⇒ Object
Returns the path for Orders Decisions API
55 56 57 58 |
# File 'lib/sift.rb', line 55 def self.order_decisions_api_path(account_id, order_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/orders/#{ERB::Util.url_encode(order_id)}/decisions" end |
.psp_merchant_api_path(account_id) ⇒ Object
Returns the path for psp Merchant API
75 76 77 78 |
# File 'lib/sift.rb', line 75 def self.psp_merchant_api_path(account_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/psp_management/merchants" end |
.psp_merchant_id_api_path(account_id, merchant_id) ⇒ Object
Returns the path for psp Merchant with id
81 82 83 84 |
# File 'lib/sift.rb', line 81 def self.psp_merchant_id_api_path(account_id, merchant_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/psp_management/merchants/#{ERB::Util.url_encode(merchant_id)}" end |
.rest_api_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version
8 9 10 |
# File 'lib/sift.rb', line 8 def self.rest_api_path(version=API_VERSION) "/v#{version}/events" end |
.score_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the Score API path for the specified user ID and API version
28 29 30 |
# File 'lib/sift.rb', line 28 def self.score_api_path(user_id, version=API_VERSION) "/v#{version}/score/#{ERB::Util.url_encode(user_id)}/" end |
.session_decisions_api_path(account_id, user_id, session_id) ⇒ Object
Returns the path for Session Decisions API
61 62 63 64 65 |
# File 'lib/sift.rb', line 61 def self.session_decisions_api_path(account_id, user_id, session_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/users/#{ERB::Util.url_encode(user_id)}" \ "/sessions/#{ERB::Util.url_encode(session_id)}/decisions" end |
.user_decisions_api_path(account_id, user_id) ⇒ Object
Returns the path for User Decisions API
49 50 51 52 |
# File 'lib/sift.rb', line 49 def self.user_decisions_api_path(account_id, user_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/users/#{ERB::Util.url_encode(user_id)}/decisions" end |
.user_score_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the User Score API path for the specified user ID and API version
33 34 35 |
# File 'lib/sift.rb', line 33 def self.user_score_api_path(user_id, version=API_VERSION) "/v#{version}/users/#{ERB::Util.url_encode(user_id)}/score" end |
.users_label_api_path(user_id, version = API_VERSION) ⇒ Object
Returns the users API path for the specified user ID and API version
38 39 40 |
# File 'lib/sift.rb', line 38 def self.users_label_api_path(user_id, version=API_VERSION) "/v#{version}/users/#{ERB::Util.url_encode(user_id)}/labels" end |
.verification_api_check_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version
23 24 25 |
# File 'lib/sift.rb', line 23 def self.verification_api_check_path(version=API_VERSION) "/v#{version}/verification/check" end |
.verification_api_resend_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version
18 19 20 |
# File 'lib/sift.rb', line 18 def self.verification_api_resend_path(version=API_VERSION) "/v#{version}/verification/resend" end |
.verification_api_send_path(version = API_VERSION) ⇒ Object
Returns the path for the specified API version
13 14 15 |
# File 'lib/sift.rb', line 13 def self.verification_api_send_path(version=API_VERSION) "/v#{version}/verification/send" end |
.warn(msg) ⇒ Object
106 107 108 |
# File 'lib/sift.rb', line 106 def self.warn(msg) @logger.warn(msg) if @logger end |
.workflow_status_path(account_id, run_id) ⇒ Object
Returns the path for the Workflow Status API
43 44 45 46 |
# File 'lib/sift.rb', line 43 def self.workflow_status_path(account_id, run_id) "/v3/accounts/#{ERB::Util.url_encode(account_id)}" \ "/workflows/runs/#{ERB::Util.url_encode(run_id)}" end |