lib/yao/resources/meter.rb in yao-0.7.0 vs lib/yao/resources/meter.rb in yao-0.8.0
- old
+ new
@@ -1,21 +1,20 @@
module Yao::Resources
class Meter < Base
- friendly_attributes :meter_id, :name, :user_id, :resource_id, :project_id, :source, :type, :unit
+ include TenantAssociationable
+
+ friendly_attributes :meter_id, :name, :user_id, :resource_id, :source, :type, :unit
+
def id
meter_id
end
def resource
@resource ||= Yao::Resource.get(resource_id)
end
- def tenant
- @tenant ||= Yao::Tenant.get(project_id)
- end
-
def user
@user ||= Yao::User.get(user_id)
end
self.service = "metering"
@@ -23,14 +22,14 @@
self.resources_name = "meters"
class << self
private
def resource_from_json(json)
- json
+ new(json)
end
def resources_from_json(json)
- json
+ new(json)
end
end
end
end