Class: Hanko::Client
- Inherits:
-
Object
- Object
- Hanko::Client
- Defined in:
- lib/hanko/client.rb
Overview
Main entry point for interacting with the Hanko API.
A client merges any per-instance options with the global Configuration, then exposes admin and public API namespaces.
Instance Attribute Summary collapse
-
#config ⇒ Configuration
readonly
The resolved configuration for this client.
Instance Method Summary collapse
-
#admin ⇒ Api::AdminNamespace
Returns the admin API namespace for managing users, emails, etc.
-
#initialize(**options) ⇒ Client
constructor
Creates a new Hanko API client.
-
#inspect ⇒ String
Returns a human-readable representation with the API key redacted.
-
#public ⇒ Api::PublicNamespace
Returns the public API namespace for flows, well-known endpoints, etc.
Constructor Details
#initialize(**options) ⇒ Client
Creates a new Hanko API client.
Options override values from the global Hanko.configuration.
32 33 34 35 36 37 |
# File 'lib/hanko/client.rb', line 32 def initialize(**) @adapter = .delete(:adapter) @config = build_config() validate_config! @connection = Connection.new(@config, adapter: @adapter) end |
Instance Attribute Details
#config ⇒ Configuration (readonly)
Returns the resolved configuration for this client.
18 19 20 |
# File 'lib/hanko/client.rb', line 18 def config @config end |
Instance Method Details
#admin ⇒ Api::AdminNamespace
Returns the admin API namespace for managing users, emails, etc.
42 43 44 |
# File 'lib/hanko/client.rb', line 42 def admin @admin ||= Api::AdminNamespace.new(@connection) end |
#inspect ⇒ String
Returns a human-readable representation with the API key redacted.
56 57 58 |
# File 'lib/hanko/client.rb', line 56 def inspect "#<#{self.class} api_url=#{config.api_url.inspect} api_key=[REDACTED]>" end |
#public ⇒ Api::PublicNamespace
Returns the public API namespace for flows, well-known endpoints, etc.
49 50 51 |
# File 'lib/hanko/client.rb', line 49 def public @public ||= Api::PublicNamespace.new(@connection) end |