ravelin 0.1.25 → 0.1.26

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: 2ca30db8a09466a96d2042c91b177bfc4a1478c063cdc848cf80bee5762a9ac4
4
- data.tar.gz: 6248744866c0924db62099bf3b2029b0ce8868a1acc4568b60e16c1bf5a27d5e
3
+ metadata.gz: 1f41610ead5380b5bd446d0029bfaf0d4f1bc6f9781d792da6e78b324702eb83
4
+ data.tar.gz: e9f5dd2ad5e40345818305013a948cae9908f46de33155812eecfb8e3c7e3210
5
5
  SHA512:
6
- metadata.gz: 06fe356e63f52fbae095cea6b997950e8990a847cd9c34a168f5a000bf21d981edc8e43834388a4e08def5a643253cac4494761539dd7ee73abbd405282e45db
7
- data.tar.gz: 82dd34a7c4e9d9d7018bd2af3c0ce466112289faa1f9d2d6ba4c2986cf39f1b78d6abb31143fda0840e143a2b8687de65d53f80157b10b467d8e3b8d71947170
6
+ metadata.gz: 9b033087792cdb6ddc94ab27fe3d9cc8b4307a823d6814d93a2706722c2b45d0f3774b8d79549365c352d9da65e2a2b42be8b94bff45a44a18094da1c92d1737
7
+ data.tar.gz: ca9e32eaf19d7fffcf050f1e75130c2609c299e1b2d50d20c2c8a66023ca7f0f8815574e8f612db47db699bf7bdb99dcb56ee6402b5eda44dba0331e1b7f3e07
@@ -35,6 +35,7 @@ require 'ravelin/event'
35
35
  require 'ravelin/tag'
36
36
  require 'ravelin/response'
37
37
  require 'ravelin/client'
38
+ require 'ravelin/proxy_client'
38
39
 
39
40
  module Ravelin
40
41
  @faraday_adapter = Faraday.default_adapter
@@ -13,6 +13,7 @@ module Ravelin
13
13
 
14
14
  def initialize(api_key:, api_version: 2)
15
15
  @api_key = api_key
16
+ @url_prefix = ''
16
17
 
17
18
  raise ArgumentError.new("api_version must be 2 or 3") unless [2,3].include? api_version
18
19
  @api_version = api_version
@@ -29,7 +30,7 @@ module Ravelin
29
30
 
30
31
  score_param = score ? "?score=true" : nil
31
32
 
32
- post("/v#{@api_version}/#{event.name}#{score_param}", event.serializable_hash)
33
+ post("#{@url_prefix}/v#{@api_version}/#{event.name}#{score_param}", event.serializable_hash)
33
34
  end
34
35
 
35
36
  def send_backfill_event(**args)
@@ -39,13 +40,13 @@ module Ravelin
39
40
 
40
41
  event = Event.new(**args)
41
42
 
42
- post("/v#{@api_version}/backfill/#{event.name}", event.serializable_hash)
43
+ post("#{@url_prefix}/v#{@api_version}/backfill/#{event.name}", event.serializable_hash)
43
44
  end
44
45
 
45
46
  def send_tag(**args)
46
47
  tag = Tag.new(**args)
47
48
 
48
- post("/v#{@api_version}/tag/customer", tag.serializable_hash)
49
+ post("#{@url_prefix}/v#{@api_version}/tag/customer", tag.serializable_hash)
49
50
  end
50
51
 
51
52
  def delete_tag(**args)
@@ -53,14 +54,14 @@ module Ravelin
53
54
  customer_id = tag["customerId"]
54
55
  tags = tag["tagNames"].join(",")
55
56
 
56
- delete("/v#{@api_version}/tag/customer?customerId=#{customer_id}&tagName=#{tags}")
57
+ delete("#{@url_prefix}/v#{@api_version}/tag/customer?customerId=#{customer_id}&tagName=#{tags}")
57
58
  end
58
59
 
59
60
  def get_tag(**args)
60
61
  tag = Tag.new(**args).serializable_hash
61
62
  customer_id = tag["customerId"]
62
63
 
63
- get("/v#{@api_version}/tag/customer/#{customer_id}")
64
+ get("#{@url_prefix}/v#{@api_version}/tag/customer/#{customer_id}")
64
65
  end
65
66
 
66
67
  private
@@ -0,0 +1,26 @@
1
+ module Ravelin
2
+ class ProxyClient < Client
3
+ def initialize(base_url:, username:, password:, api_version: 2)
4
+
5
+ raise ArgumentError, "api_version must be 2 or 3" unless [2,3].include? api_version
6
+ @api_version = api_version
7
+ @url_prefix = '/ravelinproxy'
8
+
9
+ @connection = Faraday.new(base_url, faraday_proxy_options) do |conn|
10
+ conn.response :json, context_type: /\bjson$/
11
+ conn.adapter Ravelin.faraday_adapter
12
+ conn.basic_auth(username, password)
13
+ end
14
+ end
15
+
16
+ def faraday_proxy_options
17
+ {
18
+ request: { timeout: Ravelin.faraday_timeout },
19
+ headers: {
20
+ 'Content-Type' => 'application/json; charset=utf-8'.freeze,
21
+ 'User-Agent' => "Ravelin Proxy RubyGem/#{Ravelin::VERSION}".freeze
22
+ }
23
+ }
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Ravelin
2
- VERSION = "0.1.25"
2
+ VERSION = "0.1.26"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravelin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Levy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-04-08 00:00:00.000000000 Z
14
+ date: 2020-05-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.15'
22
+ version: '0.17'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.15'
29
+ version: '0.17'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: faraday_middleware
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '0.10'
36
+ version: '0.14'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0.10'
43
+ version: '0.14'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: bundler
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -75,28 +75,28 @@ dependencies:
75
75
  requirements:
76
76
  - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: '3.0'
78
+ version: '3.9'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: '3.0'
85
+ version: '3.9'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: webmock
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '1.22'
92
+ version: '2.3'
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '1.22'
99
+ version: '2.3'
100
100
  description: Ravelin is a fraud detection tool. See https://www.ravelin.com for details.
101
101
  email:
102
102
  - sam.levy@deliveroo.co.uk
@@ -129,6 +129,7 @@ files:
129
129
  - lib/ravelin/password.rb
130
130
  - lib/ravelin/payment_method.rb
131
131
  - lib/ravelin/pre_transaction.rb
132
+ - lib/ravelin/proxy_client.rb
132
133
  - lib/ravelin/ravelin_object.rb
133
134
  - lib/ravelin/response.rb
134
135
  - lib/ravelin/tag.rb
@@ -156,7 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  - !ruby/object:Gem::Version
157
158
  version: '0'
158
159
  requirements: []
159
- rubygems_version: 3.0.6
160
+ rubyforge_project:
161
+ rubygems_version: 2.7.6.2
160
162
  signing_key:
161
163
  specification_version: 4
162
164
  summary: Ruby bindings for the Ravelin API