class SplashPayments::Client
Public Class Methods
new()
click to toggle source
# File lib/splash/client.rb, line 4 def initialize # TODO: Throw an error if the api key is not set @api_key = SplashPayments.api_key @api_base = SplashPayments.live_api ? SplashPayments.api_base : SplashPayments.test_api_base @connection = Faraday.new(url: @api_base, headers: { 'APIKEY': @api_key, 'Content-Type': 'application/json' }) end
Public Instance Methods
request(method, url, params: {})
click to toggle source
# File lib/splash/client.rb, line 12 def request(method, url, params: {}) response = @connection.public_send(method, url, params) # TODO: Handle request errors JSON.parse(response.body) end