Class: Sliver::API
- Inherits:
-
Object
- Object
- Sliver::API
- Defined in:
- lib/sliver/api.rb
Instance Method Summary collapse
- #call(environment) ⇒ Object
- #connect(method, path, action) ⇒ Object
-
#initialize(&block) ⇒ API
constructor
A new instance of API.
- #invoke(endpoint, environment) ⇒ Object
Constructor Details
Instance Method Details
#call(environment) ⇒ Object
10 11 12 13 14 |
# File 'lib/sliver/api.rb', line 10 def call(environment) endpoint = endpoints.find environment endpoint.nil? ? not_found : invoke(endpoint, environment) end |
#connect(method, path, action) ⇒ Object
20 21 22 |
# File 'lib/sliver/api.rb', line 20 def connect(method, path, action) endpoints.append Sliver::Path.new(method, path), action end |
#invoke(endpoint, environment) ⇒ Object
16 17 18 |
# File 'lib/sliver/api.rb', line 16 def invoke(endpoint, environment) endpoint.call environment end |