Packagecom.yahoo.social.methodgroups
Classpublic class YQL
InheritanceYQL Inheritance YOSMethodBase Inheritance flash.events.EventDispatcher

Wraps the Yahoo! YQL web service. Response objects are JSON decoded containing the search results.


Example
  
   var session:YahooSession = new YahooSession('$consumerKey','$consumerSecret');
   session.yql.addEventListener(YahooResultEvent.YQL_QUERY_SUCCESS, handleQuerySuccess);
   session.yql.query("select from geo.places where text='YVR'");
  
   function handleQuerySuccess(event:YahooResultEvent):void
   {
       // get the query result
    var results:Object = event.data.results;
    // and then do something awesome
   }
  

   // provide access tokens to get the sessioned user in order to access their profile information
  
   var session:YahooSession = new YahooSession('$consumerKey','$consumerSecret','$accessToken','$accessTokenSecret');
   
   var user:YahooUser = session.getSessionedUser();
   user.yql.addEventListener(YahooResultEvent.YQL_QUERY_SUCCESS, handleQuerySuccess);
   user.yql.query("select from social.profile where guid=me");
  
     function handleQuerySuccess(event:YahooResultEvent):void
   {
       // get the query result
    var results:Object = event.data.results;
    // and then do something awesome
   }
  

   // Directly create a YQL object and use the queryPublic method to access any public information.
  
   var yql:YQL = new YQL();
   yql.addEventListener(YahooResultEvent.YQL_QUERY_SUCCESS, handleQuerySuccess);
   yql.queryPublic("select from weather.forecast where location=98101");
  
     function handleQuerySuccess(event:YahooResultEvent):void
   {
       // get the query result
    var results:Object = event.data.results;
    // and then do something awesome
   }
  

See also

http://developer.yahoo.com/yql/
http://developer.yahoo.com/yql/console/


Public Properties
 PropertyDefined by
 Inheritedconsumer : OAuthConsumer
An OAuthConsumer object containing consumer key and secret values.
YOSMethodBase
  environmentFile : String
The optional YQL environment file.
YQL
 Inheritedtoken : OAuthToken
An OAuthToken object containing access token key and secret values This value is only used if a user is not defined when signing a request with OAuth.
YOSMethodBase
 Inheriteduser : YahooUser
The user referenced in all data requests.
YOSMethodBase
Protected Properties
 PropertyDefined by
 Inherited$consumer : OAuthConsumer
An OAuthConsumer object containing consumer key and secret values.
YOSMethodBase
 Inherited$format : String = "json"
The response format to apply to all requests.
YOSMethodBase
 Inherited$hostname : String
The hostname to be used in constructing URLs for all requests.
YOSMethodBase
 Inherited$oauthRequestType : String
The name of the OAuth request type used for all requests in this class.
YOSMethodBase
 Inherited$token : OAuthToken
An OAuthToken object containing access token key and secret values.
YOSMethodBase
 Inherited$useExplicitEncoding : Boolean = true
Determines if the request parameters in the signature base string should be encoded using encodeURIComponent when signing the request.
YOSMethodBase
 Inherited$user : YahooUser
The YahooUser to reference in all requests.
YOSMethodBase
 Inherited$version : String = "v1"
The version of the API.
YOSMethodBase
 InheritedOAUTH_HOSTNAME : String = "api.login.yahoo.com"
[static] The hostname for the Yahoo login service (OAuth) API.
YOSMethodBase
 InheritedOAUTH_REALM : String = "yahooapis.com"
[static] The name of the OAuth realm for Yahoo! web-services.
YOSMethodBase
Public Methods
 MethodDefined by
  
YQL()
Class constructor.
YQL
  
query(query:String):void
Sends a single query to the YQL web service.
YQL
Protected Methods
 MethodDefined by
 Inherited
decodeJSON(s:String):*
A simple wrapper of the JSON::decode function.
YOSMethodBase
 Inherited
encodeJSON(o:Object):String
A simple wrapper of the JSON::encode function.
YOSMethodBase
 Inherited
Returns an object containing the required or default request parameters.
YOSMethodBase
 Inherited
getResponseStatusOk(status:int):Boolean
Returns true if the status code is 200.
YOSMethodBase
 Inherited
handleSecurityError(response:Object):void
Dispatches a SECURITY_ERROR event.
YOSMethodBase
 Inherited
sendRequest(httpMethod:String, url:String, callback:Object, args:Object = null, headers:Array = null):void
Signs the request with OAuth credentials then sends the request to the web-service with the supplied callbacks.
YOSMethodBase
Events
 EventSummaryDefined by
 Inherited Dispatched when a request fails due to a security error.YOSMethodBase
   Dispatched when the query request fails.YQL
   Dispatched when the query request executes successfully.YQL
Protected Constants
 ConstantDefined by
 InheritedAPPSTORE_WS_HOSTNAME : String = "appstore.apps.yahooapis.com"
[static] The hostname for the Yahoo Application Platform data store.
YOSMethodBase
 InheritedSOCIAL_WS_HOSTNAME : String = "social.yahooapis.com"
[static] The hostname for Yahoo Social APIs.
YOSMethodBase
 InheritedYQL_HOSTNAME : String = "query.yahooapis.com"
[static] The hostname for the YQL API.
YOSMethodBase
Property detail
environmentFileproperty
environmentFile:String  [read-write]

The optional YQL environment file.

Implementation
    public function get environmentFile():String
    public function set environmentFile(value:String):void
Constructor detail
YQL()constructor
public function YQL()

Class constructor. Creates a new YQL object.

Method detail
query()method
public function query(query:String):void

Sends a single query to the YQL web service.

Parameters
query:String — A string, using a SQL-like SELECT syntax.
Event detail
yqlQueryFailureevent 
Event object type: YahooResultEvent

Dispatched when the query request fails.

yqlQuerySuccessevent  
Event object type: YahooResultEvent

Dispatched when the query request executes successfully.