Module: IRail::API

Defined in:
lib/ruby-irail/api.rb,
lib/ruby-irail/packages/nmbs/api.rb,
lib/ruby-irail/packages/mivbstib/api.rb

Defined Under Namespace

Classes: MIVBSTIB, NMBS

Constant Summary collapse

SUPPORTED_APIS =
{
  :nmbs => "NMBS",
  :sncb => "NMBS",
  :stib => "MIVBSTIB",
  :mivb => "MIVBSTIB"
}

Class Method Summary collapse

Class Method Details

.api_name_for_provider(provider) ⇒ Object



15
16
17
# File 'lib/ruby-irail/api.rb', line 15

def self.api_name_for_provider(provider)
  SUPPORTED_APIS[provider]
end

.new(provider = :nmbs) ⇒ Object



10
11
12
13
# File 'lib/ruby-irail/api.rb', line 10

def self.new(provider = :nmbs)
  klass = api_name_for_provider(provider)
  const_get(klass).new
end