class Slimpay::App
Used only to get and set callback URLs.
Public Class Methods
new(username = nil, password = nil)
click to toggle source
Prepare an admin token for app requests.
Arguments:
username: Your Slimpay admin username password: Your Slimpay admin password
# File lib/slimpay/app.rb, line 9 def initialize(username = nil, password = nil) init_config @username = username || Slimpay.configuration.username @password = password || Slimpay.configuration.password @basic_auth = { username: "#{@creditor_reference}##{@username}", password: @password } response = HTTParty.post(@token_endpoint, basic_auth: @basic_auth, body: app_options) @token = response['access_token'] end
Public Instance Methods
change_urls(urls_params)
click to toggle source
Change the notification and return URLs.
Arguments:¶ ↑
returnUrl: (String) URL to your app the customer is gonna be redirected to when leaving Slimpay platform. notifyUrl: (String) URL to your app Slimpay is gonna send a notification to, to confirm a Signature, a payment, etc.
# File lib/slimpay/app.rb, line 38 def change_urls(urls_params) response = HTTParty.patch("#{@endpoint}/creditors/#{@creditor_reference}/apps/#{@client_id}", body: urls_params.to_json, headers: options) Slimpay.answer(response) end
notify_url(url)
click to toggle source
Change the notifyUrl
# File lib/slimpay/app.rb, line 28 def notify_url(url) response = HTTParty.patch("#{@endpoint}/creditors/#{@creditor_reference}/apps/#{@client_id}", body: { notifyUrl: url }.to_json, headers: options) Slimpay.answer(response) end
return_url(url)
click to toggle source
Change the returnUrl
Example:¶ ↑
app = Slimpay::App.new app.return_url = "mywebsite.com/client/123/"
# File lib/slimpay/app.rb, line 22 def return_url(url) response = HTTParty.patch("#{@endpoint}/creditors/#{@creditor_reference}/apps/#{@client_id}", body: { returnUrl: url }.to_json, headers: options) Slimpay.answer(response) end
Private Instance Methods
app_options()
click to toggle source
# File lib/slimpay/app.rb, line 45 def app_options { 'Accept' => API_HEADER, 'Content-type' => 'application/hal+json', 'grant_type' => 'client_credentials', 'scope' => 'api_admin' } end