Class: GoTransit::ServiceUpdate

Inherits:
ApiResource show all
Includes:
Enumerable
Defined in:
lib/go_transit/resources/service_update.rb

Defined Under Namespace

Classes: Exceptions, Message, ServiceGuarantee, UnionDepartures

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiResource

#initialize

Constructor Details

This class inherits a constructor from GoTransit::ApiResource

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



5
6
7
# File 'lib/go_transit/resources/service_update.rb', line 5

def messages
  @messages
end

Class Method Details

.information_alertsObject



13
14
15
16
17
# File 'lib/go_transit/resources/service_update.rb', line 13

def self.information_alerts
  client = Client.new
  response = client.get("ServiceUpdate/InformationAlert/All")
  new(response.data)
end

.marketing_alertsObject



19
20
21
22
23
# File 'lib/go_transit/resources/service_update.rb', line 19

def self.marketing_alerts
  client = Client.new
  response = client.get("ServiceUpdate/MarketingAlert/All")
  new(response.data)
end

.service_alertsObject



7
8
9
10
11
# File 'lib/go_transit/resources/service_update.rb', line 7

def self.service_alerts
  client = Client.new
  response = client.get("ServiceUpdate/ServiceAlert/All")
  new(response.data)
end

.service_guarantee(trip_number:, operational_day:) ⇒ Object



31
32
33
34
35
# File 'lib/go_transit/resources/service_update.rb', line 31

def self.service_guarantee(trip_number:, operational_day:)
  client = Client.new
  response = client.get("ServiceUpdate/ServiceGuarantee/#{trip_number}/#{operational_day}")
  ServiceUpdate::ServiceGuarantee.new(response.data)
end

.union_departuresObject



25
26
27
28
29
# File 'lib/go_transit/resources/service_update.rb', line 25

def self.union_departures
  client = Client.new
  response = client.get("ServiceUpdate/UnionDepartures/All")
  ServiceUpdate::UnionDepartures.new(response.data)
end

Instance Method Details

#each(&block) ⇒ Object



37
38
39
# File 'lib/go_transit/resources/service_update.rb', line 37

def each(&block)
  messages.each(&block)
end