Your SlideShare is downloading. ×
Desenvolvendo Aplicativos Sociais com Rails 3
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Desenvolvendo Aplicativos Sociais com Rails 3

4,772
views

Published on

Palestra realizada durante o RubyConf Brasil 2010.

Palestra realizada durante o RubyConf Brasil 2010.

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,772
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
46
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Desenvolvendo Aplicativos Sociais com Rails 3 Carlos Brando quarta-feira, 27 de outubro de 2010
  • 2. quarta-feira, 27 de outubro de 2010
  • 3. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 4. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 5. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 6. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 7. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 8. <?xml version="1.0" encoding="UTF-8" ?> <Module>  <ModulePrefs title="Standard gadget structure">   <Require feature="opensocial-0.8"/>  </ModulePrefs>  <Content type="html">  <![CDATA[       Hello, RubyConf!  ]]>  </Content> </Module> quarta-feira, 27 de outubro de 2010
  • 9. quarta-feira, 27 de outubro de 2010
  • 10. Profiles quarta-feira, 27 de outubro de 2010
  • 11. JS var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.send(fetchPersonHandler); function fetchPersonHandler(data) { var owner = data.get('owner').getData(); alert(owner.getDisplayName()); }; quarta-feira, 27 de outubro de 2010
  • 12. REST require 'oauth' require 'json' uri = URI.parse "http://sandbox.orkut.com/social/rest/people/#{orkut_uid}/@self?xoauth_requestor_id=#{orkut_uid}" http = Net::HTTP.new(uri.host, uri.port) req = Net::HTTP::Get.new(uri.request_uri) consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET) req.oauth!(http, consumer, nil, :scheme => 'query_string') resp = http.get(req.path) JSON.parse(resp.body) quarta-feira, 27 de outubro de 2010
  • 13. Friends quarta-feira, 27 de outubro de 2010
  • 14. JS var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" }); req.add(req.newFetchPeopleRequest(viewerFriends, {}), 'viewerFriends'); req.send(onLoadFriends); quarta-feira, 27 de outubro de 2010
  • 15. REST http://sandbox.orkut.com/social/rest/people/#{orkut_uid}/@all?xoauth_requestor_id=#{orkut_uid}&count=9999 quarta-feira, 27 de outubro de 2010
  • 16. Activities quarta-feira, 27 de outubro de 2010
  • 17. JS function sendMessage(messageTitle, messageBody, friend) { var params = []; params[opensocial.Message.Field.TITLE] = messageTitle; params[opensocial.Message.Field.TYPE] = opensocial.Message.Type.EMAIL; var message = opensocial.newMessage(messageBody, params); opensocial.requestSendMessage(friend, message, function() {}); } quarta-feira, 27 de outubro de 2010
  • 18. REST quarta-feira, 27 de outubro de 2010
  • 19. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 20. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 21. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 22. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 23. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 24. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 25. function loadInitialData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("OWNER"), "owner"); req.add(req.newFetchPersonRequest("VIEWER"), "viewer"); req.send(function(dataResponse) { var owner = dataResponse.get('owner').getData(); var viewer = dataResponse.get('viewer').getData(); OWNER_ID = owner.getId(); VIEWER_ID = viewer.getId(); HOST_WITH_PORT = $('#host_with_port').val(); sendRequest('/speakers', {}, '#speakers'); }); } gadgets.util.registerOnLoadHandler(loadInitialData); quarta-feira, 27 de outubro de 2010
  • 26. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 27. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 28. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 29. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 30. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 31. function sendRequest(path, options, element) { var querystring = '?owner_id=' + OWNER_ID + '&viewer_id=' + VIEWER_ID; if (options) { $.each(options, function(index, val) { querystring = querystring + '&' + index + '=' + val; }); }; var url = HOST_WITH_PORT + '/opensocial' + path + querystring; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; makeCachedRequest(encodeURI(url), function(result) { $(element).html(result.text); gadgets.window.adjustHeight(); }, params, 0); } quarta-feira, 27 de outubro de 2010
  • 32. @carlosbrando www.nomedojogo.com quarta-feira, 27 de outubro de 2010