Class: FabApi::Client

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: FabApi.config) ⇒ Client

Returns a new instance of Client.



28
29
30
# File 'lib/fab_api/client.rb', line 28

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

Class Method Details

.endpoint(name) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/fab_api/client.rb', line 12

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

    endpoint_klass.(config, **args)
  end
end