TDMetrics
Ruby gem to send metrics to TDMetrics.
Installation
Add this line to your application's Gemfile:
gem 'tdev_metrics'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tdev_metrics
Usage
require 'tdev_metrics'
td_metrics = TotenDev::Metrics.new do |c|
c.username = 'username'
c.password = 'password'
c.base_url = 'http://example.com'
end
# Project Management
# create a new project
td_metrics.project.create 'MyNewProject'
# Update a project
td_metrics.project.update <PROJECT_ID>, 'NewProjectName'
# Delete a project
td_metrics.project.delete <PROJECT_ID>
# List all projects
td_metrics.project.list
# List one project
td_metrics.project.list <PROJECT_ID>
# Metrics Management
# Create a new metric
# from hash:
metric_hash = {
'metric' => 'my metric',
'project' => 1,
'place' => 'my place',
'type' => 'my type',
'info' => 'my info',
'timestamp' => 1356145931
}
metric = TotenDev::Metric.new metric_hash
# you can also set values from attributes
# ie:
metric.timestamp = Time.new.getutc.to_i
# send values to server:
td_metrics.metric.create metric
# Update a metric
td_metrics.metric.update <METRIC_ID>, metric
# Delete a metric
td_metrics.metric.delete <METRIC_ID>
# List all metrics
td_metrics.metric.list
# you can also set some params for the response:
td_metrics.metric.list :all, { :limit => 10, :order => 'desc' }
# or list one metric only:
td_metrics.metric.list <METRIC_ID>
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request