Cloud Counter API - Ruby Gem

Counter is a simple tool for incrementing, decrementing, and resetting a cloud counter. It returns the current value of the counter.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_counter'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_counter

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_counter'

# Initialize the client
client = APIVerve::Counter::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ id: "test_counter" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ id: "test_counter" })
  puts response["data"]
rescue APIVerve::Counter::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Counter::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Counter::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "created": "2024-04-26T22:09:46.000Z",
    "id": "test_counter",
    "lastAction": "get",
    "lastRead": "2025-12-16T22:21:45.000Z",
    "lastUpdated": "2024-04-26T22:09:46.000Z",
    "numberOfDigits": 1,
    "ordinal": "zeroth",
    "value": 0,
    "words": "zero",
    "isEven": true,
    "isNegative": false,
    "isZero": true,
    "isPrime": false
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.