Class: Connexionz::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/connexionz/client.rb,
lib/connexionz/client/request.rb,
lib/connexionz/client/connection.rb

Defined Under Namespace

Modules: Connection, Request

Instance Method Summary collapse

Methods included from Request

#get

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
# File 'lib/connexionz/client.rb', line 8

def initialize(options={})
  options = Connexionz.options.merge(options)
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#platform(options = {}) ⇒ Hash

Returns all platform locations (WGS84), Id’s & names.

Examples:

Connexionz.platform

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)


24
25
26
# File 'lib/connexionz/client.rb', line 24

def platform(options={})
   get("rtt/public/utility/file.aspx?contenttype=SQLXML&Name=Platform.xml", options)
end

#platform_group(options = {}) ⇒ Hash

Returns details platform groups where a number of platforms are grouped together under a common name. Use PlatformTag to link to the platform locations in the above.

Examples:

Connexionz.platform_group

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)


34
35
36
# File 'lib/connexionz/client.rb', line 34

def platform_group(options={})
   get("rtt/public/utility/file.aspx?contenttype=SQLXML&Name=PlatformGroup.xml", options)
end

#route_position_et(options = {}) ⇒ Hash

Provide ETA predictions for an individual platform or platform group.Use PlatformTag (internal key to a platform) or PlatformNo (number physically attached to a bus stop which may change from time to time) arguments.

Examples:

Connexionz.route_position_et
Connexionz.route_position_et({:PlatformNo =>"19812"})
Connexionz.route_position_et({:PlatformTag =>"428"})

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

  • options (defaults to: {})

    PlatformNo [String] The number posted on the bus stop

  • options (defaults to: {})

    PlatformTag [String] The ID of the bus stop

Returns:

  • (Hash)


58
59
60
# File 'lib/connexionz/client.rb', line 58

def route_position_et(options={})
   get("rtt/public/utility/file.aspx?contenttype=SQLXML&Name=RoutePositionET.xml", options)
end

#schedule_detail(servicename, options = {}) ⇒ Hash

Returns the schedule detail for the route.

Examples:

Connexionz.schedule_detail("Weekday")
Connexionz.schedule_detail("Weekday", {:id =>"1"})

Parameters:

  • servicename (String)

    Weekday, Saturday, Sunday

  • options (Hash) (defaults to: {})

    A customizable set of options.

  • options (defaults to: {})

    id [String] The ID of the route number

Returns:

  • (Hash)


81
82
83
# File 'lib/connexionz/client.rb', line 81

def schedule_detail(servicename, options={})
   get("rtt/public/utility/file.aspx?contenttype=SQLXML&Name=ScheduleDetail.xml&ServiceName=#{servicename}", options)
end

#schedule_master(options = {}) ⇒ Hash

Returns the master list of schedules

Examples:

Connexionz.schedule_master

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)


68
69
70
# File 'lib/connexionz/client.rb', line 68

def schedule_master(options={})
   get("rtt/public/utility/file.aspx?contenttype=SQLXML&Name=ScheduleMaster.xml", options)
end