Class: Smplkit::Account::AccountClient
- Inherits:
-
Object
- Object
- Smplkit::Account::AccountClient
- Defined in:
- lib/smplkit/account/client.rb
Overview
The Smpl Account client (sync).
Exposes the authenticated account’s own configuration, reachable as client.account (Smplkit::Client) or constructed directly:
account = Smplkit::AccountClient.new(api_key: "sk_...")
settings = account.settings.get
settings.environment_order = ["production", "staging"]
settings.save
Sub-client: settings (get/save). Pure CRUD — no install required.
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Class Method Summary collapse
-
.open(**kwargs) ⇒ Object
Construct, yield to the block, and close on exit.
Instance Method Summary collapse
-
#close ⇒ Object
No-op — the settings client opens a short-lived HTTP client per call.
-
#initialize(api_key: nil, base_url: nil, profile: nil, base_domain: nil, scheme: nil, debug: nil, extra_headers: nil) ⇒ AccountClient
constructor
A new instance of AccountClient.
Constructor Details
#initialize(api_key: nil, base_url: nil, profile: nil, base_domain: nil, scheme: nil, debug: nil, extra_headers: nil) ⇒ AccountClient
Returns a new instance of AccountClient.
96 97 98 99 100 101 102 103 |
# File 'lib/smplkit/account/client.rb', line 96 def initialize(api_key: nil, base_url: nil, profile: nil, base_domain: nil, scheme: nil, debug: nil, extra_headers: nil) app_url, resolved_key, headers = Account.resolve_account_target( api_key: api_key, base_url: base_url, profile: profile, base_domain: base_domain, scheme: scheme, debug: debug, extra_headers: extra_headers ) @settings = SettingsClient.new(app_url, resolved_key, headers.empty? ? nil : headers) end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
94 95 96 |
# File 'lib/smplkit/account/client.rb', line 94 def settings @settings end |
Class Method Details
.open(**kwargs) ⇒ Object
Construct, yield to the block, and close on exit.
109 110 111 112 113 114 115 116 |
# File 'lib/smplkit/account/client.rb', line 109 def self.open(**kwargs) client = new(**kwargs) begin yield client ensure client.close end end |
Instance Method Details
#close ⇒ Object
No-op — the settings client opens a short-lived HTTP client per call.
106 |
# File 'lib/smplkit/account/client.rb', line 106 def close; end |