Class: WestpacApi::Client

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Client

Returns a new instance of Client.



21
22
23
# File 'lib/westpac_api/client.rb', line 21

def initialize(config:)
  @config = config
end

Class Method Details

.endpoint(name) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/westpac_api/client.rb', line 9

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

    endpoint_klass.(config, **args)
  end
end