SlideShare uma empresa Scribd logo
1 de 150
Baixar para ler offline
↓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/

Mais conteúdo relacionado

Mais procurados

exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailbox
Daniel Gilhousen
 

Mais procurados (19)

fabfile.py
fabfile.pyfabfile.py
fabfile.py
 
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
 
Flamingo Core Concepts
Flamingo Core ConceptsFlamingo Core Concepts
Flamingo Core Concepts
 
Rails 3.1 Awesomeness - what's new
Rails 3.1 Awesomeness - what's newRails 3.1 Awesomeness - what's new
Rails 3.1 Awesomeness - what's new
 
Fabric Python Lib
Fabric Python LibFabric Python Lib
Fabric Python Lib
 
Tasks: you gotta know how to run them
Tasks: you gotta know how to run themTasks: you gotta know how to run them
Tasks: you gotta know how to run them
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gem
 
«Работа с базами данных с использованием Sequel»
«Работа с базами данных с использованием Sequel»«Работа с базами данных с использованием Sequel»
«Работа с базами данных с использованием Sequel»
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
minne の API 改善
minne の API 改善minne の API 改善
minne の API 改善
 
Symfony2 - Request to Response
Symfony2 - Request to ResponseSymfony2 - Request to Response
Symfony2 - Request to Response
 
RxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrowRxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrow
 
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
[Quase] Tudo que você precisa saber sobre  tarefas assíncronas[Quase] Tudo que você precisa saber sobre  tarefas assíncronas
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
 
exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailbox
 
Rails3 changesets
Rails3 changesetsRails3 changesets
Rails3 changesets
 
GPerf Using Jesque
GPerf Using JesqueGPerf Using Jesque
GPerf Using Jesque
 
A Gentle Introduction to Event Loops
A Gentle Introduction to Event LoopsA Gentle Introduction to Event Loops
A Gentle Introduction to Event Loops
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Testing ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using RubyTesting ASP.net Web Applications using Ruby
Testing ASP.net Web Applications using Ruby
 

Semelhante a OSC2007-niigata - mashup

Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
railsconf
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
Alex Su
 
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Provectus
 

Semelhante a OSC2007-niigata - mashup (20)

RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
 
Design Summit - Rails 4 Migration - Aaron Patterson
Design Summit - Rails 4 Migration - Aaron PattersonDesign Summit - Rails 4 Migration - Aaron Patterson
Design Summit - Rails 4 Migration - Aaron Patterson
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
I Phone On Rails
I Phone On RailsI Phone On Rails
I Phone On Rails
 
Oracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experienceOracle APEX migration to 5.1 - Our experience
Oracle APEX migration to 5.1 - Our experience
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações Web
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
How to quickly make REST APIs with CompoundJS
How to quickly make REST APIs with CompoundJSHow to quickly make REST APIs with CompoundJS
How to quickly make REST APIs with CompoundJS
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
huhu
huhuhuhu
huhu
 
Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
 

Mais de Yuichiro MASUI (13)

AIR+Blaze+Ruby
AIR+Blaze+RubyAIR+Blaze+Ruby
AIR+Blaze+Ruby
 
マッシュアップ沖縄版 おまけ:OpenSocail
マッシュアップ沖縄版 おまけ:OpenSocailマッシュアップ沖縄版 おまけ:OpenSocail
マッシュアップ沖縄版 おまけ:OpenSocail
 
Rails 1H
Rails 1HRails 1H
Rails 1H
 
2007/09/29 PHP to Rails - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
2007/09/29 PHP to Rails - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”2007/09/29 PHP to Rails - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
2007/09/29 PHP to Rails - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
 
2007/09/29 PHP to Ruby - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
2007/09/29 PHP to Ruby - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”2007/09/29 PHP to Ruby - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
2007/09/29 PHP to Ruby - Webキャリアさん主催 ”PHPプログラマの為のRuby on Rails入門”
 
Railsチュートリアル
RailsチュートリアルRailsチュートリアル
Railsチュートリアル
 
InstantRails how to
InstantRails how toInstantRails how to
InstantRails how to
 
Rubyの基礎
Rubyの基礎Rubyの基礎
Rubyの基礎
 
PukiWiki
PukiWikiPukiWiki
PukiWiki
 
Masuidrive Working Style
Masuidrive Working StyleMasuidrive Working Style
Masuidrive Working Style
 
Ruby de Rails
Ruby de RailsRuby de Rails
Ruby de Rails
 
How to build 1 hour mashup site
How to build 1 hour mashup site How to build 1 hour mashup site
How to build 1 hour mashup site
 
Furo Grammer
Furo GrammerFuro Grammer
Furo Grammer
 

Último

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

OSC2007-niigata - mashup