Class: Rma::Payment::Gateway::Client
- Inherits:
-
Object
- Object
- Rma::Payment::Gateway::Client
- Defined in:
- lib/rma/payment/gateway/client.rb
Overview
Client class for RMA Payment Gateway. Handles all communication with the RMA Payment Gateway API.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#account_inquiry ⇒ Object
Account Inquiry methods.
-
#authorization ⇒ Object
Authorization methods.
-
#debit_request ⇒ Object
Debit Request methods.
- #get(headers: {}) ⇒ Object
-
#initialize(config = nil) ⇒ Client
constructor
A new instance of Client.
-
#post(body: {}, headers: {}) ⇒ Object
HTTP request methods.
- #private_key ⇒ Object
Constructor Details
#initialize(config = nil) ⇒ Client
Returns a new instance of Client.
23 24 25 26 |
# File 'lib/rma/payment/gateway/client.rb', line 23 def initialize(config = nil) @config = config || Rma::Payment::Gateway.configuration validate_configuration! end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
21 22 23 |
# File 'lib/rma/payment/gateway/client.rb', line 21 def access_token @access_token end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
21 22 23 |
# File 'lib/rma/payment/gateway/client.rb', line 21 def config @config end |
Instance Method Details
#account_inquiry ⇒ Object
Account Inquiry methods
38 39 40 |
# File 'lib/rma/payment/gateway/client.rb', line 38 def account_inquiry @account_inquiry ||= AccountInquiry.new(self) end |
#authorization ⇒ Object
Authorization methods
33 34 35 |
# File 'lib/rma/payment/gateway/client.rb', line 33 def @authorization ||= Authorization.new(self) end |
#debit_request ⇒ Object
Debit Request methods
43 44 45 |
# File 'lib/rma/payment/gateway/client.rb', line 43 def debit_request @debit_request ||= DebitRequest.new(self) end |
#get(headers: {}) ⇒ Object
53 54 55 |
# File 'lib/rma/payment/gateway/client.rb', line 53 def get(headers: {}) request(:get, headers: headers) end |
#post(body: {}, headers: {}) ⇒ Object
HTTP request methods
48 49 50 51 |
# File 'lib/rma/payment/gateway/client.rb', line 48 def post(body: {}, headers: {}) signed = body.empty? ? body : body.merge(bfs_checkSum: compute_checksum(body)) request(:post, body: signed, headers: headers) end |
#private_key ⇒ Object
28 29 30 |
# File 'lib/rma/payment/gateway/client.rb', line 28 def private_key @private_key ||= load_private_key end |