post https://api.keeptruckin.com/v1/fuel_purchases
Create a fuel purchase
require 'uri'
require 'net/http'
require 'json'
url = URI('https://api.keeptruckin.com/v1/fuel_purchases')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
:vehicle_id => 1,
:driver_id => 2,
:purchased_at => '2019-04-23',
:jurisdiction => 'AL',
:fuel_type => 'diesel',
:fuel => 12,
:fuel_unit => 'gal'
}
request.body = params.to_json
response = http.request(request)
puts response.read_body