Sha256: 72acb773ac7e70756091515fde4250f733ae53e2cab433fea927a5fdd5bee5c7
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module Bs2Api module Payment class Base def call response = HTTP.auth("Bearer #{bearer_token}") .headers(headers) .post( url, json: payload ) raise Bs2Api::Errors::BadRequest, response.body.to_s if !response.status.created? Bs2Api::Entities::Payment.from_response(response.parse) end private def headers { "Content-Type": "application/json", "Accept": "application/json", "Accept-Encoding": "gzip,deflate" } end def bearer_token Bs2Api::Request::Auth.token end def payload no_method_error end def url no_method_error end def no_method_error raise NoMethodError, "Missing #{__method__} to #{self.class}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bs2_api-0.2.0 | lib/bs2_api/payment/base.rb |