Sha256: 3ae60e77fe8299fdd449e7ef5350a1810f04d8a56f1f194dbc33907601808bd2

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 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

3 entries across 3 versions & 1 rubygems

Version Path
moip2-0.1.4 lib/moip2/refund_api.rb
moip2-0.1.3 lib/moip2/refund_api.rb
moip2-0.1.1 lib/moip2/refund_api.rb