module Sinatra::Ace::Helper
Public Instance Methods
attributes()
click to toggle source
# File lib/sinatra/ace.rb, line 18 def attributes @attributes ||= (1..10).to_a.inject({}) do |attributes, i| if (name = params["Attribute.#{i.to_s}.Name"]) && (value = params["Attribute.#{i.to_s}.Value"]) attributes[name] = value end attributes end end
error_xml(type, code, message)
click to toggle source
# File lib/sinatra/ace.rb, line 39 def error_xml(type, code, message) builder do |xml| xml.instruct! xml.ErrorResponse do xml.Error do xml.Type type xml.Code code xml.Message message end xml.ResponseMetadata { xml.RequestId request_id } end end end
request_id()
click to toggle source
# File lib/sinatra/ace.rb, line 6 def request_id @request_id ||= SecureRandom.uuid end
requested_action()
click to toggle source
# File lib/sinatra/ace.rb, line 10 def requested_action params['Action'] end
requested_version()
click to toggle source
# File lib/sinatra/ace.rb, line 14 def requested_version params['Version'] end
response_xml() { |xml| ... }
click to toggle source
# File lib/sinatra/ace.rb, line 27 def response_xml builder do |xml| xml.instruct! xml.tag!("#{requested_action}Response") do xml.tag!("#{requested_action}Result") do yield(xml) end xml.ResponseMetadata { xml.RequestId request_id } end end end