Class: GeminiApi::Client

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: GeminiApi.config) ⇒ Client

Returns a new instance of Client.



29
30
31
# File 'lib/gemini_api/client.rb', line 29

def initialize(config: GeminiApi.config)
  @config = config
end

Class Method Details

.endpoint(name) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/gemini_api/client.rb', line 14

def self.endpoint(name)
  define_method(name) do |**args|
    klass_name = Hanami::Utils::String.classify(name)
    endpoint_klass = Hanami::Utils::Class.load!("GeminiApi::Endpoints::#{klass_name}")

    endpoint_klass.(config, **args)
  end
end