Sha256: c2b6720c9b44720c6d30826ab4aa5025854a1fea9f3cc2da0739edfee50d0748
Contents?: true
Size: 462 Bytes
Versions: 4
Compression:
Stored size: 462 Bytes
Contents
module PaymobRuby class Login < ApplicationService def call url = "#{BASE_URI}/auth/tokens" response = ::Faraday.post(url, { api_key: PaymobRuby.api_key }.to_json, "Content-Type" => "application/json") raise AuthenticationError.new("Invalid API key", http_status: response.status, http_body: response.body) unless response.success? response_json = JSON.parse(response.body) success(response_json["token"]) end end end
Version data entries
4 entries across 4 versions & 1 rubygems