Class: AnzApi::Client

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: AnzApi.config) ⇒ Client

Returns a new instance of Client.



16
17
18
# File 'lib/anz_api/client.rb', line 16

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

Class Method Details

.endpoint(name) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/anz_api/client.rb', line 5

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

    endpoint_klass.(config, **args)
  end
end