Class: Bootpay::Api

Inherits:
Object
  • Object
show all
Includes:
Authentication, AutomaticTransfer, Billing, Cancel, CashReceipt, Easy, Escrow, Link, Naverpay, PaymentResource, Reseller, Rest, Submit, Token, Verification, Wallet
Defined in:
lib/bootpay.rb

Constant Summary collapse

API =
{
  development: 'https://dev-api.bootpay.co.kr/v2',
  stage:       'https://stage-api.bootpay.co.kr/v2',
  production:  'https://api.bootpay.co.kr/v2',
  ehowlsla:    'https://ehowlsla.bootpay.co.kr/api/v2'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production') ⇒ Api

Returns a new instance of Api.

Raises:

  • (ArgumentError)


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/bootpay.rb', line 50

def initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production')
  @application_id = application_id
  @private_key    = private_key
  @client_key     = client_key
  @secret_key     = secret_key
  @mode           = mode.presence || 'production'
  @token          = nil

  raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank?
  if @client_key.present?
    raise ArgumentError, 'secret_key 값이 비어있습니다.' if @secret_key.blank?
  elsif @application_id.blank? || @private_key.blank?
    raise ArgumentError, 'application_id/private_key 또는 client_key/secret_key를 입력해주세요.'
  end
end