Class: StabilitySDK::DashboardClient
- Inherits:
-
Object
- Object
- StabilitySDK::DashboardClient
- Defined in:
- lib/stability_sdk/dashboard_client.rb
Constant Summary collapse
- DEFAULT_API_HOST =
"grpc.stability.ai:443"
Instance Method Summary collapse
- #get_me ⇒ Object
- #get_organization ⇒ Object
-
#initialize(options = {}) ⇒ DashboardClient
constructor
A new instance of DashboardClient.
Constructor Details
#initialize(options = {}) ⇒ DashboardClient
Returns a new instance of DashboardClient.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/stability_sdk/dashboard_client.rb', line 8 def initialize(={}) host = [:api_host] || DEFAULT_API_HOST channel_creds = .has_key?(:ca_cert) ? GRPC::Core::ChannelCredentials.new([:ca_cert]) : GRPC::Core::ChannelCredentials.new call_creds = GRPC::Core::CallCredentials.new(proc { { "authorization" => "Bearer #{[:api_key]}" } }) creds = channel_creds.compose(call_creds) stub_params = {} [:channel_override, :timeout, :propagate_mask, :channel_args, :interceptors].each do |kw| stub_params[kw] = [kw] if .has_key?(kw) end @stub = Gooseai::DashboardService::Stub.new(host, creds, **stub_params) end |
Instance Method Details
#get_me ⇒ Object
22 23 24 |
# File 'lib/stability_sdk/dashboard_client.rb', line 22 def get_me @stub.get_me(Gooseai::EmptyRequest.new) end |
#get_organization ⇒ Object
26 27 28 29 |
# File 'lib/stability_sdk/dashboard_client.rb', line 26 def get_organization me = self.get_me @stub.get_organization(Gooseai::GetChargesRequest.new(organization_id: me.organizations[0].organization.id)) end |