OSC2007-niigata - mashup
Upcoming SlideShare
Loading in...5
×
 

OSC2007-niigata - mashup

on

  • 5,476 views

 

Statistics

Views

Total Views
5,476
Views on SlideShare
5,057
Embed Views
419

Actions

Likes
4
Downloads
91
Comments
0

8 Embeds 419

http://blog.masuidrive.jp 389
http://creator-textcube.blogspot.com 18
http://creator-textcube.blogspot.kr 6
http://creator-textcube.blogspot.jp 2
http://rss.nis.nec.co.jp 1
http://72.14.235.104 1
http://webcache.googleusercontent.com 1
http://lifeast.net 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

OSC2007-niigata - mashup OSC2007-niigata - mashup Presentation Transcript

  • ↓Macbook pro
  • ↓Macbook pro Not
  • 1
  • Rails
  • Mashup
  • Mashup
  • Remix
  • Remix
  • Mashup
  • Mashup
  • Mashup
  • HTML
  • API
  • Web2.0
  • WebAPI
  • WebAPI
  • 3
  • RSS Amazon Web Service Google net
  • →MP3
  • Google Maps NIFTY Timeline API
  • API MVC M V
  • Controller
  • PHP, Perl, Ruby, Java....
  • PHP
  • Ruby on Rails
  • Web2.0
  • WebAPI ActiveResource
  • Rails2.0
  • Rails2.0
  • ActiveResource
  • Rails Rails
  • Mashup
  • OSC-Do blog
  • WebAPI
  • API
  • API
  • API URL
  • http://jws.jalan.net/APICommon/ OnsenSearch/V1/? key=**********&l_area=010802 &count=1&xml_ptn=1
  • XML
  • Rails
  • require 'net/http' require 'cgi' require 'rexml/document' class Onsen attr_accessor :address, :name, :id KEY = 'phe11375af71ba' URL = 'http://jws.jalan.net/APICommon/OnsenSearch/V1/?' def self.find(params) results = [] get(params).elements.each('Results/Onsen') do |el| results << Onsen.new(el.elements[quot;OnsenIDquot;].text, el.elements[quot;OnsenNamequot;].text, el.elements[quot;OnsenAddressquot;].text) end results end def self.url(params) params[:key] = KEY URI.parse(URL+((params.map { |key,value| quot;#{key}=#{CGI::escape(value.to_s)}quot;}).join('&'))) end def self.get(params) REXML::Document.new(Net::HTTP.get(url(params))) end def initialize(id, name, address) @id, @name, @address = id, name, address end end
  • API
  • Web
  • irb> puts Onsen.find(:count => 10, :pref => '170000').map{|o| o.name}.join(',') => , , , , , , , , , ( )
  • Google Map
  • Ruby
  • YM4R/GM
  • GoogleMaps API Rails
  • $ rails onsen -d sqlite3 $ cd onsen $ script/plugin install svn://rubyforge.org/var/svn/ym4r/Plugins/GM/trunk/ym4r_gm $ ./script/generate controller onsen index
  • Onsen lib/onsen.rb
  • class OnsenController < ApplicationController def index @map = GMap.new(quot;map_divquot;) @map.control_init :large_map => true, :map_type => true @map.center_zoom_init([37.60988,138.872681], 10) end end
  • <html> <head> <%= GMap.header %> <%= @map.to_html %> </head> <body> <%= @map.div(:width => 600, :height => 400) %> </body> </html>
  • Google Maps
  • API
  • Google Maps API
  • YM4R/GM
  • irb> nigata = Geocoding.get(‘ ’) irb> nigata.first.latlon => [37.912016, 139.061847]
  • Onsen
  • class Onsen def latlon Geocoding.get(@address).first.latlon end end
  • Google
  • class Onsen def latlon Geocoding.get(@address.gsub(/( | | ).{1,5} /,'¥¥1')).first.latlon end end
  • 2 API Mashup
  • class OnsenController < ApplicationController def index @map = GMap.new(quot;map_divquot;) @map.control_init(:large_map => true, :map_type => true) @map.center_zoom_init([37.60988,138.872681], 8) return Onsen.find(:count => 30, :pref => '170000').each do |o| begin marker = GMarker.new( o.latlon, :title => o.name, :info_window => render_to_string( :partial => 'point', :locals => { :onsen => o }) ) @map.overlay_init(marker) rescue end end end
  • HTML
  • <div><strong><%=h onsen.name %></strong></div> <div><%=h onsen.address %></div>
  • Flickr
  • WebAPI
  • Ruby
  • API
  • Yahoo Web
  • http://api.search.yahoo.co.jp/ ImageSearchService/V1/ imageSearch? appid=YahooDemo&results=1& query=
  • Onsen
  • class Onsen def photo Onsen.get({ :appid=>'onsen', :query=>@name.gsub(/ ¥(.*/,''), :results => 1}, quot;http://api.searc........rch?quot; ).elements['/ResultSet/Result/Thumbnail/ Url'].text end end
  • <div><strong><%=h onsen.name %></strong></div> <div><%=h onsen.address %></div> <div style=quot;height: 120pxquot;> <%= image_tag(onsen.photo) rescue 'No photo' %> </div>
  • acts_as_commentable
  • jpmobile
  • http://blog.masuidrive.jp/