1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
This commit is contained in:
Kevin Olbrich 2013-12-12 18:25:39 +00:00
parent fc8ec4e6e8
commit 955824d00c
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,14 @@
require 'fog/core/model'
module Fog
module Joyent
class Analytics
class Field < Fog::Model
attribute :name
attribute :label
attribute :type
end
end
end
end

View file

@ -0,0 +1,26 @@
require 'fog/joyent/models/analytics/field'
module Fog
module Joyent
class Analytics
class Fields < Fog::Collection
model Fog::Joyent::Analytics::Field
def all
data = service.describe_analytics.body['fields']
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 = {})
name, other_attributes = attributes
super(other_attributes.merge('name' => name))
end
end
end
end
end