Skip to content

Commit

Permalink
Wow, I was calling the wrong endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
cp committed Dec 27, 2013
1 parent 6f3db4d commit 67f29ec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cloudability/client/usage_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module UsageReports
# @see http://developers.cloudability.com/resources/usage/
# @return [Array] array of Hashie::Mashes
def usage_reports
request = get '/1/reporting/usage'
request = get '/1/reporting'
convert_to_mashes request
end

Expand Down
4 changes: 2 additions & 2 deletions spec/cloduability/usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

describe '#usage_reports' do
it 'should be an array' do
stub_get('/1/reporting/usage?auth_token=token', 'usage/reports')
stub_get('/1/reporting?auth_token=token', 'usage/reports')
@client.usage_reports.should be_kind_of Array
end

it 'should be an array of Hashie::Mashes' do
stub_get('/1/reporting/usage?auth_token=token', 'usage/reports')
stub_get('/1/reporting?auth_token=token', 'usage/reports')
@client.usage_reports.each{|report| report.should be_kind_of Hashie::Mash }
end
end
Expand Down
18 changes: 18 additions & 0 deletions spec/fixtures/usage/reports
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
HTTP/1.1 200 OK
Server: nginx/1.4.4
Date: Fri, 27 Dec 2013 05:31:15 GMT
Content-Type: application/json
Content-Length: 44476
Connection: keep-alive
Status: 200 OK
Strict-Transport-Security: max-age=31536000
Set-Cookie: _mkra_ctxt=1f0f9e994c1eda7c8aaca1c638e169e7--200; path=/; secure
X-UA-Compatible: IE=Edge,chrome=1
ETag: "575c428e918fe64a860eaf6e6cc8ba2e"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 9534fd1ae2484ed36a74011e9f5816e4
X-Runtime: 1.713328
X-Rack-Cache: miss
Origin: app.cloudability.com

[{"id":2,"category":"Utilization","title":"Longest Running","description":null,"end_date":"today","start_date":"last week","end_date_is_relative":true,"start_date_is_relative":true,"owned_by_user":false,"shared":false,"custom":false,"metrics":[{"type":"metric","name":"hours_since_launch","label":"Hours Since Launch","description":"Hours since instance launch","data_type":"float","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"time","name":"Time"}},{"type":"metric","name":"utilization_hours","label":"Utilization Hours","description":"Utilization hours","data_type":"integer","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"usage","name":"Usage"}},{"type":"metric","name":"avg_estimated_hourly_cost","label":"Avg Estimated Hourly Instance Cost","description":"Average estimated hourly cost","data_type":"currency","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"billing","name":"Billing"}}],"dimensions":[{"type":"dimension","name":"instance_identifier","label":"Instance ID","description":"Instance ID","data_type":"string","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"common","name":"Common"}},{"type":"dimension","name":"instance_size","label":"Size","description":"Size of the Instance","data_type":"string","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"common","name":"Common"}}],"filters":[],"report_dimension_links":[]},{"id":3,"category":"Utilization","title":"Instance Aging","description":null,"end_date":"today","start_date":"last week","end_date_is_relative":true,"start_date_is_relative":true,"owned_by_user":false,"shared":false,"custom":false,"metrics":[{"type":"metric","name":"terminated_instances","label":"Terminated Instances","description":"Number of terminated instances","data_type":"integer","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"usage","name":"Usage"}},{"type":"metric","name":"running_instances","label":"Running Instances","description":"Number of running instances","data_type":"integer","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"usage","name":"Usage"}}],"dimensions":[{"type":"dimension","name":"days_since_launch","label":"Days Alive","description":"Days since instance was launched","data_type":"integer","group":{"key":"compute","name":"Compute"},"sub_group":{"key":"usage","name":"Usage"}}],"filters":[],"report_dimension_links":[]}]

0 comments on commit 67f29ec

Please sign in to comment.