ravelin 0.1.34 → 0.1.39

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: 4a9f40b6308fcc73d7fdf88845254973b6c09eca4b8deac74b8885c6db755067
4
- data.tar.gz: 23f8ce1a7e4d2c9398b569be342260e1fb9d1520a822fe8fc1f835cb9ab86542
3
+ metadata.gz: 0a793f5a60f55e14c0720c5fc5c0a243b0a7abbf8e972d7ea66b784153a41df8
4
+ data.tar.gz: 58976fc86aa26e58a2cf9fd11d94ddb95df761013d144e365c5560ef2e53f2fd
5
5
  SHA512:
6
- metadata.gz: 8273aaf40a22a7f95099851824e1d03b943523bac0b8d8ed55a6a7110134bed0442d73abaa9b72bfb92e27573c1610d577520ffa4cc08ffe3d38ca6989194bda
7
- data.tar.gz: c01bdce148538af7ab80a21b2d2498305b9c0b78ceaac336f82d6b359afa26e28bbd95d9df13f119d2a32faa0882d881976d2300655be4da90f9487da1244cfc
6
+ metadata.gz: 24c544d57436933762d96615c9e6a608088aea9a83dc17cc6e1e9b6ed662c4f04eb968e5b1faca1a873403a31214aa111018b23c10596a5c59221dbfc5af5969
7
+ data.tar.gz: ae45e6285b2c6f2356ee8f5dd2ff600346ff66fc543198091c71d9053218f6da8ed01223a51b67c3ce795a5e0d0065ed070d29c17fe8a8aa8d3697e74731969b
@@ -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/login.rb CHANGED
@@ -3,7 +3,8 @@ module Ravelin
3
3
  attr_accessor :username,
4
4
  :customer_id,
5
5
  :success,
6
- :authentication_mechanism
6
+ :authentication_mechanism,
7
+ :custom
7
8
 
8
9
  attr_required :username, :success, :authentication_mechanism
9
10
 
data/lib/ravelin/order.rb CHANGED
@@ -14,7 +14,8 @@ module Ravelin
14
14
  :creation_time,
15
15
  :execution_time,
16
16
  :status,
17
- :app
17
+ :app,
18
+ :category
18
19
 
19
20
  attr_required :order_id
20
21
 
@@ -21,7 +21,8 @@ module Ravelin
21
21
  # Only when type = paypal
22
22
  :email,
23
23
  :custom,
24
- :e_wallet
24
+ :e_wallet,
25
+ :scheme
25
26
 
26
27
  attr_required :payment_method_id, :method_type
27
28
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Ravelin
2
- VERSION = '0.1.34'
2
+ VERSION = '0.1.39'
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.34
4
+ version: 0.1.39
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-12-02 00:00:00.000000000 Z
14
+ date: 2021-11-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday