inplay_ai 0.1.3 → 0.1.4

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: 94f6787341649cd5504fafc0088983e9785c067fc9dea501a6bcc0907ef927b9
4
- data.tar.gz: c498c2520aeadba3d00d03660dc5cdfb5de10470b195b020ff68483c3d7b1f66
3
+ metadata.gz: edf671763a4145a3c948adc274b6fc241e0b0290dd592f6eb48af443823ac837
4
+ data.tar.gz: b355cb0e5e9179ef7e7ea84dc80effec8179e1a8f76e80d67813eaa11b6da2e1
5
5
  SHA512:
6
- metadata.gz: 65e4e9893e71009bee1b2ff141e171c7e32756d25d1f5ad5c41d9bf8b7c27314f6838087f40e241f9896a1a18b042558a62a530773e2a3fd4990dbade62ef889
7
- data.tar.gz: b89dc82503559f34c79036b3cd5f3b23f2835029f70e52b6078f0830d5ba3d2024191bad900b8b72d1f397d8bca261f9cb9e83b5e7a339ab81dd0ef538d5a1e0
6
+ metadata.gz: 82920e7bd3cbfd68c5905bb5a0afc0742d7def4d68dadae140e8874a12318cc6b91182ab8248d666b465372c7b5acea764fbcf3d7d2ec8818ce39cf7e5567473
7
+ data.tar.gz: 5bbc86b044613a5d5d5e63e99fecf6e8557fefb2369b8c9ac36a9aca557cbb093af7caad0d0ef951a5ac6cad7b91c83708ea3ee9045e838a795f6cdf40dd7990
data/README.md CHANGED
@@ -21,10 +21,8 @@ gem install inplay_ai
21
21
  ```ruby
22
22
  require 'inplay_ai'
23
23
 
24
- client = InplayAi::Client.new(
25
- api_key: 'your-api-key',
26
- api_url: 'https://api.inplay.ai' # or your API base URL
27
- )
24
+ # Use the singleton client for efficient connection reuse
25
+ client = InplayAi::Client.instance
28
26
 
29
27
  # Send a wager event
30
28
  client.wager({
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InplayAi
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/inplay_ai.rb CHANGED
@@ -3,14 +3,11 @@
3
3
  require_relative "inplay_ai/version"
4
4
  require "http"
5
5
  require "json"
6
- require "singleton"
7
6
 
8
7
  module InplayAi
9
8
  class Error < StandardError; end
10
9
 
11
10
  class Client
12
- include Singleton
13
-
14
11
  DEFAULT_API_URL = "https://api.inplay.ai"
15
12
 
16
13
  def initialize(api_key: nil, api_url: nil)
@@ -48,6 +45,11 @@ module InplayAi
48
45
  post("/v1/metadata/event", data)
49
46
  end
50
47
 
48
+ # Thread-safe per-thread singleton instance
49
+ def self.instance
50
+ Thread.current[:inplay_ai_client] ||= new
51
+ end
52
+
51
53
  private
52
54
 
53
55
  def post(path, data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inplay_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - InPlay AI