Slide 1

Slide 1 text

oEmbed on rails Kerstin Puschke Ruby Usergroup Hamburg January 2013 K. Puschke (Ruby Usergroup HH) oembed January 2013 1 / 17

Slide 2

Slide 2 text

License CC BY-SA 3.0 Creative Commons Attribution ShareAlike 3.0 http://creativecommons.org/licenses/by-sa/3.0/ K. Puschke (Ruby Usergroup HH) oembed January 2013 2 / 17

Slide 3

Slide 3 text

Who am I software engineer at XING K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17

Slide 4

Slide 4 text

Who am I software engineer at XING perl and rails K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17

Slide 5

Slide 5 text

Who am I software engineer at XING perl and rails @titanoboa42 on twitter K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17

Slide 6

Slide 6 text

Who am I software engineer at XING perl and rails @titanoboa42 on twitter titanoboa on github K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17

Slide 7

Slide 7 text

Who am I software engineer at XING perl and rails @titanoboa42 on twitter titanoboa on github titanoboa on stackoverflow K. Puschke (Ruby Usergroup HH) oembed January 2013 3 / 17

Slide 8

Slide 8 text

third-party media embedding Automated third-party media embedding turn a url into an embedded representation of the resource e.g. magically display embedded video instead of link K. Puschke (Ruby Usergroup HH) oembed January 2013 4 / 17

Slide 9

Slide 9 text

third-party media embedding screenscraping is a maintenance nightmare K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17

Slide 10

Slide 10 text

third-party media embedding screenscraping is a maintenance nightmare provider specific APIs: additional effort for each additional provider K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17

Slide 11

Slide 11 text

third-party media embedding screenscraping is a maintenance nightmare provider specific APIs: additional effort for each additional provider oEmbed standardizes embedding K. Puschke (Ruby Usergroup HH) oembed January 2013 5 / 17

Slide 12

Slide 12 text

oEmbed open embed format K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17

Slide 13

Slide 13 text

oEmbed open embed format open web standard for third-party media embedding K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17

Slide 14

Slide 14 text

oEmbed open embed format open web standard for third-party media embedding specs published in 2008 K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17

Slide 15

Slide 15 text

oEmbed open embed format open web standard for third-party media embedding specs published in 2008 by Leah Culver (Pownce), Cal Henderson (Flickr), Mike Malone (Pownce), and Richard Crowley (OpenDNS) K. Puschke (Ruby Usergroup HH) oembed January 2013 6 / 17

Slide 16

Slide 16 text

oEmbed providers youtube K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 17

Slide 17 text

oEmbed providers youtube vimeo K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 18

Slide 18 text

oEmbed providers youtube vimeo flickr K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 19

Slide 19 text

oEmbed providers youtube vimeo flickr twitter K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 20

Slide 20 text

oEmbed providers youtube vimeo flickr twitter slideshare K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 21

Slide 21 text

oEmbed providers youtube vimeo flickr twitter slideshare speakerdeck K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 22

Slide 22 text

oEmbed providers youtube vimeo flickr twitter slideshare speakerdeck intermediaries, e.g. embed.ly K. Puschke (Ruby Usergroup HH) oembed January 2013 7 / 17

Slide 23

Slide 23 text

oEmbed consumers drupal K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17

Slide 24

Slide 24 text

oEmbed consumers drupal wordpress K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17

Slide 25

Slide 25 text

oEmbed consumers drupal wordpress elgg K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17

Slide 26

Slide 26 text

oEmbed consumers drupal wordpress elgg diaspora K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17

Slide 27

Slide 27 text

oEmbed consumers drupal wordpress elgg diaspora xing K. Puschke (Ruby Usergroup HH) oembed January 2013 8 / 17

Slide 28

Slide 28 text

oEmbed spec http GET request to API endpoint with query param url K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17

Slide 29

Slide 29 text

oEmbed spec http GET request to API endpoint with query param url optional additional params: maxwidth, maxheight, format K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17

Slide 30

Slide 30 text

oEmbed spec http GET request to API endpoint with query param url optional additional params: maxwidth, maxheight, format response format xml or json K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17

Slide 31

Slide 31 text

oEmbed spec http GET request to API endpoint with query param url optional additional params: maxwidth, maxheight, format response format xml or json informs consumer how to embed, e.g. gives html snippet K. Puschke (Ruby Usergroup HH) oembed January 2013 9 / 17

Slide 32

Slide 32 text

Example: video http://www.youtube.com /oembed?url=http://www.youtube.com/watch?v=zwk1KvnZxGw { "author_name": "XINGcom", "html": "

Slide 33

Slide 33 text

Example response: photo { "type": "photo", "title": "Ba... "author_name": "... "author_url": "http://www.flickr.com/photos/... "width": "1024", "height": "768", "url": "http://farm4.staticflickr.com/3040/2362... "web_page": "http://www.flickr.com/photos/be... "thumbnail_url": "http://farm4.staticfli... "thumbnail_width": 75, "thumbnail_height": 75, "web_page_short_url": "http://flic.kr/p/4... "license": "All Rights Reserved", "version": "1.0", "cache_age": 3600, "provider_name": "Flickr", K. Puschke (Ruby Usergroup HH) oembed January 2013 11 / 17

Slide 34

Slide 34 text

oEmbed gems quite a few consumer gems K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17

Slide 35

Slide 35 text

oEmbed gems quite a few consumer gems oembed-provider (rails 2 only) K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17

Slide 36

Slide 36 text

oEmbed gems quite a few consumer gems oembed-provider (rails 2 only) oembed-provider-engine (rails 3 only) mountable rails 3 engine, heavily based on oembed-provider K. Puschke (Ruby Usergroup HH) oembed January 2013 12 / 17

Slide 37

Slide 37 text

oembed-provider-engine turning your app into an oEmbed provider mount OembedProviderEngine::Engine in routes.rb to provide route to API endpoint K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17

Slide 38

Slide 38 text

oembed-provider-engine turning your app into an oEmbed provider mount OembedProviderEngine::Engine in routes.rb to provide route to API endpoint your media item’s model K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17

Slide 39

Slide 39 text

oembed-provider-engine turning your app into an oEmbed provider mount OembedProviderEngine::Engine in routes.rb to provide route to API endpoint your media item’s model needs a method for each field to be part of the oEmbed response, e.g. html, thumbnail_url,. . . K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17

Slide 40

Slide 40 text

oembed-provider-engine turning your app into an oEmbed provider mount OembedProviderEngine::Engine in routes.rb to provide route to API endpoint your media item’s model needs a method for each field to be part of the oEmbed response, e.g. html, thumbnail_url,. . . include OembedProviderEngine::OembedProvidable K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17

Slide 41

Slide 41 text

oembed-provider-engine turning your app into an oEmbed provider mount OembedProviderEngine::Engine in routes.rb to provide route to API endpoint your media item’s model needs a method for each field to be part of the oEmbed response, e.g. html, thumbnail_url,. . . include OembedProviderEngine::OembedProvidable call oembed_providable_as with media type, e.g. oembed_providable_as :video K. Puschke (Ruby Usergroup HH) oembed January 2013 13 / 17

Slide 42

Slide 42 text

oembed-provider-engine inner workings oembed_providable_as creates scoped OembedResponse model, e.g. MediaItem::OembedResponse K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17

Slide 43

Slide 43 text

oembed-provider-engine inner workings oembed_providable_as creates scoped OembedResponse model, e.g. MediaItem::OembedResponse response model has attributes for each field to be included into the response K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17

Slide 44

Slide 44 text

oembed-provider-engine inner workings oembed_providable_as creates scoped OembedResponse model, e.g. MediaItem::OembedResponse response model has attributes for each field to be included into the response its initializer sets attributes to the respective values from the app’s media item K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17

Slide 45

Slide 45 text

oembed-provider-engine inner workings oembed_providable_as creates scoped OembedResponse model, e.g. MediaItem::OembedResponse response model has attributes for each field to be included into the response its initializer sets attributes to the respective values from the app’s media item has methods to format the response K. Puschke (Ruby Usergroup HH) oembed January 2013 14 / 17

Slide 46

Slide 46 text

oembed-provider-engine inner workings API endpoint routes to engine’s controller K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17

Slide 47

Slide 47 text

oembed-provider-engine inner workings API endpoint routes to engine’s controller param url parsed to determine media item model K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17

Slide 48

Slide 48 text

oembed-provider-engine inner workings API endpoint routes to engine’s controller param url parsed to determine media item model media item object initialized scoped response model created (if not already existing) K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17

Slide 49

Slide 49 text

oembed-provider-engine inner workings API endpoint routes to engine’s controller param url parsed to determine media item model media item object initialized scoped response model created (if not already existing) response object initialized K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17

Slide 50

Slide 50 text

oembed-provider-engine inner workings API endpoint routes to engine’s controller param url parsed to determine media item model media item object initialized scoped response model created (if not already existing) response object initialized response formatted and returned K. Puschke (Ruby Usergroup HH) oembed January 2013 15 / 17

Slide 51

Slide 51 text

oembed-provider-engine todo still very rails 2-ish :-( needs polishing K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17

Slide 52

Slide 52 text

oembed-provider-engine todo still very rails 2-ish :-( needs polishing proper handling of authorization K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17

Slide 53

Slide 53 text

oembed-provider-engine todo still very rails 2-ish :-( needs polishing proper handling of authorization caching K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17

Slide 54

Slide 54 text

oembed-provider-engine todo still very rails 2-ish :-( needs polishing proper handling of authorization caching improve test coverage, maybe migrate from shoulda to rspec K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17

Slide 55

Slide 55 text

oembed-provider-engine todo still very rails 2-ish :-( needs polishing proper handling of authorization caching improve test coverage, maybe migrate from shoulda to rspec allow for custom fields to be added to the response K. Puschke (Ruby Usergroup HH) oembed January 2013 16 / 17

Slide 56

Slide 56 text

Feedback & Co Questions, comments,. . . twitter: @titanoboa42 K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17

Slide 57

Slide 57 text

Feedback & Co Questions, comments,. . . twitter: @titanoboa42 email: [email protected] K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17

Slide 58

Slide 58 text

Feedback & Co Questions, comments,. . . twitter: @titanoboa42 email: [email protected] github: https://github.com/xing/oembed_provider_engine . . . we are happy to accept pull requests K. Puschke (Ruby Usergroup HH) oembed January 2013 17 / 17