Class: IPay::XmlRequest
- Inherits:
-
Object
- Object
- IPay::XmlRequest
- Defined in:
- lib/ipay/xml_request.rb
Constant Summary collapse
- CONFIG_GLOBALS =
[:operator, :terminal_id, :pin, :verbose_response]
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ XmlRequest
constructor
A new instance of XmlRequest.
- #send ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ XmlRequest
Returns a new instance of XmlRequest.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ipay/xml_request.rb', line 11 def initialize(data = {}) @data = data IPay::log.debug "Request Args: #{(@data.collect { |k, v| "#{k}=#{v}" }.join(','))}" CONFIG_GLOBALS.each do |key| next if @data.include?(key) @data[key] = IPay::config.send(key) if IPay::config.respond_to?(key) end @xml = build_xml Util::hash_to_xml(@data) IPay::log.debug @xml end |
Instance Method Details
#send ⇒ Object
28 29 30 31 |
# File 'lib/ipay/xml_request.rb', line 28 def send raise RequestError.new('No iPay API url was specified in your configuration') unless IPay::config.url do_post(IPay::config.url, @xml) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/ipay/xml_request.rb', line 24 def to_s @xml end |