Module: Bs2Api

Defined in:
lib/bs2_api.rb,
lib/bs2_api/version.rb,
lib/bs2_api/pix/detail.rb,
lib/bs2_api/errors/base.rb,
lib/bs2_api/payment/key.rb,
lib/bs2_api/payment/base.rb,
lib/bs2_api/request/auth.rb,
lib/bs2_api/entities/bank.rb,
lib/bs2_api/payment/async.rb,
lib/bs2_api/entities/error.rb,
lib/bs2_api/payment/detail.rb,
lib/bs2_api/payment/manual.rb,
lib/bs2_api/entities/account.rb,
lib/bs2_api/entities/payment.rb,
lib/bs2_api/entities/pix_key.rb,
lib/bs2_api/entities/customer.rb,
lib/bs2_api/refund/pix/create.rb,
lib/bs2_api/refund/pix/detail.rb,
lib/bs2_api/errors/bad_request.rb,
lib/bs2_api/errors/invalid_bank.rb,
lib/bs2_api/errors/missing_bank.rb,
lib/bs2_api/errors/refund_error.rb,
lib/bs2_api/errors/server_error.rb,
lib/bs2_api/errors/unauthorized.rb,
lib/bs2_api/payment/confirmation.rb,
lib/bs2_api/entities/async_status.rb,
lib/bs2_api/entities/async_request.rb,
lib/bs2_api/errors/invalid_pix_key.rb,
lib/bs2_api/entities/async_response.rb,
lib/bs2_api/errors/invalid_customer.rb,
lib/bs2_api/errors/confirmation_error.rb,
lib/bs2_api/errors/missing_configuration.rb

Defined Under Namespace

Modules: Entities, Errors, Payment, Pix, Refund, Request

Constant Summary collapse

ENDPOINT =
{
  production: 'https://api.bs2.com',
  sandbox: 'https://apihmz.bancobonsucesso.com.br'
}.freeze
VERSION =
'1.9.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



59
60
61
# File 'lib/bs2_api.rb', line 59

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



63
64
65
# File 'lib/bs2_api.rb', line 63

def configure
  yield(configuration)
end

.endpointObject



67
68
69
# File 'lib/bs2_api.rb', line 67

def endpoint
  ENDPOINT[configuration.env.to_sym]
end

.envObject



79
80
81
# File 'lib/bs2_api.rb', line 79

def env
  configuration.env
end

.production?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/bs2_api.rb', line 71

def production?
  env == 'production'
end

.sandbox?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/bs2_api.rb', line 75

def sandbox?
  env == 'sandbox'
end