Class: Bootpay::RestClient

Inherits:
Object
  • Object
show all
Includes:
Concern
Defined in:
lib/bootpay-backend-ruby.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'
}
SDK_VERSION =
'4.2.1'

Instance Method Summary collapse

Constructor Details

#initialize(application_id:, private_key:, mode: 'production') ⇒ RestClient

Returns a new instance of RestClient.

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
# File 'lib/bootpay-backend-ruby.rb', line 22

def initialize(application_id:, private_key:, mode: 'production')
  @application_id = application_id
  @private_key    = private_key
  @mode           = mode.presence || 'production'
  @token          = nil
  @api_version    = SDK_VERSION
  raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank?
end

Instance Method Details

#set_api_url(url) ⇒ Object

API URL을 변경Comment by GOSOMI @date: 2023-05-26



34
35
36
# File 'lib/bootpay-backend-ruby.rb', line 34

def set_api_url(url)
  API[@mode.to_sym] = url
end

#set_api_version(version) ⇒ Object

API 버전을 설정한다Comment by Gosomi Date: 2022-07-29

Raises:

  • (ArgumentError)


41
42
43
44
# File 'lib/bootpay-backend-ruby.rb', line 41

def set_api_version(version)
  raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0'
  @api_version = version
end