Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename report command into metric

  • Loading branch information...
commit 9554aff90f23efdd8b09026ac4cb2b5a28ba3b5c 1 parent 9847e92
@yacc authored
View
2  lib/stripemetrics/cli/commands.rb
@@ -3,4 +3,4 @@
require 'stripemetrics/cli/commands/ping.rb'
require 'stripemetrics/cli/commands/import.rb'
require 'stripemetrics/cli/commands/refresh.rb'
-require 'stripemetrics/cli/commands/report.rb'
+require 'stripemetrics/cli/commands/metric.rb'
View
8 lib/stripemetrics/cli/commands/report.rb → lib/stripemetrics/cli/commands/metric.rb
@@ -1,16 +1,16 @@
-desc 'Generate report(s)'
+desc 'Generate Metric Report(s)'
arg_name 'metric1, metrics2[,metric3]*'
long_desc <<-EOS
- Generates a report from your StripeMetrics data. The reports include all the metrics by default.\n
+ Generates a report from your StripeMetrics data. The reports include no metrics by default. Use the '-a' switch to include all the metrics. \n
The report is an ascii table that shows the metrics and compares it to last month, then explicitly calculates the monthly change, the trailing six month average and finally compares the metric to the goal best communicates the state of that metric
ex: bundle exec ./bin/stripemetrics-cli report churn charges
EOS
-command :report do |c|
+command :metric do |c|
c.switch [:a,:all]
c.action do |global_options,options,args|
begin
say("<%= color('Gathering data from StripeMetrics ....', :yellow) %>")
- metrics = @client.get_metrics
+ metrics = @client.get_data
token = @client.print metrics, options, args
say("<%= color('(*) TSM Average column is the Trailing Six Month Compound Growth Rate', :blue) %>")
rescue Stripemetrics::Client::AuthError
View
4 lib/stripemetrics/client.rb
@@ -5,7 +5,7 @@
require 'stripemetrics/client/info'
require 'stripemetrics/client/import'
require 'stripemetrics/client/refresh'
-require 'stripemetrics/client/report'
+require 'stripemetrics/client/metric'
require 'command_line_reporter'
module Stripemetrics
@@ -25,7 +25,7 @@ def initialize(options={})
include Info
include Import
include Refresh
- include Report
+ include Metric
end
end
View
4 lib/stripemetrics/client/report.rb → lib/stripemetrics/client/metric.rb
@@ -1,8 +1,8 @@
module Stripemetrics
class Client
- module Report
+ module Metric
- def get_metrics
+ def get_data
response = get('/v1/metrics', :require_auth => true)
raise TargetError if response.status == 404
raise AuthError if response.status == 401
Please sign in to comment.
Something went wrong with that request. Please try again.