Sha256: 43555f1f1e6a12a4fa8a91ffa08d0021e57bbc5c7a7bdcb849ad168ec2c953e0

Contents?: true

Size: 506 Bytes

Versions: 5

Compression:

Stored size: 506 Bytes

Contents

module Moip2
  class RefundApi
    attr_reader :client

    def initialize(client)
      @client = client
    end

    def base_path(id)
      "/v2/#{base_resource(id)}/#{id}/refunds"
    end

    def create(id, refund = {})
      Resource::Refund.new client, client.post(base_path(id), refund)
    end

    def show(id)
      Resource::Refund.new client, client.get("/v2/refunds/#{id}")
    end

    private

    def base_resource(id)
      id.start_with?("PAY") ? "payments" : "orders"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moip2-1.3.1 lib/moip2/refund_api.rb
moip2-1.2.1 lib/moip2/refund_api.rb
moip2-1.2.0 lib/moip2/refund_api.rb
moip2-1.1.0 lib/moip2/refund_api.rb
moip2-1.0.0 lib/moip2/refund_api.rb