Ruby Sample Code

require 'rest_client'
require 'json'

# Replace with your API Key
API_KEY = ''

# Request a list of companies
response = RestClient.get 'https://api.callrail.com/v1/companies.json', :authorization => "Token token=\"#{API_KEY}\""

# Parse the json response
data = JSON.parse(response.body)

# Examine meta data from the response
total_entries = data['total_entries']
puts "Total entries: #{total_entries}"

# Access the array of companies
companies = data['companies']

# Loop through companies
companies.each do |company|
  puts "Company: #{company['name']}"
end