class Mollie::Client
Attributes
api_key[RW]
Public Class Methods
new(api_key)
click to toggle source
# File lib/mollie/client.rb, line 11 def initialize(api_key) self.api_key = api_key end
Public Instance Methods
auth_token()
click to toggle source
# File lib/mollie/client.rb, line 15 def auth_token "Bearer " + self.api_key end
issuers()
click to toggle source
# File lib/mollie/client.rb, line 35 def issuers response = self.class.get("/issuers", :headers => { 'Authorization' => auth_token } ) response = JSON.parse(response.body) response["data"].map {|issuer| {id: issuer["id"], name: issuer["name"]} } end
payment_methods(method = nil)
click to toggle source
# File lib/mollie/client.rb, line 63 def payment_methods(method = nil) response = self.class.get("/methods/#{method}", :headers => { 'Authorization' => auth_token } ) JSON.parse(response.body) end
payment_status(payment_id)
click to toggle source
# File lib/mollie/client.rb, line 45 def payment_status(payment_id) response = self.class.get("/payments/#{payment_id}", :headers => { 'Authorization' => auth_token } ) JSON.parse(response.body) end
prepare_payment(amount, description, redirect_url, metadata = {}, method=nil, method_params = {})
click to toggle source
# File lib/mollie/client.rb, line 19 def prepare_payment(amount, description, redirect_url, metadata = {}, method=nil, method_params = {}) response = self.class.post('/payments', :body => { :amount => amount, :description => description, :redirectUrl => redirect_url, :metadata => metadata, :method => method }.merge(method_params), :headers => { 'Authorization' => auth_token } ) JSON.parse(response.body) end
refund_payment(payment_id)
click to toggle source
# File lib/mollie/client.rb, line 54 def refund_payment(payment_id) response = self.class.post("/payments/#{payment_id}/refunds", :headers => { 'Authorization' => auth_token } ) JSON.parse(response.body) end