File: flickr.rb

package info (click to toggle)
ruby-soap4r 2.0.5-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,032 kB
  • sloc: ruby: 52,729; xml: 266; sh: 42; javascript: 20; makefile: 13; perl: 10
file content (26 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'soap/rpc/driver'

api_key = ARGV.shift or raise

flickr = SOAP::RPC::Driver.new('http://www.flickr.com/services/soap/')
flickr.wiredump_dev = STDOUT if $DEBUG

flickr.add_document_method('request', nil,
  XSD::QName.new('urn:flickr', 'FlickrRequest'),
  XSD::QName.new('urn:flickr', 'FlickrResponse'))

soap12namespace = 'http://www.w3.org/2003/05/soap-envelope'
flickr.options['soap.envelope.requestnamespace'] = soap12namespace
flickr.options['soap.envelope.responsenamespace'] = soap12namespace

response = flickr.request(
  :api_key => api_key,
  :method => 'flickr.test.echo',
  :name => 'hello world')

responsexml = "<dummy>#{response}</dummy>"

require 'xsd/mapping'
obj = XSD::Mapping.xml2obj(responsexml)
p obj.method
p obj.name