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:
parent
35964c89aa
commit
55d328b283
3 changed files with 44 additions and 0 deletions
|
@ -6,7 +6,9 @@ module Fog
|
|||
module Joyent
|
||||
class Analytics
|
||||
class JoyentModule < Fog::Model
|
||||
attribute :name
|
||||
attribute :label
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Add table
Reference in a new issue