Class: Verifalia::Credits::Client
- Inherits:
-
Object
- Object
- Verifalia::Credits::Client
- Defined in:
- lib/verifalia/credits/client.rb
Overview
Manages credit packs, daily free credits and usage consumption for the Verifalia account.
Instance Method Summary collapse
-
#get_balance ⇒ Verifalia::Credits::Balance
Returns the current credits balance for the Verifalia account.
-
#initialize(rest_client) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(rest_client) ⇒ Client
Returns a new instance of Client.
38 39 40 |
# File 'lib/verifalia/credits/client.rb', line 38 def initialize(rest_client) @rest_client = rest_client end |
Instance Method Details
#get_balance ⇒ Verifalia::Credits::Balance
Returns the current credits balance for the Verifalia account.
44 45 46 47 48 49 50 51 |
# File 'lib/verifalia/credits/client.rb', line 44 def get_balance response = @rest_client.invoke 'get', 'credits/balance' return Balance.from_json(JSON.parse(response.body)) if response.status == 200 raise "Unexpected HTTP response: #{response.status} #{response.body}" end |