Class: Pakyow::Endpoint
- Inherits:
-
Object
- Object
- Pakyow::Endpoint
- Extended by:
- Forwardable
- Defined in:
- lib/pakyow/endpoints.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name:, method:, builder:) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #path(hashlike_object = nil, **params) ⇒ Object
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
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
84 85 86 |
# File 'lib/pakyow/endpoints.rb', line 84 def builder @builder end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
84 85 86 |
# File 'lib/pakyow/endpoints.rb', line 84 def method @method end |
#name ⇒ Object (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 |