Sha256: 5b653ee98123e2f857dc6087341dc3d55f80bdf55d7575617d76dbf22e2272d5

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

require "httparty"
require "delegate"
require "recursive-open-struct"

require "moip2/version"

require "moip2/auth/basic"
require "moip2/auth/oauth"

require "moip2/resource/account"
require "moip2/resource/order"
require "moip2/resource/entry"
require "moip2/resource/payment"
require "moip2/resource/transfer"
require "moip2/resource/multi_order"
require "moip2/resource/multi_payment"
require "moip2/resource/customer"
require "moip2/resource/invoice"
require "moip2/resource/keys"
require "moip2/resource/refund"
require "moip2/resource/webhooks"
require "moip2/resource/connect"
require "moip2/resource/credit_card"
require "moip2/resource/notification"
require "moip2/resource/balances"
require "moip2/resource/bank_account"
require "moip2/resource/escrow"

require "moip2/response"
require "moip2/client"
require "moip2/connect_client"
require "moip2/order_api"
require "moip2/entry_api"
require "moip2/multi_order_api"
require "moip2/payment_api"
require "moip2/transfer_api"
require "moip2/multi_payment_api"
require "moip2/customer_api"
require "moip2/invoice_api"
require "moip2/refund_api"
require "moip2/api"
require "moip2/keys_api"
require "moip2/webhooks_api"
require "moip2/accounts_api"
require "moip2/connect_api"
require "moip2/notifications_api"
require "moip2/balances_api"
require "moip2/bank_accounts_api"

require "moip2/exceptions/invalid_enviroment_error"

require "moip2/util/filters_encoder"

module Moip2
  class << self
    VALID_ENVS = %i(sandbox production).freeze

    def env=(env)
      raise InvalidEnviromentError unless VALID_ENVS.include?(env.to_sym)
      @env = env
    end

    def env
      @env ||= :sandbox
    end

    def auth=(credentials)
      @credentials = credentials
    end

    def auth
      @credentials
    end

    def opts=(opts = {})
      @opts = opts
    end

    def opts
      @opts ||= {}
    end

    def new
      raise "Auth is not set" unless auth

      Api.new Client.new(env, auth)
    end
  end

  class NotFoundError < StandardError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moip2-1.3.1 lib/moip2.rb