Module: PayTrace::Debug
- Defined in:
- lib/paytrace/debug.rb
Overview
Useful helper methods for debugging.
Class Method Summary collapse
-
.configure_test(un = "demo123", pw = "demo123", domain = "stage.paytrace.com") ⇒ Object
Helper method to configure a default test environment.
-
.dump_transaction ⇒ Object
Helper that loops through the response values and dumps them out.
-
.log(msg) ⇒ Object
Formatted output for a text message.
-
.trace(&block) ⇒ Object
Helper method to dump a request response pair.
Class Method Details
.configure_test(un = "demo123", pw = "demo123", domain = "stage.paytrace.com") ⇒ Object
Helper method to configure a default test environment. Accepts username, password, and domain parameters. domain defaults to “stage.paytrace.com” and the username/password default to the credentials for the sandbox account
50 51 52 53 54 55 56 |
# File 'lib/paytrace/debug.rb', line 50 def self.configure_test(un = "demo123", pw = "demo123", domain = "stage.paytrace.com") PayTrace.configure do |config| config.user_name = un config.password = pw config.domain = domain end end |
.dump_transaction ⇒ Object
Helper that loops through the response values and dumps them out
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/paytrace/debug.rb', line 9 def self.dump_transaction puts "[REQUEST] #{PayTrace::API::Gateway.last_request}" response = PayTrace::API::Gateway.last_response_object if(response.has_errors?) response.errors.each do |key, value| puts "[RESPONSE] ERROR: #{key.ljust(20)}#{value}" end else response.values.each do |key, value| puts "[RESPONSE] #{key.ljust(20)}#{value}" end end end |
.log(msg) ⇒ Object
Formatted output for a text message.
24 25 26 |
# File 'lib/paytrace/debug.rb', line 24 def self.log(msg) puts ">>>>>> #{msg}" end |