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 +4 -4
- data/README.md +2 -4
- data/lib/inplay_ai/version.rb +1 -1
- data/lib/inplay_ai.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf671763a4145a3c948adc274b6fc241e0b0290dd592f6eb48af443823ac837
|
4
|
+
data.tar.gz: b355cb0e5e9179ef7e7ea84dc80effec8179e1a8f76e80d67813eaa11b6da2e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
25
|
-
|
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({
|
data/lib/inplay_ai/version.rb
CHANGED
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)
|