1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

describe analytics support

This commit is contained in:
Kevin Olbrich 2013-12-12 17:17:01 +00:00
parent 35964c89aa
commit 55d328b283
3 changed files with 44 additions and 0 deletions

View file

@ -6,7 +6,9 @@ module Fog
module Joyent
class Analytics
class JoyentModule < Fog::Model
attribute :name
attribute :label
end
end
end

View file

@ -0,0 +1,27 @@
require 'fog/joyent/models/analytics/joyent_module'
module Fog
module Joyent
class Analytics
class JoyentModules < Fog::Collection
model Fog::Joyent::Analytics::JoyentModule
def all
data = service.describe_analytics.body['modules']
load(data)
end
# Joyent returns an odd data structure like this:
# { 'apache' => {'label' => 'Apache'}}
# where the key is the name of the module
def new(attributes = {})
puts attributes.inspect
name, other_attributes = attributes
super(other_attributes.merge('name' => name))
end
end
end
end
end

View file

@ -0,0 +1,15 @@
module Fog
module Joyent
class Analytics
class Real
def describe_analytics
request(
:path => "#{@joyent_username}/analytics",
:method => "GET",
:expects => 200
)
end
end
end
end
end