Class: Bootpay::RestClient
- Inherits:
-
Object
- Object
- Bootpay::RestClient
- Includes:
- Concern
- Defined in:
- lib/bootpay/bootpay-rest-client.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 =
'5.3.0'
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#client_key ⇒ Object
Returns the value of attribute client_key.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#token ⇒ Object
Returns the value of attribute token.
-
#use_client_key ⇒ Object
Returns the value of attribute use_client_key.
Instance Method Summary collapse
-
#initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production') ⇒ RestClient
constructor
A new instance of RestClient.
-
#set_api_url(url) ⇒ Object
API URL을 변경 Comment by GOSOMI @date: 2023-05-26.
-
#set_api_version(version) ⇒ Object
API 버전을 설정한다 Comment by Gosomi Date: 2022-07-29.
Constructor Details
#initialize(application_id: nil, private_key: nil, client_key: nil, secret_key: nil, mode: 'production') ⇒ RestClient
Returns a new instance of RestClient.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 24 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 @use_client_key = client_key.present? @mode = mode.presence || 'production' @token = nil @api_version = SDK_VERSION raise ArgumentError, "개발환경 mode는 development, stage, production 중에서 선택이 가능합니다." if API[@mode.to_sym].blank? end |
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def api_version @api_version end |
#application_id ⇒ Object
Returns the value of attribute application_id.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def application_id @application_id end |
#client_key ⇒ Object
Returns the value of attribute client_key.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def client_key @client_key end |
#mode ⇒ Object
Returns the value of attribute mode.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def mode @mode end |
#private_key ⇒ Object
Returns the value of attribute private_key.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def private_key @private_key end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def secret_key @secret_key end |
#token ⇒ Object
Returns the value of attribute token.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def token @token end |
#use_client_key ⇒ Object
Returns the value of attribute use_client_key.
13 14 15 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 13 def use_client_key @use_client_key end |
Instance Method Details
#set_api_url(url) ⇒ Object
API URL을 변경 Comment by GOSOMI @date: 2023-05-26
39 40 41 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 39 def set_api_url(url) API[@mode.to_sym] = url end |
#set_api_version(version) ⇒ Object
API 버전을 설정한다 Comment by Gosomi Date: 2022-07-29
46 47 48 49 |
# File 'lib/bootpay/bootpay-rest-client.rb', line 46 def set_api_version(version) raise ArgumentError, 'API Version은 4.0.0 이상만 설정이 가능합니다.' if version < '4.0.0' @api_version = version end |