Class: Buckaruby::Request
- Inherits:
-
Object
- Object
- Buckaruby::Request
- Defined in:
- lib/buckaruby/request.rb
Overview
Base class for any request.
Direct Known Subclasses
CancelRequest, RefundInfoRequest, RefundTransactionRequest, StatusRequest, TransactionRequest, TransactionSpecificationRequest
Instance Method Summary collapse
-
#build_request_params(_options) ⇒ Object
Returns the request parameters (to be implemented by subclasses).
- #execute(options) ⇒ Object
-
#initialize(config) ⇒ Request
constructor
A new instance of Request.
-
#operation ⇒ Object
Returns the service operation for this request.
Constructor Details
#initialize(config) ⇒ Request
Returns a new instance of Request.
11 12 13 |
# File 'lib/buckaruby/request.rb', line 11 def initialize(config) @config = config end |
Instance Method Details
#build_request_params(_options) ⇒ Object
Returns the request parameters (to be implemented by subclasses).
28 29 30 |
# File 'lib/buckaruby/request.rb', line 28 def build_request_params() raise NotImplementedError end |
#execute(options) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/buckaruby/request.rb', line 15 def execute() uri = URI.parse(@config.api_url) uri.query = URI.encode_www_form(op: operation) if operation post_buckaroo(uri, build_request_data()) end |
#operation ⇒ Object
Returns the service operation for this request.
23 24 25 |
# File 'lib/buckaruby/request.rb', line 23 def operation nil end |