Sha256: 57a55f5d52771310af5280fbdfc1bbbe9c1465ce4049d90dfe819129a0783d2e

Contents?: true

Size: 1.66 KB

Versions: 7

Compression:

Stored size: 1.66 KB

Contents

#!/usr/bin/env ruby

# This file is a sample based on GoogleSearchClient.rb, which can be
# generated by WSDL file and wsdl2ruby.rb.
#
# $ wsdl2ruby.rb --type client --force \
#   --wsdl http://api.google.com/GoogleSearch.wsdl
#
# See wsdlDriver.rb to use WSDL file directly (slow).
require 'GoogleSearchDriver.rb'

endpoint_url = ARGV.shift
obj = GoogleSearchPort.new(endpoint_url)

# Uncomment the below line to see SOAP wiredumps.
# obj.wiredump_dev = STDERR

# SYNOPSIS
#   doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe)
#
# ARGS
#   key		 - {http://www.w3.org/2001/XMLSchema}string
#   q		 - {http://www.w3.org/2001/XMLSchema}string
#   start		 - {http://www.w3.org/2001/XMLSchema}int
#   maxResults		 - {http://www.w3.org/2001/XMLSchema}int
#   filter		 - {http://www.w3.org/2001/XMLSchema}boolean
#   restrict		 - {http://www.w3.org/2001/XMLSchema}string
#   safeSearch		 - {http://www.w3.org/2001/XMLSchema}boolean
#   lr		 - {http://www.w3.org/2001/XMLSchema}string
#   ie		 - {http://www.w3.org/2001/XMLSchema}string
#   oe		 - {http://www.w3.org/2001/XMLSchema}string
#
# RETURNS
#   return		GoogleSearchResult - {urn:GoogleSearch}GoogleSearchResult
#
# RAISES
#    N/A
#
key = q = start = maxResults = filter = restrict = safeSearch = lr = ie = oe = nil
key = File.open(File.expand_path("~/.google_key")) { |f| f.read }.chomp
q = "Ruby"
start = 0
maxResults = 10
filter = false
restrict = ""
safeSearch = false
lr = ""
ie = "utf-8"
oe = "utf-8"
result = obj.doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe)

result.resultElements.each do |ele|
  puts "== #{ele.title}: #{ele.URL}"
  puts ele.snippet
  puts
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
soap4r-spox-1.6.0 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-2.0.5 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-2.0.3 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-2.0.2 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-2.0.1 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-2.0.0 sample/showcase/wsdl/googleSearch/sampleClient.rb
soap4r-ruby1.9-1.0.0 sample/showcase/wsdl/googleSearch/sampleClient.rb