class Gdsapi::Client
Attributes
Public Class Methods
@param [Gdsapi::Requester] requester - requester instance It is `strongly recommended` to use Faraday(see ##with_faraday_requester)
# File lib/gdsapi/client.rb, line 8 def initialize(requester) @requester = requester end
Constructing routine that uses Faraday as driver @param base_url: url param for Faraday(requred) @param login: & password: - HTTP basic auth factors @param language: - language slug for which request will be performed (available are: en, ru, uk, pl, th)
# File lib/gdsapi/client.rb, line 17 def with_faraday_requester(base_url: nil, login: nil, password: nil, language: nil) driver = Faraday.new(url: base_url) new(Requester.new(driver, login: login, password: password, language: language)) end
Constructing routine that uses given driver @param driver - driver instance @param login: & password: - HTTP basic auth factors @param language: - language slug for which request will be performed (available are: en, ru, uk, pl, th)
# File lib/gdsapi/client.rb, line 26 def with_requester(driver, login: nil, password: nil, language: nil, prefix: '/api/v2/') new(Requester.new(driver, login: login, password: password, language: language, prefix: prefix)) end
Public Instance Methods
GDS Method used to check availability of trips For more information, see [demo.gillbus.com/v2/doc.html#поиск-рейсов-доступность-рейсов-get] @param args - keyword args:
:arrival [String] - GDS arrival point id (required) :departure [String] - GDS departure point id (required) :tickets [Number] - number of tickets for trip (required) :mode [Number] - transport type (optional, buses are: 1,8) :dates [String] - dates for trip (required, format: yyyy-mm-dd, delimiter: ';') :return_only_branded [Boolean] - returns data only for branded trips if true
# File lib/gdsapi/client.rb, line 79 def get_available_trips(**args) Methods::GetAvailableTrips.new(requester).call(**args) end
GDS Method used to fetch GDS countries For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-страны-get] @param args - keyword args:
:offset [Number|String] - number of records to be skipped when fetching chunks (optional) :limit [Number|String] - number of records to be fetched when fetching chunks (optional)
# File lib/gdsapi/client.rb, line 66 def get_countries(**args) Methods::GetCountries.new(requester).call(**args) end
GDS Method used to fetch GDS locations For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get] @param args - keyword args:
:country [Number|String] - GDS country id for which locations are fetched (optional) :offset [Number|String] - number of records to be skipped when fetching chunks (optional) :limit [Number|String] - number of records to be fetched when fetching chunks (optional) :timestamp [String] - temporal checkpoint(i.e. date, records from which are interested) (optional, format: yyyy-MM-dd’T’HH:mm:ssZ, GMT+2)
# File lib/gdsapi/client.rb, line 44 def get_locations(**args) Methods::GetLocations.new(requester).call(**args) end
GDS Method used to fetch GDS points For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get] @param args - keyword args:
:country [Number|String] - GDS country id for which points are fetched (optional) :location [Number|String] - GDS location id for which points are fetched (optional) :offset [Number|String] - number of records to be skipped when fetching chunks (optional) :limit [Number|String] - number of records to be fetched when fetching chunks (optional) :timestamp [String] - temporal checkpoint(i.e. date, records from which are interested) (optional, format: yyyy-MM-dd’T’HH:mm:ssZ, GMT+2)
# File lib/gdsapi/client.rb, line 57 def get_points(**args) Methods::GetPoints.new(requester).call(**args) end
Ad-hoc solution for adding multilanguage support
# File lib/gdsapi/client.rb, line 32 def language=(value) requester.language = value end