Class: PicturePath::Client
- Inherits:
-
Object
- Object
- PicturePath::Client
- Defined in:
- lib/picturepath/client.rb
Overview
The client that submits a request and returns a response.
Class Method Summary collapse
-
.submit(request, account, action) ⇒ Object
Submit a request to the provided account.
Class Method Details
.submit(request, account, action) ⇒ Object
Submit a request to the provided account. Use :check as the action to simulate a request and response and use :submit to actually submit the request.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/picturepath/client.rb', line 11 def self.submit(request, account, action) if action == :submit action = "Submit" elsif action == :check action = "Check" else raise "Action can only be :submit or :check" end xml = CGI.escape(request.to_xml) postUrl = "username=#{account.escape_username}&password=#{account.escape_password}&client=AUI&version=5.0&action=#{action}&xml=#{xml}" url = "#{account.action_url}?#{postUrl}" output = open(url).read return Response.new(output) end |