October 1st, 2006

Ruby wrapper for Yahoo! Browser-Based Authentication

As you probably know we launched Browser-Based Authentication. What this means is that users can grant third-party web-based applications access to their Yahoo! data. (Actually, this could be used for non web-based apps too.) For a more detailed explanation, go here.

Anyway, I’ll explain how this works using the Ruby interface I just wrote and (sorta) tested:

  • Registering your web application: First off, you need to register your web application. After registration you’ll get your appid and shared secret.
  • Logging-in users:

    obj = YBBAuth.new(appid, secret)
    obj.get_auth_url('')

    Once you get the auth URL, direct the user there. Now the user is informed that your amazing web application is asking for permissions (read, write or both) and whether he wishes to grant permission, etc. Once the user grants permission, Yahoo! will redirect the user to your application (you would’ve submitted the URL when registering for an appid).
  • Getting user credentials: When Yahoo! redirects the user, it adds a token parameter to the URL. You need to extract this token in order to get user credentials:

    obj.get_access_credentials(token)

  • Making an authenticated request: Now you can make authenticated GET/POST requests:

    obj.ws_auth_get_request('http://photos.yahooapis.com/V3.0/listAlbums')

    The above snippet makes use of the Yahoo! Photos API.

» The Ruby wrapper

The interface isn’t complete or well-tested (I have a flight to catch in a few hours so I need to leave in a bit). I’ll work on it in a day or two.

Posted at 10:15 pm | Link | 25 comments | Leave a comment

September 22nd, 2006

YDN Ruby

Alright, long time. Long story for some other day. I have been posting stuff to Flickr, though.

Just wanted to let you guys know that we just went live with the Ruby Developer Center on the Yahoo! Developer Network. If you’ve hacked something in Ruby that makes use of Yahoo!’s web services, let me know. Of course, let me know if you have any feedback.

Official post on the YDN blog.

Tags: , , ,
Posted at 12:53 am | Link | 12 comments | Leave a comment

February 14th, 2006

Yahoo! User Interface Library

Yahoo! just released the Yahoo! User Interface Library, under a BSD license. From the website:

The Yahoo! User Interface Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, HTML and AJAX. The UI Library Utilities facilitate the implementation of rich client-side features by enhancing and normalizing the developer's interface to important elements of the browser infrastructure (such as events, in-page HTTP requests and the DOM). The Yahoo UI Library Controls produce visual, interactive user interface elements on the page with just a few lines of code and an included CSS file. All the components in the Yahoo! User Interface Library have been released as open source under a BSD license and are free for all uses.

A lot of us at Yahoo! have been using them to build cool “toys” (see here for an example). These libraries are amazingly simple to use. Now they are available for all of y’all to use. Do cool stuff!

Basically, the core utilities include the following:

Animation: Create "cinematic effects" on your pages by animating the position, size, opacity or other characteristics of page elements. These effects can be used to reinforce the user's understanding of changes happening on the page.

Connection Manager: This utility library helps manage XMLHttpRequest (commonly referred to as AJAX) transactions in a cross-browser fashion, including integrated support for form posts, error handling and callbacks.

DOM: The DOM Utility is an umbrella object comprising a variety of convenience methods for common DOM-scripting tasks, including element positioning and CSS style management.

Drag and Drop: Create draggable objects that can be picked up and dropped elsewhere on the page. You write code for the "interesting moments" that are triggered at each stage of the interaction (such as when a dragged object crosses over a target); the utility handles all the housekeeping and keeps things working smoothly in all supported browsers.

Event: This sophisticated manager class gives you easy and safe access to browser events (such as clicks and key presses). The Event package also includes the Custom Event object, a mechanism for publishing and subscribing to interesting moments in your own application flow.

In addition to the above core utilities, there’s also a few commonly used controls:

Calendar: The Calendar Control is a graphical, dynamic control used for date selection.

Slider: This control provides a generic slider element that enables the user to choose within a finite range of values on one or two axes.

TreeView: The TreeView control produces a content tree whose nodes can be expanded and contracted by user interaction (and by script, where necessary). The nodes can contain links or custom properties and can be loaded dynamically. The display of the node elements can be customized with CSS to create a folder view, to-do task list, and so on.

There’s also a Design Patterns Library that the UED geeks at Yahoo! have worked on.

There’s an accompanying blog to all this stuff too.

Posted at 08:07 am | Link | 8 comments | Leave a comment