github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mikeric / dopplr

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 7
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (1)
  • Wiki (2)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • next
  • Tags (1)
    • authsub
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A Ruby library for talking to the Dopplr API — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Changed request methods to use post as directed by the API docs. 
mikeric (author)
Wed Nov 11 09:56:36 -0800 2009
commit  918a101c9e55dcefaab01d1bf5b6605f9524ee70
tree    ef00f7a92ba7e49d6ce35ad74e73f432708dc670
parent  fbe653297666e7c489d85815b0617bc87db2ca62
dopplr /
name age
history
message
file .gitignore Wed Jul 29 12:28:10 -0700 2009 Changed attributes for city object. [mikeric]
file README.md Sun Aug 09 12:25:02 -0700 2009 Added Dopplr::City#add_trip method to add trips... [mikeric]
file dopplr.gemspec Sun Aug 09 12:25:02 -0700 2009 Added Dopplr::City#add_trip method to add trips... [mikeric]
directory lib/ Thu Nov 12 10:00:51 -0800 2009 Changed request methods to use post as directed... [mikeric]
directory test/ Thu Nov 12 10:00:51 -0800 2009 Changed request methods to use post as directed... [mikeric]
README.md

Dopplr

This library provides objects for talking to some of the data available in Dopplr, The Social Atlas. It is essentially a multi-user wrapping of the Dopplr API, with each object being bound to a client.

Usage

First things first

Require the Dopplr library and create a Dopplr::Client instance. Return a login URL for the user to obtain a token, store the token for that user.

require 'dopplr'

client = Dopplr::Client.new             #=> #<Dopplr::Client:0x578208 ...>
client.login_url "http://www.you.com/"  #=> "https://www.dopplr.com/api/..."

Now that you have a single-use token, assign it to the Dopplr::Client object and generate a session token.

client.token = '1a2b3c4d5e6f'     #=> '1a2b3c4d5e6f'
client.create_session             #=> '3c4d5e6f1a2b'

Instantiating and returning data from objects

All Dopplr objects are created using the client as a base.

mike      = client.traveller      #=> Dopplr::Traveller for the token holder
chicago   = client.city 4887398   #=> Dopplr::City for ID 4887398
montreal  = mike.home_city        #=> Dopplr::City for mike's home city
trip      = mike.trips.first      #=> Dopplr::Trip for mike's first trip

Return some basic information about each object.

montreal.country      #=> "Canada"
montreal.timezone     #=> "America/Montreal"
montreal.localtime    #=> Wed Jul 22 09:30:15 2009

chicago.url           #=> "http://www.dopplr.com/place/us/il/chicago"
chicago.latitude      #=> 41.85
chicago.longitude     #=> -87.6501

mike.name             #=> "Mike Richards"
mike.status           #=> "is at home in Montreal"
mike.travel_today     #=> false

trip.city.name        #=> "Calgary"
trip.start            #=> Sat Feb 16 00:00:00 2008
trip.return_transport #=> "plane"

Get trips and fellows for a particular traveller.

mike.trips            #=> [#<Dopplr::Trip:0x56f4a0 ...>, ...]

mike.fellows          #=> {:can_see_trips_of => [#<Dopplr::Traveller:0x570954 ...>, ...],
                           :shows_trips_to => [#<Dopplr::Traveller:0x59e8b1 ...> ...]}

Return a new Dopplr::City object without knowing the geoname_id (I'm feeling lucky).

portland = client.find_city "Portland"

portland.country      #=> "United States"
portland.geoname_id   #=> 5746545

Working with and creating new trip data

Plan a new trip to Portland, OR.

portland.add_trip('2010-01-12', '2010-01-19')
portland_trip = mike.future_trips.last

portland_trip.start           #=> Tue Jan 12 00:00:00 2010
portland_trip.city.latitude   #=> 45.5235

Add some tags and a note to your trip.

portland_trip.add_tags :work, :meetup
portland_trip.add_note "Staying for a week, then heading back home."

Trip got canceled? Delete it.

portland_trip.delete
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server