Class: Pakyow::Endpoint

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pakyow/endpoints.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, method:, builder:) ⇒ Endpoint

Returns a new instance of Endpoint.



86
87
88
# File 'lib/pakyow/endpoints.rb', line 86

def initialize(name:, method:, builder:)
  @name, @method, @builder = name.to_sym, method.to_sym, builder
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



84
85
86
# File 'lib/pakyow/endpoints.rb', line 84

def builder
  @builder
end

#methodObject (readonly)

Returns the value of attribute method.



84
85
86
# File 'lib/pakyow/endpoints.rb', line 84

def method
  @method
end

#nameObject (readonly)

Returns the value of attribute name.



84
85
86
# File 'lib/pakyow/endpoints.rb', line 84

def name
  @name
end

Instance Method Details

#path(hashlike_object = nil, **params) ⇒ Object



90
91
92
# File 'lib/pakyow/endpoints.rb', line 90

def path(hashlike_object = nil, **params)
  @builder.call(**(hashlike_object || params).to_h)
end