All Projects → excid3 → Fluttrly

excid3 / Fluttrly

Licence: agpl-3.0
An elegantly simple todo list

Programming Languages

ruby
36898 projects - #4 most used programming language

Fluttrly

Fluttrly is a simple to-do list that allows you and others to add to a todo list for all to see!

Usage

At the home screen, just add your name to the text box and you're ready to start adding to a list.

License

Fluttrly is protected under the AGPL license.

Please see LICENSE for more details.

Author

Lovingly created by Chris Oliver.

API

The Fluttrly API is ridiculously simple. Just append ".json" or ".xml" to the end of the list URL that you would like to retrieve.

JSON

Example: GET Request http://fluttrly.com/test.json

Result: [{"task":{"name":"Example","created_at":"2010-12-19T02:58:06Z","completed":false,"updated_at":"2010-12-19T02:58:06Z","id":446,"content":"And you can easily share from the web"}}, {"task":{"name":"Example","created_at":"2010-12-19T02:57:58Z","completed":true,"updated_at":"2010-12-19T02:58:00Z","id":445,"content":"This is a completed task"}}, {"task":{"name":"Example","created_at":"2010-12-19T02:57:37Z","completed":false,"updated_at":"2010-12-19T02:57:51Z","id":443,"content":"Items can be checked as completed"}}, {"task":{"name":"Example","created_at":"2010-12-19T02:57:22Z","completed":false,"updated_at":"2010-12-19T02:57:22Z","id":440,"content":"Type a new task"}}]

XML

Example: GET Request http://fluttrly.com/test.xml

Result: Example 2010-12-19T02:58:06Z false 2010-12-19T02:58:06Z 446 And you can easily share from the web Example 2010-12-19T02:57:58Z true 2010-12-19T02:58:00Z 445 This is a completed task Example 2010-12-19T02:57:37Z false 2010-12-19T02:57:51Z 443 Items can be checked as completed Example 2010-12-19T02:57:22Z false 2010-12-19T02:57:22Z 440 Type a new task

POST

Posting a new task is easy too! Request a normal page to retrieve the authenticity_token, then you can submit the name of the list the task is for as well as the content of the task.

Example (Python):

#!/usr/bin/env python
# This example assumes you have a copy of Fluttr running on localhost:3000

import cookielib
import re
import urllib, urllib2

# Build the URL opener that saves cookies
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

# Request the test page so that we can get the auth token
f = opener.open("http://localhost:3000/test")
data = f.read()

# Parse out the auth token
auth_token = re.search(r'name="authenticity_token".*value="(.+)"', data).group(1)

# Setup the POST request and encode it
data = {"authenticity_token": auth_token,
        "task[name]": "test",
        "task[content]": "This is a test",
        }
data = urllib.urlencode(data)

# POST!
f = opener.open("http://localhost:3000/tasks.js", data)

# You're done! Now visiting /test will have your new task!

Example (Ruby):

require 'net/http'
require 'uri'

# Initialize our session
url = URI.parse("http://localhost:3000/test")
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }

# Parse out the auth token and get the session cookie
auth_token = $1 if res.body =~ /"authenticity_token".*value="(.+)"/ or nil
cookie = res['set-cookie'].split("; ")[0]

raise "No auth token" if auth_token.nil?

# Setup the params for POST
params = { 
    "task[content]" => "NICE", 
    "task[name]" => "test", 
    "authenticity_token" => auth_token
}

# Create a POST request
url = URI.parse("http://localhost:3000/tasks.js")
req = Net::HTTP::Post.new(url.path)

# Setup parameters
req.add_field("Cookie", cookie)
req.set_form_data(params)

# POST!
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].