Place an Order
Replace ACCESS_TOKEN by your access_token obtained from authorization
require "uri"
require "net/http"
url = URI("https://<<api_base_path>>/orders")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <<access_token>>"
request["Content-Type"] = "application/json"
payload = {
vehicle_type: "<<default_vehicle_type>>",
payment_method: "<<default_payment_method>>",
pickup: {
schedule_at: Time.now.to_i,
location: {
lat: <<pickup_lat>>,
lng: <<pickup_lng>>,
},
contact: {
name: "<<user_name>>",
phone_number: "<<user_phone_number>>"
}
},
destinations:[ {
location: {
lat: <<dropoff_lat>>,
lng: <<dropoff_lng>>,
}
}
]
}
request.body = JSON.generate(payload)
response = https.request(request)
response_payload = JSON.parse(response.read_body)
pp response_payload
Updated over 1 year ago