class Sliver::API
Constants
- NOT_FOUND
Attributes
endpoints[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/sliver/api.rb, line 4 def initialize(&block) @endpoints = Sliver::Endpoints.new block.call self end
Public Instance Methods
call(environment)
click to toggle source
# 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)
click to toggle source
# File lib/sliver/api.rb, line 20 def connect(method, path, action) endpoints.append Sliver::Path.new(method, path), action end
invoke(endpoint, environment)
click to toggle source
# File lib/sliver/api.rb, line 16 def invoke(endpoint, environment) endpoint.call environment end