ravelin 0.1.37 → 0.1.38

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: f1777e2b3d47dc15c850bf7c3877347c52110a0982ebe5b1c672b24b606e767e
4
- data.tar.gz: d7d071a3d9c85e96d050bed1e1f48630ead9f308ea00cd0236df02c06c2304c6
3
+ metadata.gz: 4bb2fff6bfc5b74fac97d935a1f0c7cc219ea2c8aa0bf5cab57244a1fc900a4e
4
+ data.tar.gz: 22eaffbcf9436735844d7668d25d1e17cc1f4928ed0fba942dedc781256aa6cf
5
5
  SHA512:
6
- metadata.gz: ac0fe4a54cb415a3a0ae7b83f955e38a5f1e29334c459c7a44eb4f038aa06feea8c04b72a1f9cdaa5848d31a59df5d72ea69dbe0c3c46240ef9ba40284bf5a80
7
- data.tar.gz: c2308e470c160d4d189b07a8c56305fc22d8295899666ec4e61a0459961f555e06fe9f3c03e4e8ea97a4507ebf2838358ec107397542489dbfc0f2f5690c97ce
6
+ metadata.gz: d60eb8693a0e562d3dfeb9a7977a2af2a76a94eba2a683134d73811f584245ad7d90b032168ad659dde9526ca88b32d70dd0b6ca99c3ae1e38cf7179b027e5dd
7
+ data.tar.gz: 6dc208e0f0016bf753c4df24134c5e0ffdf0c7d0581fcf94e97106db7afabe119f3c69f42318feb0ef15afa98d31012f5ebc1ee611f9db8e8eba4c999a4f7bf4
@@ -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
@@ -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.37'
2
+ VERSION = '0.1.38'
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.37
4
+ version: 0.1.38
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: 2021-06-14 00:00:00.000000000 Z
14
+ date: 2021-10-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday