inplay_ai 0.1.3 → 0.1.5

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: be9853f9e6bd71919df765364d8420c1f8ff95d1f06e8fdfb6d05159a1238be0
4
+ data.tar.gz: 397a8ade49768eb4b680f220ae25ea69b6d5b708551f81b7ede3feb479f0c835
5
5
  SHA512:
6
- metadata.gz: 65e4e9893e71009bee1b2ff141e171c7e32756d25d1f5ad5c41d9bf8b7c27314f6838087f40e241f9896a1a18b042558a62a530773e2a3fd4990dbade62ef889
7
- data.tar.gz: b89dc82503559f34c79036b3cd5f3b23f2835029f70e52b6078f0830d5ba3d2024191bad900b8b72d1f397d8bca261f9cb9e83b5e7a339ab81dd0ef538d5a1e0
6
+ metadata.gz: d0649c4f1367deb625b2ce651d854bf801ac9b3e9d29dccc75028d7c643d47d28f6fbaaf8fe3c1781fa8f6633306155df6aef849f3c25f9f206d4c903b50c40f
7
+ data.tar.gz: ab0c5879e783a846c7d4479bc1e1ad532a0cffdbea002a41ab659ea3c1fe5699524d176e1cbe04a597f46a0d932d757976eb94ed361ac000e8ac622dd12b2195
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.5"
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)
@@ -36,8 +33,15 @@ module InplayAi
36
33
  post("/v1/metadata/user", data)
37
34
  end
38
35
 
36
+ # Create or update multiple markets in batch.
37
+ def markets(data)
38
+ post("/v1/metadata/markets", data)
39
+ end
40
+
41
+ # DEPRECATED: Use markets() instead.
39
42
  def market(data)
40
- post("/v1/metadata/market", data)
43
+ warn "market() is deprecated. Use markets() with an array instead."
44
+ post("/v1/metadata/markets", [data])
41
45
  end
42
46
 
43
47
  def target(data)
@@ -48,6 +52,11 @@ module InplayAi
48
52
  post("/v1/metadata/event", data)
49
53
  end
50
54
 
55
+ # Thread-safe per-thread singleton instance
56
+ def self.instance
57
+ Thread.current[:inplay_ai_client] ||= new
58
+ end
59
+
51
60
  private
52
61
 
53
62
  def post(path, data)
metadata CHANGED
@@ -1,13 +1,13 @@
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - InPlay AI
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-24 00:00:00.000000000 Z
10
+ date: 2025-06-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: http