Nevermind the bug comes from pecl oauth extension...

On Apr 4, 3:28 pm, djpate <[email protected]> wrote:
> I'm trying to update events in a calendar using the google calendar
> API but I cant get it to work.
>
> Here is my update function.
>
> I'm using pecl's oauth extension.
>
> public function updateEvent($id,$title,$body,$start,$end){
>
>         $calendar = $this->getCalendars();
>
>         try {
>
>             $feed = $this->fetch($calendar['data']['items']['0']
> ['eventFeedLink']."/".$id);
>
>             $feed['data']['title'] = $title;
>             $feed['data']['details'] = $body;
>             $feed['data']['when']['0']['start'] = 
> $this->jsDateToGoogleDate($start);
>
>             $feed['data']['when']['0']['end'] = $this-
>
> >jsDateToGoogleDate($end);
>
>             echo json_encode($feed);
>
>             $this->oauth->fetch($feed['data']
> ['selfLink'],json_encode($feed),OAUTH_HTTP_METHOD_PUT,array("Content-
> Type"=>"application/json","If-Match"=>"*"));
>
>             print_r(json_decode($this->oauth-
>
> >getLastResponse(),true));
>
>         } catch (OAuthException $e){
>             die("ERR : ".$e->getMessage());
>         }
>     }
>
> I have no error what so ever.
>
> The echo json_encode($feed) outputs :
>
> { "apiVersion" : "2.6",
>   "data" : { "alternateLink" : "https://www.google.com/calendar/event?
> eid=bHBkam44Yjk2dDMwYXRxa2dmNzY4dmpkbWMgY3ZlcmJpbm5lbkBmcmVlLWV4cGVydC5jb20",
>       "anyoneCanAddSelf" : false,
>       "attendees" : [ { "displayName" : "[email protected]",
>             "email" : "[email protected]",
>             "rel" : "organizer"
>           } ],
>       "canEdit" : true,
>       "created" : "2011-04-04T07:08:14.000Z",
>       "creator" : { "displayName" : "Christophe Verbinnen",
>           "email" : "[email protected]"
>         },
>       "details" : "dklj",
>       "etag" : "\"F0gCQwRIeip7JGA6WhJQ\"",
>       "guestsCanInviteOthers" : true,
>       "guestsCanModify" : false,
>       "guestsCanSeeGuests" : true,
>       "id" : "lpdjn8b96t30atqkgf768vjdmc",
>       "kind" : "calendar#event",
>       "selfLink" : "https://www.google.com/calendar/feeds/cverbinnen
> %40free-expert.com/private/full/lpdjn8b96t30atqkgf768vjdmc",
>       "sequence" : 0,
>       "status" : "confirmed",
>       "title" : "nuvo",
>       "transparency" : "opaque",
>       "updated" : "2011-04-04T07:08:14.000Z",
>       "visibility" : "default",
>       "when" : [ { "end" : "2011-04-06T13:00:00.000+02:00",
>             "start" : "2011-04-06T08:30:00.000+02:00"
>           } ]
>     }
>
> }
>
> and the output from the PUT :
>
> <entry xmlns='http://www.w3.org/2005/Atom'xmlns:gCal='http://
> schemas.google.com/gCal/2005' xmlns:gd='http://schemas.google.com/g/
> 2005'>
>
>   <id>http://www.google.com/calendar/feeds/cverbinnen%40free-
> expert.com/private/full/lpdjn8b96t30atqkgf768vjdmc</id>
>
>   <published>2011-04-04T07:08:14.000Z</published>
>
>   <updated>2011-04-04T07:08:14.000Z</updated>
>
>   <category scheme='http://schemas.google.com/g/2005#kind'
> term='http://schemas.google.com/g/2005#event'/>
>
>   <title type='text'>nuvo</title>
>
>   <content type='text'>dklj</content>
>
>   <link rel='alternate' type='text/html' href='https://www.google.com/
> calendar/event?
> eid=bHBkam44Yjk2dDMwYXRxa2dmNzY4dmpkbWMgY3ZlcmJpbm5lbkBmcmVlLWV4cGVydC5jb20'
> title='alternate' />
>
>   <link rel='self' type='application/atom+xml' 
> href='https://www.google.com/calendar/feeds/cverbinnen%40free-expert.com/private/fu...
> />
>
>   <link rel='edit' type='application/atom+xml' 
> href='https://www.google.com/calendar/feeds/cverbinnen%40free-expert.com/private/fu...
> />
>
>   <author>
>
>     <name>Christophe Verbinnen</name>
>
>     <email>[email protected]</email>
>
>   </author>
>
>   <gd:comments>
>
>     <gd:feedLink href='https://www.google.com/calendar/feeds/cverbinnen
> %40free-expert.com/private/full/lpdjn8b96t30atqkgf768vjdmc/comments' /
>
>
>
>   </gd:comments>
>
>   <gd:eventStatus value='http://schemas.google.com/g/
> 2005#event.confirmed' />
>
>   <gd:where />
>
>   <gd:who email='[email protected]' rel='http://
> schemas.google.com/g/2005#event.organizer'
> valueString='[email protected]' />
>
>   <gd:when endTime='2011-04-06T11:45:00.000+02:00'
> startTime='2011-04-06T08:30:00.000+02:00' />
>
>   <gd:transparency value='http://schemas.google.com/g/
> 2005#event.opaque' />
>
>   <gd:visibility value='http://schemas.google.com/g/
> 2005#event.default' />
>
>   <gCal:anyoneCanAddSelf value='false' />
>
>   <gCal:guestsCanInviteOthers value='true' />
>
>   <gCal:guestsCanModify value='false' />
>
>   <gCal:guestsCanSeeGuests value='true' />
>
>   <gCal:sequence value='0' />
>
>   <gCal:uid value='[email protected]' />
>
> </entry>
>
> As you can see the output from the PUT is not the same as the one from
> the feed i'm sending because i'm sending a end date a 13:00h and it
> returns an end date not modified( still at 11h45pm).
>
> The Http response code is 200.
>
> Anyone have a clue ?
>
> Thanks for reading.

-- 
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html

Reply via email to