Class: DkPaymentGateway::Client
- Inherits:
-
Object
- Object
- DkPaymentGateway::Client
- Defined in:
- lib/dk_payment_gateway/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
Instance Method Summary collapse
-
#authenticate! ⇒ Object
Authentication methods.
- #get(path, params: {}, headers: {}, skip_auth: false) ⇒ Object
-
#initialize(config = nil) ⇒ Client
constructor
A new instance of Client.
-
#intra_transaction ⇒ Object
Intra Transaction methods.
-
#post(path, body: {}, headers: {}, skip_auth: false) ⇒ Object
HTTP request methods.
-
#pull_payment ⇒ Object
Pull Payment methods.
-
#qr_payment ⇒ Object
QR Payment methods.
-
#transaction_status ⇒ Object
Transaction Status methods.
Constructor Details
#initialize(config = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/dk_payment_gateway/client.rb', line 10 def initialize(config = nil) @config = config || DkPaymentGateway.configuration validate_configuration! @access_token = nil @private_key = nil end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
8 9 10 |
# File 'lib/dk_payment_gateway/client.rb', line 8 def access_token @access_token end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/dk_payment_gateway/client.rb', line 8 def config @config end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
8 9 10 |
# File 'lib/dk_payment_gateway/client.rb', line 8 def private_key @private_key end |
Instance Method Details
#authenticate! ⇒ Object
Authentication methods
18 19 20 21 22 23 |
# File 'lib/dk_payment_gateway/client.rb', line 18 def authenticate! auth = Authentication.new(self) @access_token ||= auth.fetch_token @private_key ||= auth.fetch_private_key self end |
#get(path, params: {}, headers: {}, skip_auth: false) ⇒ Object
50 51 52 |
# File 'lib/dk_payment_gateway/client.rb', line 50 def get(path, params: {}, headers: {}, skip_auth: false) request(:get, path, params: params, headers: headers, skip_auth: skip_auth) end |
#intra_transaction ⇒ Object
Intra Transaction methods
31 32 33 |
# File 'lib/dk_payment_gateway/client.rb', line 31 def intra_transaction @intra_transaction ||= IntraTransaction.new(self) end |
#post(path, body: {}, headers: {}, skip_auth: false) ⇒ Object
HTTP request methods
46 47 48 |
# File 'lib/dk_payment_gateway/client.rb', line 46 def post(path, body: {}, headers: {}, skip_auth: false) request(:post, path, body: body, headers: headers, skip_auth: skip_auth) end |
#pull_payment ⇒ Object
Pull Payment methods
26 27 28 |
# File 'lib/dk_payment_gateway/client.rb', line 26 def pull_payment @pull_payment ||= PullPayment.new(self) end |
#qr_payment ⇒ Object
QR Payment methods
36 37 38 |
# File 'lib/dk_payment_gateway/client.rb', line 36 def qr_payment @qr_payment ||= QrPayment.new(self) end |
#transaction_status ⇒ Object
Transaction Status methods
41 42 43 |
# File 'lib/dk_payment_gateway/client.rb', line 41 def transaction_status @transaction_status ||= TransactionStatus.new(self) end |