Class: VmaApi::Client

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: VmaApi.config) ⇒ Client

Returns a new instance of Client.



25
26
27
# File 'lib/vma_api/client.rb', line 25

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

Class Method Details

.endpoint(name) ⇒ Object



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

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

    endpoint_klass.(config, **args)
  end
end