Sha256: e9edda84e7b0eb5bbba3199063163cfe0ce63fbd4a230ac0a868863ec6b0da20
Contents?: true
Size: 813 Bytes
Versions: 5
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true module Bckbn module Charge ENDPOINTS = { all: "/charges", create: "/charges", get: "/charges/{id}" }.freeze private_constant :ENDPOINTS def self.all(config = {}) path = ENDPOINTS.fetch(__method__) @conn = Bckbn::Connection.new(config) @conn.get_from_api(path, ChargesResponse) end def self.create(body, config = {}) body = CreateChargeRequest.new(body) @conn = Bckbn::Connection.new(config) @conn.post_to_api(ENDPOINTS.fetch(__method__), body.to_h, ChargeResponse) end def self.get(id, config = {}) path = Addressable::Template.new(ENDPOINTS.fetch(__method__)).expand(id: id) @conn = Bckbn::Connection.new(config) @conn.get_from_api(path, ChargeResponse) end end end
Version data entries
5 entries across 5 versions & 1 rubygems