Sha256: 1339888d181529b99d3224350fe65e9b2bebdca175d2f01cc487853286170b8c
Contents?: true
Size: 904 Bytes
Versions: 3
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true require 'nexmo' module OkComputer class NexmoCheck < Check AccountError = Class.new(StandardError) attr_accessor :client def initialize(client: nil, api_key: nil, api_secret: nil, signature_secret: nil) client ||= Nexmo::Client.new( api_key: api_key, api_secret: api_secret, signature_secret: signature_secret ) self.client = client end # Public: Return the status of the Account Balance check def check response = perform_request return mark_failure unless response.http_response.code.to_i == 200 mark_message("Balance #{response.value} check successful") rescue StandardError => e mark_message("Error: '#{e}'") mark_failure end def perform_request client.account.balance rescue StandardError => e raise(AccountError, e) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
okcomputer-checks-1.1.1 | lib/ok_computer/checks/nexmo_check.rb |
okcomputer-checks-1.1.0 | lib/ok_computer/checks/nexmo_check.rb |
okcomputer-checks-1.0.0 | lib/ok_computer/checks/nexmo_check.rb |