mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fields
This commit is contained in:
parent
fc8ec4e6e8
commit
955824d00c
2 changed files with 40 additions and 0 deletions
|
@ -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
|
|
@ -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
|
Loading…
Reference in a new issue