module ApbShuttleApi

Constants

VERSION

Public Class Methods

all(limit = nil) click to toggle source
# File lib/apb_shuttle_api.rb, line 18
def self.all(limit = nil)
  get_all({limit: limit})
end
all_apb(limit = nil) click to toggle source
# File lib/apb_shuttle_api.rb, line 22
def self.all_apb(limit = nil)
  get_all({kind: 'apb', limit: limit})
end
all_orange(limit = nil) click to toggle source
# File lib/apb_shuttle_api.rb, line 26
def self.all_orange(limit = nil)
  get_all({kind: 'orange', limit: limit})
end
info() click to toggle source
# File lib/apb_shuttle_api.rb, line 30
def self.info
  JSON.load(open("#{@base_url}/info.json"))
end
next(next_num = 1) click to toggle source
# File lib/apb_shuttle_api.rb, line 14
def self.next(next_num = 1)
  JSON.load(open("#{@base_url}/next/#{next_num}.json"))
end
now() click to toggle source
# File lib/apb_shuttle_api.rb, line 10
def self.now
  JSON.load(open("#{@base_url}/now.json"))
end

Private Class Methods

get_all(option = {}) click to toggle source
# File lib/apb_shuttle_api.rb, line 35
def self.get_all(option = {})
  limit = option[:limit]
  limit = nil if limit.to_s.length == 0
  limit = limit.to_s if limit == true || limit == false

  limit = "/#{limit}" if !limit.nil?

  case option[:kind]
  when 'apb'
    JSON.load(open("#{@base_url}/all/apb#{limit}.json"))
  when 'orange'
    JSON.load(open("#{@base_url}/all/orange#{limit}.json"))
  else
    JSON.load(open("#{@base_url}/all#{limit}.json"))
  end
end