Class: Gdsapi::Client
- Inherits:
-
Object
- Object
- Gdsapi::Client
- Defined in:
- lib/gdsapi/client.rb
Instance Attribute Summary collapse
-
#requester ⇒ Object
readonly
Returns the value of attribute requester.
Class Method Summary collapse
-
.with_faraday_requester(base_url: nil, login: nil, password: nil, language: nil) ⇒ Object
Constructing routine that uses Faraday as driver.
-
.with_requester(driver, login: nil, password: nil, language: nil, prefix: '/api/v2/') ⇒ Object
Constructing routine that uses given driver.
Instance Method Summary collapse
-
#get_available_trips(**args) ⇒ Object
GDS Method used to check availability of trips For more information, see [demo.gillbus.com/v2/doc.html#поиск-рейсов-доступность-рейсов-get].
-
#get_countries(**args) ⇒ Object
GDS Method used to fetch GDS countries For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-страны-get].
-
#get_locations(**args) ⇒ Object
GDS Method used to fetch GDS locations For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get].
-
#get_points(**args) ⇒ Object
GDS Method used to fetch GDS points For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get].
-
#initialize(requester) ⇒ Client
constructor
It is ‘strongly recommended` to use Faraday(see ##with_faraday_requester).
-
#language=(value) ⇒ Object
Ad-hoc solution for adding multilanguage support.
Constructor Details
#initialize(requester) ⇒ Client
It is ‘strongly recommended` to use Faraday(see ##with_faraday_requester)
8 9 10 |
# File 'lib/gdsapi/client.rb', line 8 def initialize(requester) @requester = requester end |
Instance Attribute Details
#requester ⇒ Object (readonly)
Returns the value of attribute requester.
4 5 6 |
# File 'lib/gdsapi/client.rb', line 4 def requester @requester end |
Class Method Details
.with_faraday_requester(base_url: nil, login: nil, password: nil, language: nil) ⇒ Object
Constructing routine that uses Faraday as driver
17 18 19 20 |
# 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 |
.with_requester(driver, login: nil, password: nil, language: nil, prefix: '/api/v2/') ⇒ Object
Constructing routine that uses given driver
26 27 28 |
# 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 |
Instance Method Details
#get_available_trips(**args) ⇒ Object
GDS Method used to check availability of trips For more information, see [demo.gillbus.com/v2/doc.html#поиск-рейсов-доступность-рейсов-get]
79 80 81 |
# File 'lib/gdsapi/client.rb', line 79 def get_available_trips(**args) Methods::GetAvailableTrips.new(requester).call(**args) end |
#get_countries(**args) ⇒ Object
GDS Method used to fetch GDS countries For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-страны-get]
66 67 68 |
# File 'lib/gdsapi/client.rb', line 66 def get_countries(**args) Methods::GetCountries.new(requester).call(**args) end |
#get_locations(**args) ⇒ Object
GDS Method used to fetch GDS locations For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get]
44 45 46 |
# File 'lib/gdsapi/client.rb', line 44 def get_locations(**args) Methods::GetLocations.new(requester).call(**args) end |
#get_points(**args) ⇒ Object
GDS Method used to fetch GDS points For more information, see [demo.gillbus.com/v2/doc.html#получение-географии-получение-списка-остановок-get]
57 58 59 |
# File 'lib/gdsapi/client.rb', line 57 def get_points(**args) Methods::GetPoints.new(requester).call(**args) end |
#language=(value) ⇒ Object
Ad-hoc solution for adding multilanguage support
32 33 34 |
# File 'lib/gdsapi/client.rb', line 32 def language=(value) requester.language = value end |