class Nummerplade::ApiClient

Attributes

api_token[RW]

Public Class Methods

new(api_token) click to toggle source
# File lib/nummerplade.rb, line 9
def initialize api_token
  @api_token = api_token
  @url = 'http://api.nrpla.de/'
end

Public Instance Methods

debt(vehicle_id) click to toggle source
# File lib/nummerplade.rb, line 26
def debt vehicle_id
  request("debt/" + vehicle_id)
end
dmr(vehicle_id) click to toggle source
# File lib/nummerplade.rb, line 22
def dmr vehicle_id
  request("dmr/" + vehicle_id)
end
inspections(vehicle_id) click to toggle source
# File lib/nummerplade.rb, line 30
def inspections vehicle_id
  request("inspections/" + vehicle_id)
end
vehicle_by_registration(registration) click to toggle source
# File lib/nummerplade.rb, line 14
def vehicle_by_registration registration
  request(registration)
end
vehicle_by_vin(vin) click to toggle source
# File lib/nummerplade.rb, line 18
def vehicle_by_vin vin
  request("vin/" + vin)
end

Private Instance Methods

request(endpoint) click to toggle source
# File lib/nummerplade.rb, line 36
def request endpoint
  res = open(@url + endpoint + "?api_token=#{@api_token}&advanced=true")
  JSON.parse(res.read)
end