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.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/seatlayer.rb', line 26

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)
  @channels = Channels.new(@http)
  @performance_groups = PerformanceGroups.new(@http)
  @sessions = Sessions.new(@http)
  @templates = Templates.new(@http)
  @webhooks = Webhooks.new(@http)
  @workspaces = Workspaces.new(@http)
end

Instance Attribute Details

#channelsObject (readonly)

Returns the value of attribute channels.



23
24
25
# File 'lib/seatlayer.rb', line 23

def channels
  @channels
end

#chartsObject (readonly)

Returns the value of attribute charts.



23
24
25
# File 'lib/seatlayer.rb', line 23

def charts
  @charts
end

#eventsObject (readonly)

Returns the value of attribute events.



23
24
25
# File 'lib/seatlayer.rb', line 23

def events
  @events
end

#inventoryObject (readonly)

Returns the value of attribute inventory.



23
24
25
# File 'lib/seatlayer.rb', line 23

def inventory
  @inventory
end

#performance_groupsObject (readonly)

Returns the value of attribute performance_groups.



23
24
25
# File 'lib/seatlayer.rb', line 23

def performance_groups
  @performance_groups
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



23
24
25
# File 'lib/seatlayer.rb', line 23

def sessions
  @sessions
end

#templatesObject (readonly)

Returns the value of attribute templates.



23
24
25
# File 'lib/seatlayer.rb', line 23

def templates
  @templates
end

#webhooksObject (readonly)

Returns the value of attribute webhooks.



23
24
25
# File 'lib/seatlayer.rb', line 23

def webhooks
  @webhooks
end

#workspacesObject (readonly)

Returns the value of attribute workspaces.



23
24
25
# File 'lib/seatlayer.rb', line 23

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.



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

def mode
  @http.mode
end

#readyObject

Dependency-aware readiness probe.



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

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

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

Escape hatch for surface this SDK does not wrap yet. Reads retain retries; raw mutations are single-attempt because their replay contract is unknown.



55
56
57
58
59
# File 'lib/seatlayer.rb', line 55

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