Class: SeatLayer::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/seatlayer.rb

Overview

The SeatLayer client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret_key, base_url: HTTPClient::DEFAULT_BASE_URL, max_retries: HTTPClient::DEFAULT_MAX_RETRIES, timeout: HTTPClient::DEFAULT_TIMEOUT, transport: nil) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/seatlayer.rb', line 23

def initialize(secret_key, base_url: HTTPClient::DEFAULT_BASE_URL,
               max_retries: HTTPClient::DEFAULT_MAX_RETRIES,
               timeout: HTTPClient::DEFAULT_TIMEOUT, transport: nil)
  @http = HTTPClient.new(secret_key: secret_key, base_url: base_url,
                         max_retries: max_retries, timeout: timeout, transport: transport)

  @charts = Charts.new(@http)
  @events = Events.new(@http)
  @inventory = Inventory.new(@http)
  @sessions = Sessions.new(@http)
  @webhooks = Webhooks.new(@http)
  @workspaces = Workspaces.new(@http)
end

Instance Attribute Details

#chartsObject (readonly)

Returns the value of attribute charts.



21
22
23
# File 'lib/seatlayer.rb', line 21

def charts
  @charts
end

#eventsObject (readonly)

Returns the value of attribute events.



21
22
23
# File 'lib/seatlayer.rb', line 21

def events
  @events
end

#inventoryObject (readonly)

Returns the value of attribute inventory.



21
22
23
# File 'lib/seatlayer.rb', line 21

def inventory
  @inventory
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



21
22
23
# File 'lib/seatlayer.rb', line 21

def sessions
  @sessions
end

#webhooksObject (readonly)

Returns the value of attribute webhooks.



21
22
23
# File 'lib/seatlayer.rb', line 21

def webhooks
  @webhooks
end

#workspacesObject (readonly)

Returns the value of attribute workspaces.



21
22
23
# File 'lib/seatlayer.rb', line 21

def workspaces
  @workspaces
end

Instance Method Details

#modeString

Returns "live" or "test", derived from the key prefix.

Returns:

  • (String)

    "live" or "test", derived from the key prefix.



38
39
40
# File 'lib/seatlayer.rb', line 38

def mode
  @http.mode
end

#readyObject

Dependency-aware readiness probe.



43
44
45
# File 'lib/seatlayer.rb', line 43

def ready
  @http.get("/health/ready")
end

#request(method, path, query: nil, body: nil, idempotency_key: nil) ⇒ Object

Escape hatch for surface this SDK does not wrap yet. Carries the same auth, retries, idempotency and error mapping.



49
50
51
# File 'lib/seatlayer.rb', line 49

def request(method, path, query: nil, body: nil, idempotency_key: nil)
  @http.request(method, path, query: query, body: body, idempotency_key: idempotency_key)
end