Class: Fern::Api::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/fern/api/endpoint.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller, name:, &block) ⇒ Endpoint

Returns a new instance of Endpoint.



4
5
6
7
8
9
# File 'lib/fern/api/endpoint.rb', line 4

def initialize(controller, name:, &block)
  @controller = controller
  @name = name

  instance_eval(&block)
end

Instance Method Details

#request(&block) ⇒ Object



11
12
13
# File 'lib/fern/api/endpoint.rb', line 11

def request(&block)
  @controller.send(:define_method, @name, &block)
end