class RJMetricsClient
Public Class Methods
new(client_id, api_key, timeout_in_seconds = 10)
click to toggle source
Constructs a RJMetricsClient
instance if it receives valid arguments or will raise an ArgumentError.
@param client_id [Integer] your RJMetrics
Client ID @param api_key [String] your RJMetrics
API Key @param timeout_in_seconds [Integer] seconds to wait for API responses
# File lib/rjmetrics_client.rb, line 10 def initialize(client_id, api_key, timeout_in_seconds = 10) @client = RJMetrics::Client.new(client_id, api_key, timeout_in_seconds) if not authenticated? raise RJMetrics::Client::UnableToConnectException, "Connection failed. Please double check your credentials." end end
Public Instance Methods
authenticated?()
click to toggle source
Validates credentials by making a request to the RJMetrics
API Sandbox.
# File lib/rjmetrics_client.rb, line 19 def authenticated? return @client.authenticated? end
pushData(table_name, data, url = RJMetrics::Client::API_BASE)
click to toggle source
Sends data to RJMetrics
Data Import API.
@param table_name [String] the table name you wish to store the data @param data [Hashamp] or Array of Hashmaps of data points that will get sent @param url [String] Import API url @return [Array] results of each request to RJMetrics
Data Import API
# File lib/rjmetrics_client.rb, line 29 def pushData(table_name, data, url = RJMetrics::Client::API_BASE) @client.pushData(table_name, data, url) end