Skip to content

Instantly share code, notes, and snippets.

Testing!
def generate_unique_token
options = { :length => 8, :chars => ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a }
Array.new(options[:length]) { options[:chars].to_a[rand(options[:chars].to_a.size)] }.join
end
// 201 created
{
"id":616,
"url":"http://google.com",
"convert_to":"pdf",
"created_at":"2013-07-08T01:38:12Z",
"status":"queued",
"download_url":"",
"notifications":[]
{
files: [{
id: 131,
url: "http://www.iiswc.org/iiswc2013/sample.doc",
convert_to: "pdf",
created_at: "2013-07-05T22:19:33Z",
status: "processed",
download_url: "https://someurltodownloadat.com",
notifications: [{
id: 109,
{
id: 131,
url: "http://www.iiswc.org/iiswc2013/sample.doc",
convert_to: "pdf",
created_at: "2013-07-05T22:19:33Z",
status: "processed",
download_url: "https://someurltodownloadat.com",
notifications: [{
id: 109,
details: null,
{
id: 8,
created_at: "2013-07-05T22:14:10Z",
credits: 400,
notification_url: "http://localhost:3000",
time_zone: "Eastern Time (US & Canada)",
max_file_size_in_bytes: 1048576
}
// failure notification
{
id: 110,
details: "file is too big",
parsed_time: null,
status: "failed",
time_taken: null,
file_id: 132
}
curl -X "POST" https://fileturn.net/api/conversions.json \
-d api_token=[YOUR API KEY] \
-d type=WordToPdf \
-d url=iiswc.org/iiswc2013/sample.doc
querying deal_types (bit_field) in mysql:
-- avs
SELECT deal_types,
( deal_types & 1048576 ) AS foo,
deals.*
FROM deals
WHERE offer_starts_at > '2012-02-01'
AND ( deal_types & 1048576 ) <> 0
@nisargshah100
nisargshah100 / assessment
Last active August 24, 2017 20:34
Progress Data Examples
// response to client
{
"data": {
"id": "407d80a8-2a82-484b-972f-4ef2744e26c1",
"type": "progress",
"attributes": {
"fields": {},
"data": {
"completed": false