class Mole::Transporter

Attributes

transport[R]

Public Class Methods

new(transport) click to toggle source
# File lib/orwell/mole/transporter.rb, line 11
def initialize(transport)
  @transport = lookup(transport)
end

Private Instance Methods

config_hash() click to toggle source
# File lib/orwell/mole/transporter.rb, line 31
def config_hash
  {
    api_token:    Mole.config.api_token,
    api_version:  Mole.config.api_version,
    host:         Mole.config.host,
    port:         Mole.config.port
  }
end
lookup(transport) click to toggle source
# File lib/orwell/mole/transporter.rb, line 17
def lookup(transport)
  transport = case transport
              when :basic_http
                Transport::BasicHttp
              when :sucker_punch
                Transport::SuckerPunch
              when :sidekiq
                Transport::Sidekiq
              else
                raise NotImplementedError
              end
  transport.new(config_hash)
end