ravelin 0.1.37 → 0.1.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ravelin/authentication_mechanism.rb +4 -0
- data/lib/ravelin/authentication_mechanisms/social.rb +31 -0
- data/lib/ravelin/client.rb +9 -2
- data/lib/ravelin/event.rb +15 -14
- data/lib/ravelin/login.rb +2 -1
- data/lib/ravelin/proxy_client.rb +7 -2
- data/lib/ravelin/supplier.rb +30 -0
- data/lib/ravelin/version.rb +1 -1
- data/lib/ravelin.rb +4 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed7ce357df63f506c0332cda6d685e243c629dba53882e698c3c97c83110eb3
|
4
|
+
data.tar.gz: 7964f60d9fe6070c8cef7b906bc784dde0074e91f605e052c09416ad473c10b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7178959b3ccbb0cb4b55c1ef5de904fa5a3d662479a07e5246ce1d075af22acae6dc3de070c008e01f1abce11be3ae4ca25ebeee76e2e7c39ed6861f714dc864
|
7
|
+
data.tar.gz: ac1965cd41a4f15e058524a69bc782b9f984f7e2bc3418e2aa252382e25125e33a4d45b822e7d6153c53e943bc5a311218e386fcceb98c8caa8dfa8582be7b2e
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Ravelin
|
2
|
+
module AuthenticationMechanisms
|
3
|
+
class Social < RavelinObject
|
4
|
+
PROVIDERS = %w(apple azure facebook google linkedin microsoft okta onelogin ping twitter)
|
5
|
+
FAILURE_REASONS = %w(TIMEOUT UNKNOWN_USERNAME INTERNAL_ERROR RATE_LIMIT SOCIAL_FAILURE BANNED_USER)
|
6
|
+
|
7
|
+
attr_accessor :success, :social_provider, :failure_reason
|
8
|
+
attr_required :success, :social_provider
|
9
|
+
|
10
|
+
def social_provider=(provider)
|
11
|
+
@social_provider = provider.to_s.downcase
|
12
|
+
end
|
13
|
+
|
14
|
+
def failure_reason=(reason)
|
15
|
+
@failure_reason = reason.to_s.upcase
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate
|
19
|
+
super
|
20
|
+
|
21
|
+
if !success && !FAILURE_REASONS.include?(failure_reason)
|
22
|
+
raise ArgumentError.new("Failure reason value must be one of #{FAILURE_REASONS.join(', ')}")
|
23
|
+
end
|
24
|
+
|
25
|
+
if !PROVIDERS.include?(social_provider)
|
26
|
+
raise ArgumentError.new("Social provider value must be one of #{PROVIDERS.join(', ')}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/ravelin/client.rb
CHANGED
@@ -11,9 +11,10 @@ module Ravelin
|
|
11
11
|
class Client
|
12
12
|
API_BASE = 'https://api.ravelin.com'
|
13
13
|
|
14
|
-
def initialize(api_key:, api_version: 2)
|
14
|
+
def initialize(api_key:, api_version: 2, include_rule_output: false)
|
15
15
|
@api_key = api_key
|
16
16
|
@url_prefix = ''
|
17
|
+
@include_rule_output = include_rule_output
|
17
18
|
|
18
19
|
raise ArgumentError.new("api_version must be 2 or 3") unless [2,3].include? api_version
|
19
20
|
@api_version = api_version
|
@@ -110,7 +111,7 @@ module Ravelin
|
|
110
111
|
end
|
111
112
|
|
112
113
|
def faraday_options
|
113
|
-
{
|
114
|
+
options = {
|
114
115
|
request: { timeout: Ravelin.faraday_timeout },
|
115
116
|
headers: {
|
116
117
|
'Authorization' => "token #{@api_key}",
|
@@ -118,6 +119,12 @@ module Ravelin
|
|
118
119
|
'User-Agent' => "Ravelin RubyGem/#{Ravelin::VERSION}".freeze
|
119
120
|
}
|
120
121
|
}
|
122
|
+
|
123
|
+
if @include_rule_output
|
124
|
+
options[:headers]['Accept'] = 'application/vnd.ravelin.score.v2+json'
|
125
|
+
end
|
126
|
+
|
127
|
+
options
|
121
128
|
end
|
122
129
|
end
|
123
130
|
end
|
data/lib/ravelin/event.rb
CHANGED
@@ -27,21 +27,22 @@ module Ravelin
|
|
27
27
|
|
28
28
|
def object_classes
|
29
29
|
{
|
30
|
-
ato_login:
|
30
|
+
ato_login: AtoLogin,
|
31
31
|
authentication_mechanism: AuthenticationMechanism,
|
32
|
-
chargeback:
|
33
|
-
customer:
|
34
|
-
ato_reclaim:
|
35
|
-
device:
|
36
|
-
location:
|
37
|
-
login:
|
38
|
-
order:
|
39
|
-
password:
|
40
|
-
payment_method:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
chargeback: Chargeback,
|
33
|
+
customer: Customer,
|
34
|
+
ato_reclaim: AtoReclaim,
|
35
|
+
device: Device,
|
36
|
+
location: Location,
|
37
|
+
login: Login,
|
38
|
+
order: Order,
|
39
|
+
password: Password,
|
40
|
+
payment_method: PaymentMethod,
|
41
|
+
supplier: Supplier,
|
42
|
+
voucher_redemption: VoucherRedemption,
|
43
|
+
transaction: transaction,
|
44
|
+
label: Label,
|
45
|
+
voucher: Voucher,
|
45
46
|
}
|
46
47
|
end
|
47
48
|
|
data/lib/ravelin/login.rb
CHANGED
data/lib/ravelin/proxy_client.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Ravelin
|
2
2
|
class ProxyClient < Client
|
3
|
-
def initialize(base_url:, username:, password:, api_version: 2)
|
3
|
+
def initialize(base_url:, username:, password:, api_version: 2, include_rule_output: false)
|
4
4
|
|
5
5
|
raise ArgumentError, "api_version must be 2 or 3" unless [2,3].include? api_version
|
6
6
|
@api_version = api_version
|
7
7
|
@url_prefix = '/ravelinproxy'
|
8
|
+
@include_rule_output = include_rule_output
|
8
9
|
|
9
10
|
@connection = Faraday.new(base_url, faraday_proxy_options) do |conn|
|
10
11
|
conn.response :json, context_type: /\bjson$/
|
@@ -14,13 +15,17 @@ module Ravelin
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def faraday_proxy_options
|
17
|
-
{
|
18
|
+
options = {
|
18
19
|
request: { timeout: Ravelin.faraday_timeout },
|
19
20
|
headers: {
|
20
21
|
'Content-Type' => 'application/json; charset=utf-8'.freeze,
|
21
22
|
'User-Agent' => "Ravelin Proxy RubyGem/#{Ravelin::VERSION}".freeze
|
22
23
|
}
|
23
24
|
}
|
25
|
+
if @include_rule_output
|
26
|
+
options[:headers]['Accept'] = 'application/vnd.ravelin.score.v2+json'
|
27
|
+
end
|
28
|
+
options
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ravelin
|
2
|
+
class Supplier < RavelinObject
|
3
|
+
attr_accessor :supplier_id,
|
4
|
+
:type,
|
5
|
+
:group_id,
|
6
|
+
:group_name,
|
7
|
+
:registration_time,
|
8
|
+
:email,
|
9
|
+
:email_verified_time,
|
10
|
+
:name,
|
11
|
+
:telephone,
|
12
|
+
:telephone_verified_time,
|
13
|
+
:telephone_country,
|
14
|
+
:home_location,
|
15
|
+
:market,
|
16
|
+
:market_country,
|
17
|
+
:level,
|
18
|
+
:employment_type,
|
19
|
+
:transport_type,
|
20
|
+
:category,
|
21
|
+
:tags,
|
22
|
+
:custom
|
23
|
+
|
24
|
+
attr_required :supplier_id, :type
|
25
|
+
|
26
|
+
def home_location=(obj)
|
27
|
+
@home_location = Ravelin::Location.new(obj)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/ravelin/version.rb
CHANGED
data/lib/ravelin.rb
CHANGED
@@ -27,6 +27,7 @@ require 'ravelin/app'
|
|
27
27
|
require 'ravelin/payment_method'
|
28
28
|
require 'ravelin/password'
|
29
29
|
require 'ravelin/pre_transaction'
|
30
|
+
require 'ravelin/supplier'
|
30
31
|
require 'ravelin/three_d_secure'
|
31
32
|
require 'ravelin/transaction'
|
32
33
|
require 'ravelin/voucher'
|
@@ -39,6 +40,9 @@ require 'ravelin/response'
|
|
39
40
|
require 'ravelin/client'
|
40
41
|
require 'ravelin/proxy_client'
|
41
42
|
|
43
|
+
require 'ravelin/authentication_mechanisms/social'
|
44
|
+
|
45
|
+
|
42
46
|
module Ravelin
|
43
47
|
@faraday_adapter = Faraday.default_adapter
|
44
48
|
@faraday_timeout = 1
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ravelin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Levy
|
8
8
|
- Tommy Palmer
|
9
9
|
- Gurkan Oluc
|
10
10
|
- Mathilda Thompson
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-
|
14
|
+
date: 2021-12-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/ravelin/ato_login.rb
|
113
113
|
- lib/ravelin/ato_reclaim.rb
|
114
114
|
- lib/ravelin/authentication_mechanism.rb
|
115
|
+
- lib/ravelin/authentication_mechanisms/social.rb
|
115
116
|
- lib/ravelin/chargeback.rb
|
116
117
|
- lib/ravelin/checkout_transaction.rb
|
117
118
|
- lib/ravelin/client.rb
|
@@ -134,6 +135,7 @@ files:
|
|
134
135
|
- lib/ravelin/proxy_client.rb
|
135
136
|
- lib/ravelin/ravelin_object.rb
|
136
137
|
- lib/ravelin/response.rb
|
138
|
+
- lib/ravelin/supplier.rb
|
137
139
|
- lib/ravelin/tag.rb
|
138
140
|
- lib/ravelin/three_d_secure.rb
|
139
141
|
- lib/ravelin/transaction.rb
|
@@ -144,7 +146,7 @@ homepage: https://developer.ravelin.com
|
|
144
146
|
licenses:
|
145
147
|
- MIT
|
146
148
|
metadata: {}
|
147
|
-
post_install_message:
|
149
|
+
post_install_message:
|
148
150
|
rdoc_options: []
|
149
151
|
require_paths:
|
150
152
|
- lib
|
@@ -159,9 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
161
|
- !ruby/object:Gem::Version
|
160
162
|
version: '0'
|
161
163
|
requirements: []
|
162
|
-
|
163
|
-
|
164
|
-
signing_key:
|
164
|
+
rubygems_version: 3.0.9
|
165
|
+
signing_key:
|
165
166
|
specification_version: 4
|
166
167
|
summary: Ruby bindings for the Ravelin API
|
167
168
|
test_files: []
|