Class: QiwiObserver::Payments
- Inherits:
-
Object
- Object
- QiwiObserver::Payments
- Defined in:
- lib/qiwi_observer/payments/payments.rb
Constant Summary collapse
- API_PATH =
"https://edge.qiwi.com/payment-history/v2/persons/".freeze
Instance Method Summary collapse
- #call(args = {}) ⇒ Object
-
#initialize ⇒ Payments
constructor
A new instance of Payments.
Constructor Details
#initialize ⇒ Payments
Returns a new instance of Payments.
5 6 7 8 9 10 |
# File 'lib/qiwi_observer/payments/payments.rb', line 5 def initialize @wallet = QiwiObserver.config.wallet @token = QiwiObserver.config.token raise ArgumentError, "Wallet and token must be configure" if @wallet.nil? && @token.nil? end |
Instance Method Details
#call(args = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/qiwi_observer/payments/payments.rb', line 12 def call(args = {}) uri = linkage(args) request = prepare_a_request(uri) http = connect_to(uri) response = http.request(request) return PaymentsResponse.new(success: true, body: response.body) if response.is_a?(Net::HTTPOK) return PaymentsResponse.new(success: false, body: [response.code, response.]) end |