ravelin 0.1.40 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '038662e7b1108a43857081c07582bf19219b547c81ad2e8c7971f6c743f93c37'
4
- data.tar.gz: 154459fe3f22b5d506d1952ba357bc03b1d9dfe394d882b63f37677e57aa9843
3
+ metadata.gz: d421badea5fa7f2c8701e2fa425ae44a7785e18e24e3d43247a34049db030523
4
+ data.tar.gz: 6ff503783c5a6801ecf1891eb367a35440c88749d6e6f7ed0fced31dacaad3a3
5
5
  SHA512:
6
- metadata.gz: e761e34a794cbd61dc33e498bb264aab90df7485f91c775387c3f8d09ce9bfd7c24ad7cc6fbe334b9bdeb005b4dbee27e476f3ff133b1fe480eeaf0dd350cb4e
7
- data.tar.gz: 7f8dc2b205484baaf0dd27b26505c0b7a6ba6a47db0c60d3f6ef126057613b664313669de15f3448927509e5982bc94f51d7bd03942dff3c681e172db0aaf639
6
+ metadata.gz: b1de388b1c385d75edc2685bbfe2103972ae050855c6f10f4657aaee4750ed2b4eceda70c9e3bcd89bd425321cf92e7bc2b0b200b186dfff71c2aee4d4d03a1f
7
+ data.tar.gz: caebae8e0e2273dc8a8c3f6d5cf2ec2e8cb0c0edb26c55e4c5134b3d361ba2572f792762392a1351de7a1e15e78c6889bb268e082e9e01a367b8d9d849395651
@@ -12,5 +12,17 @@ module Ravelin
12
12
  def password=(passwd)
13
13
  @password = Ravelin::Password.new(passwd)
14
14
  end
15
+
16
+ def social=(mechanism)
17
+ @social = Ravelin::AuthenticationMechanisms::Social.new(mechanism)
18
+ end
19
+
20
+ def sms_code=(mechanism)
21
+ @sms_code = Ravelin::AuthenticationMechanisms::SmsCode.new(mechanism)
22
+ end
23
+
24
+ def magic_link=(mechanism)
25
+ @magic_link = Ravelin::AuthenticationMechanisms::MagicLink.new(mechanism)
26
+ end
15
27
  end
16
28
  end
@@ -0,0 +1,35 @@
1
+ module Ravelin
2
+ module AuthenticationMechanisms
3
+ class MagicLink < RavelinObject
4
+ TRANSPORTATION_MECHANISM = %w(email sms)
5
+ FAILURE_REASONS = %w(INVALID_LINK TIMEOUT INTERNAL_ERROR RATE_LIMIT BANNED_USER)
6
+
7
+ attr_accessor :transport, :success, :email, :phone_number, :failure_reason
8
+ attr_required :transport, :success
9
+
10
+ def failure_reason=(reason)
11
+ @failure_reason = reason.to_s.upcase
12
+ end
13
+
14
+ def validate
15
+ super
16
+
17
+ if !success && !FAILURE_REASONS.include?(failure_reason)
18
+ raise ArgumentError.new("Failure reason value must be one of #{FAILURE_REASONS.join(', ')}")
19
+ end
20
+
21
+ if !TRANSPORTATION_MECHANISM.include?(transport)
22
+ raise ArgumentError.new("Transportation mechanism value must be one of #{TRANSPORTATION_MECHANISM.join(', ')}")
23
+ end
24
+
25
+ if transport == 'email' && email.nil?
26
+ raise ArgumentError.new("email must be present for email transportation mechanism")
27
+ end
28
+
29
+ if transport == 'sms' && phone_number.nil?
30
+ raise ArgumentError.new("phone_number must be present for sms transportation mechanism")
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ module Ravelin
2
+ module AuthenticationMechanisms
3
+ class SmsCode < RavelinObject
4
+ FAILURE_REASONS = %w(INVALID_CODE CODE_TIMEOUT INTERNAL_ERROR RATE_LIMIT BANNED_USER AUTHENTICATION_FAILURE)
5
+
6
+ attr_accessor :success, :phone_number, :failure_reason
7
+ attr_required :success, :phone_number
8
+
9
+ def failure_reason=(reason)
10
+ @failure_reason = reason.to_s.upcase
11
+ end
12
+
13
+ def validate
14
+ super
15
+
16
+ if !success && !FAILURE_REASONS.include?(failure_reason)
17
+ raise ArgumentError.new("Failure reason value must be one of #{FAILURE_REASONS.join(', ')}")
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -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/event.rb CHANGED
@@ -37,6 +37,9 @@ module Ravelin
37
37
  login: Login,
38
38
  order: Order,
39
39
  password: Password,
40
+ social: AuthenticationMechanisms::Social,
41
+ sms_code: AuthenticationMechanisms::SmsCode,
42
+ magic_link: AuthenticationMechanisms::MagicLink,
40
43
  payment_method: PaymentMethod,
41
44
  supplier: Supplier,
42
45
  voucher_redemption: VoucherRedemption,
@@ -1,3 +1,3 @@
1
1
  module Ravelin
2
- VERSION = '0.1.40'
2
+ VERSION = '0.1.44'
3
3
  end
data/lib/ravelin.rb CHANGED
@@ -40,6 +40,11 @@ require 'ravelin/response'
40
40
  require 'ravelin/client'
41
41
  require 'ravelin/proxy_client'
42
42
 
43
+ require 'ravelin/authentication_mechanisms/social'
44
+ require 'ravelin/authentication_mechanisms/sms_code'
45
+ require 'ravelin/authentication_mechanisms/magic_link'
46
+
47
+
43
48
  module Ravelin
44
49
  @faraday_adapter = Faraday.default_adapter
45
50
  @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.40
4
+ version: 0.1.44
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-11-29 00:00:00.000000000 Z
14
+ date: 2022-01-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -112,6 +112,9 @@ 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/magic_link.rb
116
+ - lib/ravelin/authentication_mechanisms/sms_code.rb
117
+ - lib/ravelin/authentication_mechanisms/social.rb
115
118
  - lib/ravelin/chargeback.rb
116
119
  - lib/ravelin/checkout_transaction.rb
117
120
  - lib/ravelin/client.rb
@@ -145,7 +148,7 @@ homepage: https://developer.ravelin.com
145
148
  licenses:
146
149
  - MIT
147
150
  metadata: {}
148
- post_install_message:
151
+ post_install_message:
149
152
  rdoc_options: []
150
153
  require_paths:
151
154
  - lib
@@ -160,9 +163,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
163
  - !ruby/object:Gem::Version
161
164
  version: '0'
162
165
  requirements: []
163
- rubyforge_project:
166
+ rubyforge_project:
164
167
  rubygems_version: 2.7.6.2
165
- signing_key:
168
+ signing_key:
166
169
  specification_version: 4
167
170
  summary: Ruby bindings for the Ravelin API
168
171
  test_files: []