Please disable Adblockers and enable JavaScript for domain CEWebS.cs.univie.ac.at! We have NO ADS, but they may interfere with some of our course material.

Name: examples/flickr/client.rb 
1:
# encoding: utf-8
2:
#!/usr/bin/ruby
3:
require '../../lib/ruby/riddl/client'
4:
require 'Helpers/flickr.rb'
5:
require 'pp'
6:
  
7:
fh = FlickrHelper.new("Flickr/")
8:
params = [
9:
  Riddl::Parameter::Simple.new("api_key", fh.api_key),
10:
  Riddl::Parameter::Simple.new("auth_token", fh.auth_token),
11:
  Riddl::Parameter::Complex.new("photo","image/jpeg",File.open('riddl.jpg','r'),'riddl.jpg'),
12:
  Riddl::Parameter::Simple.new("author", "Jürgen Mangler"),
13:
  Riddl::Parameter::Simple.new("title", "RIDDL Logo"),
14:
  Riddl::Parameter::Simple.new("description", "The official RIDDL logo, the first thing created for this project."),
15:
  Riddl::Parameter::Simple.new("tags", "RIDDL, REST, Composition, Evolution"),
16:
  Riddl::Parameter::Simple.new("longitude", 16.357141),
17:
  Riddl::Parameter::Simple.new("latitude", 48.213736),
18:
  Riddl::Parameter::Simple.new("is_public", 1),
19:
]
20:
params <<  Riddl::Parameter::Simple.new("api_sig", fh.sign(params,["api_key","auth_token","title","description","tags","is_public"]))
21:
 
22:
#puts params.pretty_inspect
23:
 
24:
dflick = Riddl::Client.facade("declaration.xml")
25:
upload = dflick.resource("/upload")
26:
status, res = upload.post params
27:
 
28:
puts status
29:
puts res[0].value.read