Class: API

Inherits:
Object
  • Object
show all
Defined in:
lib/api.rb

Constant Summary collapse

@@token =
Store.load_config["api"]

Class Method Summary collapse

Class Method Details

.add_road(params) ⇒ Object



37
38
39
40
# File 'lib/api.rb', line 37

def self.add_road(params)
  url = "https://api.interstateapp.com/v1/road/new.json?oauth_token=#{@@token}"
  return JSON.parse(Nestful.post url, :params => params)["response"]
end

.road(_id) ⇒ Object



18
19
20
21
# File 'lib/api.rb', line 18

def self.road(_id)
  url = "https://api.interstateapp.com/v1/road/#{_id}.json?oauth_token=#{@@token}"
  return (Nestful.json_get url)["response"]
end

.roadmapsObject



8
9
10
11
# File 'lib/api.rb', line 8

def self.roadmaps()
   url = "https://api.interstateapp.com/v1/roadmap/listAll.json?oauth_token=#{@@token}"
   return (Nestful.json_get url)["response"]
end

.roads(_id) ⇒ Object



13
14
15
16
# File 'lib/api.rb', line 13

def self.roads(_id)
  url = "https://api.interstateapp.com/v1/roadmap/roads/id/#{_id}.json?oauth_token=#{@@token}"
  return (Nestful.json_get url)["response"]
end

.staff(_id) ⇒ Object



32
33
34
35
# File 'lib/api.rb', line 32

def self.staff(_id)
  url = "https://api.interstateapp.com/v1/roadmap/staff/id/#{_id}.json?oauth_token=#{@@token}"
  return (Nestful.json_get url)["response"]
end

.update_road(_id, message, status) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/api.rb', line 23

def self.update_road(_id, message, status)
  params = { "update" => "#{message}" }
  if status != nil
    params["status"] = status
  end
  url = "https://api.interstateapp.com/v1/road/update/id/#{_id}.json?oauth_token=#{@@token}"
  return JSON.parse(Nestful.post url, :params => params)["response"]
end