Class: PromisePay::Request
- Inherits:
-
Object
- Object
- PromisePay::Request
- Defined in:
- lib/promise_pay/request.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(options = {}) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 13 |
# File 'lib/promise_pay/request.rb', line 6 def initialize( = {}) @path = .fetch(:path) @user = .fetch(:user) { PromisePay.api_user } @password = .fetch(:password) { PromisePay.api_key } @method = .fetch(:method) { :get } @payload = .fetch(:payload) { nil } @request = build_request end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/promise_pay/request.rb', line 15 def execute begin response = request.execute rescue RestClient::Unauthorized => e raise UnauthorizedRequestError, e. rescue RestClient::BadRequest => e raise BadRequestError, e. end response end |