tokenr-ruby 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 123b21c4a01928c071ed6342f10febbc57d10a48103463f2cef0c0a9b596915f
4
- data.tar.gz: '008e8aee3a0ef09e2e0cdfb3dcf077716daa34d8d95c153a2ff3eed2f3381cbc'
3
+ metadata.gz: 15ea6965561601d93515ffdf3448f286976ad610bcb2374f225d30404fa6d008
4
+ data.tar.gz: d4e501b932db24625348ed27c82003e702dcf4e05ec32664e7bd1255eb13ac43
5
5
  SHA512:
6
- metadata.gz: 38b6597c2dfb33c03438d2e225c7e0380bfad3870d91fe918a24ef0c61cdfd7fe4ba0fd775c788064eec8929ffbdaead10882402cb7e6249ff4ebb8246bbce64
7
- data.tar.gz: 5b0782571b01576d11cd81d9b662a4b2df398d382fa595098446bb5765dac9b4963d68bc2ed35b3a5a623fc878a33225398d44995d3db4640eb00aba9300aef8
6
+ metadata.gz: 255f3b2269c15a41ad3e29c3f302dd79a2498e4098351afa8827db98cc8dde58d75b0acc625e899af24d68ce2bd892a2128e8471f8ac599b6a8aad2fe5555e2f
7
+ data.tar.gz: 9f46b51a1e802659dd855474f4fa1c67cbfc8a320560d16130c6ba6e87bb8c8ae84f62f635b8035c5454fbbcbaa2e0d83e8e44d9c4fa8393f9956a0e13588349
data/lib/tokenr/client.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "net/http"
4
4
  require "json"
5
+ require "openssl"
5
6
  require "uri"
6
7
 
7
8
  module Tokenr
@@ -66,9 +67,17 @@ module Tokenr
66
67
  def request(method, path, body = nil, params = {})
67
68
  uri = build_uri(path, params)
68
69
  http = Net::HTTP.new(uri.host, uri.port)
69
- http.use_ssl = uri.scheme == "https"
70
- http.open_timeout = 5
71
- http.read_timeout = 30
70
+ http.use_ssl = uri.scheme == "https"
71
+ http.open_timeout = 5
72
+ http.read_timeout = 30
73
+ if http.use_ssl?
74
+ # Use VERIFY_PEER with an explicit cert store that has no CRL check flags.
75
+ # This keeps certificate chain validation while avoiding CRL fetch failures
76
+ # on servers whose CA certificates have CRL distribution points that are
77
+ # unreachable or return errors.
78
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
79
+ http.cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
80
+ end
72
81
 
73
82
  req = build_request(method, uri, body)
74
83
  handle_response(http.request(req))
@@ -39,7 +39,7 @@ module Tokenr
39
39
 
40
40
  def messages(model:, messages:, **params)
41
41
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
42
- response = client.messages(model: model, messages: messages, **params)
42
+ response = client.messages.create(model: model, messages: messages, **params)
43
43
  latency = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
44
44
 
45
45
  track_response(model, response, latency)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tokenr
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokenr-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tokenr