Sha256: 33d9fe73c00795b3741acbcba68c16e578250ec29d112fa10a9069cd983d83e2

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

module Cobrato
  class Client
    attr_reader :http

    def initialize(token)
      @http = Http.new(token)
    end

    def authenticated?
      http.get("") do |response|
        response.code == 200
      end
    rescue RequestError => e
      raise e unless e.code == 401
      false
    end

    def payees
      Resources::Payee.new(http)
    end

    def bank_accounts
      Resources::BankAccount.new(http)
    end

    def charge_configs
      Resources::ChargeConfig.new(http)
    end

    def payment_configs
      Resources::PaymentConfig.new(http)
    end

    def payments
      Resources::Payment.new(http)
    end

    def charges
      Resources::Charge.new(http)
    end

    def webhooks
      Resources::Webhook.new(http)
    end

    def charging_types
      Resources::ChargingType.new(http)
    end

    def regress_cnabs
      Resources::RegressCnab.new(http)
    end

    def remittance_cnabs
      Resources::RemittanceCnab.new(http)
    end

    def credit_cards
      Resources::CreditCard.new(http)
    end

    def payers
      Resources::Payer.new(http)
    end

    def people
      Resources::Person.new(http)
    end

    def charge_templates
      Resources::ChargeTemplate.new(http)
    end

    def payment_methods
      Resources::PaymentMethod.new(http)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cobrato-client-1.1.7 lib/cobrato/client.rb
cobrato-client-1.1.6 lib/cobrato/client.rb
cobrato-client-1.1.5 lib/cobrato/client.rb