module Bmtc
Constants
- SERVICE_TYPES
- VERSION
Public Class Methods
post_request(path, options)
click to toggle source
# File lib/bmtc.rb, line 18 def self.post_request(path, options) Bmtc.post(path, body: options.to_json, headers: { 'Content-Type' => 'application/json' }).body end
route_details(route_no, direction = 'UP')
click to toggle source
# File lib/bmtc.rb, line 22 def self.route_details(route_no, direction = 'UP') options = { 'direction' => direction, 'routeNO' => route_no } Bmtc.post_request('/itsroutewise/details', options) end
route_map(route_no, direction = 'UP')
click to toggle source
# File lib/bmtc.rb, line 30 def self.route_map(route_no, direction = 'UP') options = { 'direction' => direction, 'routeNO' => route_no } Bmtc.post_request('/routemap/details', options) end
trip_fare(_input_options = {})
click to toggle source
# File lib/bmtc.rb, line 38 def self.trip_fare(_input_options = {}) service_type = SERVICE_TYPES[_input_options[:service_type]] || _input_options[:service_type] || '1' source = _input_options[:source] destination = _input_options[:destination] no_adults = (_input_options[:no_adults].to_s || 1).to_s options = { 'adults' => no_adults, 'destination' => destination, 'serviceType' => service_type, 'source' => source } JSON.parse Bmtc.post_request('/tripfare/details', options) end