examples/5-payments-history.rb in mollie-api-ruby-1.1.2 vs examples/5-payments-history.rb in mollie-api-ruby-1.1.3

- old
+ new

@@ -1,27 +1,27 @@ # # Example 5 - How to retrieve your payments history. # require File.expand_path "../lib/Mollie/API/Client", File.dirname(__FILE__) -begin - # - # Initialize the Mollie API library with your API key. - # - # See: https://www.mollie.nl/beheer/account/profielen/ - # - mollie = Mollie::API::Client.new - mollie.setApiKey "test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" +begin + # + # Initialize the Mollie API library with your API key. + # + # See: https://www.mollie.nl/beheer/account/profielen/ + # + mollie = Mollie::API::Client.new + mollie.setApiKey "test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" - # - # Get the all payments for this API key ordered by newest. - # - payments = mollie.payments.all + # + # Get the all payments for this API key ordered by newest. + # + payments = mollie.payments.all - $response.body = "Your API key has #{payments.totalCount} payments, last #{payments.count}:<br>" + $response.body = "Your API key has #{payments.totalCount} payments, last #{payments.count}:<br>" - payments.each { |payment| - $response.body << "&euro; #{payment.amount}, status: #{CGI.escapeHTML payment.status} (#{CGI.escapeHTML payment.id})<br>" - } + payments.each { |payment| + $response.body << "&euro; #{payment.amount}, status: #{CGI.escapeHTML payment.status} (#{CGI.escapeHTML payment.id})<br>" + } rescue Mollie::API::Exception => e - $response.body << "API call failed: " << (CGI.escapeHTML e.message) + $response.body << "API call failed: " << (CGI.escapeHTML e.message) end