Class: Typekit::Connection::Dispatcher
- Inherits:
-
Object
- Object
- Typekit::Connection::Dispatcher
- Defined in:
- lib/typekit/connection/dispatcher.rb
Instance Method Summary collapse
- #deliver(request) ⇒ Object
-
#initialize(adaptor: :standard, token:) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(adaptor: :standard, token:) ⇒ Dispatcher
Returns a new instance of Dispatcher.
4 5 6 7 |
# File 'lib/typekit/connection/dispatcher.rb', line 4 def initialize(adaptor: :standard, token:) @token = token @adaptor = Adaptor.build(adaptor) end |
Instance Method Details
#deliver(request) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/typekit/connection/dispatcher.rb', line 9 def deliver(request) method = Helper.translate_action(request.action) code, _, body = @adaptor.process(method, request.address, request.parameters, 'X-Typekit-Token' => @token) Response.new(code: code.to_i, content: body) end |