Class: QiwiObserver::WebhookSecretKey
- Inherits:
-
Object
- Object
- QiwiObserver::WebhookSecretKey
- Defined in:
- lib/qiwi_observer/webhook/webhook_secret_key.rb
Constant Summary collapse
- API_PATH =
def initialize(hook_id) raise ArgumentError, "Hook id must be set" unless hook_id @hook_id = hook_id @token = QiwiObserver.config.token @api_path = "https://edge.qiwi.com/payment-notifier/v1/hooks/#{hook_id}/key" end
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/qiwi_observer/webhook/webhook_secret_key.rb', line 15 def call uri = URI(@api_path) request = prepare_a_request(uri) http = connect_to_api(uri) response = http.request(request) return WebhookResponse.new(success: true, body: response.body) if response.is_a?(Net::HTTPOK) return WebhookResponse.new(success: false, body: [response.code, response.]) end |