Sha256: b4f914d61cd543d2421bbfadd443c0ebb2a0c7644bddd4c2c87a01d8e4e2a13d
Contents?: true
Size: 1.04 KB
Versions: 33
Compression:
Stored size: 1.04 KB
Contents
require 'time' module Yao::Resources class Resource < Base friendly_attributes :user_id, :resource_id, :project_id, :last_sample_timestamp, :first_sample_timestamp, :metadata, :links def id resource_id end def tenant @tenant ||= Yao::User.get(project_id) end def user @user ||= Yao::User.get(user_id) end def last_sampled_at Time.parse last_sample_timestamp end def first_sampled_at Time.parse first_sample_timestamp end def get_meter(name) if link = links.find{|l| l["rel"] == name } Yao::Sample.list(link["href"]) end end def meters links.map{|l| l["rel"] }.delete_if{|n| n == 'self' } end self.service = "metering" self.api_version = "v2" self.resources_name = "resources" class << self private def resource_from_json(json) json end def resources_from_json(json) json end end end end
Version data entries
33 entries across 33 versions & 1 rubygems