class Flickr < Relax::Service defaults do parameter :api_key, :required => true end endpoint "http://api.flickr.com/services/rest" do defaults do parameter :method, :required => true end action :get_photos do set :method, "flickr.people.getPublicPhotos" parameter :user_id, :required => true parameter :safe_search parameter :extras parameter :per_page parameter :page parser :rsp do element :status, :attribute => :stat element :photos do element :page, :attribute => true element :pages, :attribute => true element :per_page, :attribute => :perpage element :total, :attribute => true elements :photo do element :id, :attribute => true element :owner, :attribute => true element :secret, :attribute => true element :server, :attribute => true element :farm, :attribute => true element :title, :attribute => true element :ispublic, :attribute => true element :isfriend, :attribute => true element :isfamily, :attribute => true end end end end action :get_user_by_username do set :method, "flickr.people.findByUsername" parameter :username, :required => true parser :rsp do element :status, :attribute => :stat element :user do element :id, :attribute => true element :nsid, :attribute => true element :username end end end end end FakeWeb.register_uri(:get, 'http://api.flickr.com/services/rest?api_key=secret&method=flickr.people.findByUsername&username=duncandavidson', :string => <<-RESPONSE) duncandavidson RESPONSE FakeWeb.register_uri(:get, 'http://api.flickr.com/services/rest?user_id=59532755@N00&per_page=3&method=flickr.people.getPublicPhotos&api_key=secret', :string => <<-RESPONSE) RESPONSE