Sha256: c10bcda168ba8dbba2f1157747d77f2f37ee2c5702a933b5aea0ab9fd7ea238c

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

module Yao::Resources
  class Sample < Base
    friendly_attributes :id, :metadata, :meter,
                        :source, :type, :unit, :volume
                        :resouce_id, :tenant_id, :user_id

    def recorded_at
      Time.parse(self["recorded_at"])
    end

    def timestamp
      Time.parse(self["timestamp"])
    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"
    self.api_version    = "v2"
    self.resources_name = "samples"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yao-0.2.8 lib/yao/resources/sample.rb
yao-0.2.7 lib/yao/resources/sample.rb
yao-0.2.6 lib/yao/resources/sample.rb
yao-0.2.5 lib/yao/resources/sample.rb
yao-0.2.4 lib/yao/resources/sample.rb