Class: BootpayStorage::RestClient

Inherits:
Object
  • Object
show all
Includes:
Concern
Defined in:
lib/bootpay_storage/bootpay-storage-rest-client.rb

Constant Summary collapse

API =
{
  development: 'https://dev-s.bootapi.com/api/v1',
  stage:       'https://stage-s.bootapi.com/api/v1',
  production:  'https://s.bootapi.com/api/v1',
}
SDK_VERSION =
'5.0.0'

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of RestClient.

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
# File 'lib/bootpay_storage/bootpay-storage-rest-client.rb', line 22

def initialize(server_key:, private_key:, mode: 'production')
  @server_key     = server_key
  @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_storage/bootpay-storage-rest-client.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_storage/bootpay-storage-rest-client.rb', line 41

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