Thank you! Thank you! Thank you! This helped me fix a couple of bugs that I
wouldn't have found until I had all the rest of the container stuff working
(and at my pace that might be weeks).


On Wed, Jul 8, 2009 at 5:42 PM, Chris Chabot <[email protected]> wrote:

> Hey Laura,
>
> It kind of depends on what stage of implementation you're at. Though one
> thing is for sure, the sample container isn't really terribly good way of
> seeing if things work.
>
> If you just started to implement your own classes, so say you have a custom
> PeopleService implementation, but are lacking the rest (iframe's, encrypted
> security tokens etc), then I always prefer to use the opensocial client
> libraries and just code whichever call I want to test. You can find the php
> version here: http://code.google.com/p/opensocial-php-client/
>
> So in this humble beginning, you would use the 'SecurityToken' auth class
> with a matching text string (the format is:
> john.doe:john.doe:appid:cont:url:0:default), of course do replace the
> john.doe with the user id you want to test for, and make sure that
> allow_plaintext_tokens & debug are set to true in your local config.
>
> Then you can create a basic script that does something like:
>
> <?php
>
> // add osapi to include path and require the base file (which pulls in the
> rest of the lib)
> set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/osapi');
> require_once "osapi.php";
>
> // provider, this is an example of manual configuration, oauth end points
> are 'null' (ie: not available), and we define the REST and RPC end points
> // Note: when both RPC and REST is available, it will use the RPC one by
> default ... so to test the REST interface, simply set the RPC var to NULL
> $provider = new osapiProvider(null, null, null, '
> http://local.shindig.url/social/rest', '
> http://local.shindig.url/social/rpc',
> 'my local shindig', true);
>
> // Auth to use, in this case it's a plain text security token, but
> encrypted
> security tokens and 2 and 3 legged OAuth are also supported
> $auth = new
> osapiSecurityToken('john.doe:john.doe:appid:cont:url:0:default');
>
> // And instance the real osapi class using the provider & auth classes
> $osapi = new osapi($provider, $auth);
>
> // Instance a batch object, requests can be batched together, and if RPC is
> used, will be executed in a single call.. if only REST is available, it'll
> do multiple calls, one for each request
>
> // Do something, in this example we're fetching /people/@me/@self
> $batch->add(
>   $osapi->people->get(array('userId'=>'@me', 'groupId'=>'@self')),
>   'selfLabel'
> );
>
> // execute the request:
> $result = $batch->execute();
>
> // print the results to screen
> print_r($result);
>
>
> And once the basic 'getPerson' function works as you want it too, you can
> make it fetch @me/@friends, use params like 'startIndex' => 2, etc etc...
> until it properly does all you want it to.
>
> Once that's done, you can go look at how to construct the iframe and secure
> tokens (encrypted), implement the gadget->container js rpc functions, and
> once that is all done, you can run the 0.8.1 compliance test suite:
>
> http://opensocial-resources.googlecode.com/svn/tests/trunk/suites/0.8/compliance/reference.xmland
> take it from there. (Some errors is to be expected, a great result is
> 120-130 succeeded).
>
> Also at any of these steps, you can look at how Partuza (a demo/example SNS
> implementation that is created just to show how to implement php shindig)
> implemented it: http://code.google.com/p/partuza/ Sometimes having a
> practical example can make all the difference :)
>
> Good luck & I look forward to hearing how things are progressing :)
>
>   -- Chris
>

Reply via email to