Class: NationalRailWrapper::Feeds::KnowledgeBase::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/national_rail_wrapper/feeds/knowledge_base/client.rb

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from NationalRailWrapper::Client

Instance Method Details

#incidents(parse_result: true) ⇒ Object



6
7
8
9
10
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 6

def incidents(parse_result: true)
  request = KnowledgeBase::Requests::Incidents.new.run(auth_token)

  parse_result ? Ox.parse(request.response_body).to_json : request.response_body
end

#national_service_indicators(parse_result: true) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 12

def national_service_indicators(parse_result: true)
  request = KnowledgeBase::Requests::NationalServiceIndicators.new.run(auth_token).response_body

  if parse_result
    KnowledgeBase::Parsers::NationalServiceIndicators.new(request).to_json
  else
    request.response_body
  end
end

#public_promotions(parse_result: true) ⇒ Object



22
23
24
25
26
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 22

def public_promotions(parse_result: true)
  request = KnowledgeBase::Requests::PublicPromotions.new.run(auth_token)

  parse_result ? response.to_json : request.response_body
end

#stations(parse_result: true) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 28

def stations(parse_result: true)
  request = KnowledgeBase::Requests::Stations.new.run(auth_token).response_body

  if parse_result
    KnowledgeBase::Parsers::Stations.new(request).to_json
  else
    request.response_body
  end
end

#ticket_restrictions(parse_result: true) ⇒ Object



38
39
40
41
42
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 38

def ticket_restrictions(parse_result: true)
  request = KnowledgeBase::Requests::TicketRestrictions.new.run(auth_token)

  parse_result ? Ox.parse(request.response_body).to_json : request.response_body
end

#ticket_types(parse_result: true) ⇒ Object



44
45
46
47
48
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 44

def ticket_types(parse_result: true)
  request = KnowledgeBase::Requests::TicketTypes.new.run(auth_token)

  parse_result ? Ox.parse(request.response_body).to_json : request.response_body
end

#tocs(parse_result: true) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/national_rail_wrapper/feeds/knowledge_base/client.rb', line 50

def tocs(parse_result: true)
  request = KnowledgeBase::Requests::Tocs.new.run(auth_token).response_body

  if parse_result
    KnowledgeBase::Parsers::Tocs.new(request).to_json
  else
    request.response_body
  end
end