Sha256: 46926b2fb7af05964c199f7f573aa35f1b717c85e9c602fcd3395a509a40e66d

Contents?: true

Size: 659 Bytes

Versions: 24

Compression:

Stored size: 659 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

24 entries across 24 versions & 1 rubygems

Version Path
yao-0.7.0 lib/yao/resources/sample.rb
yao-0.6.3 lib/yao/resources/sample.rb
yao-0.6.2 lib/yao/resources/sample.rb
yao-0.6.1 lib/yao/resources/sample.rb
yao-0.6.0 lib/yao/resources/sample.rb
yao-0.5.0 lib/yao/resources/sample.rb
yao-0.4.3 lib/yao/resources/sample.rb
yao-0.4.2 lib/yao/resources/sample.rb
yao-0.4.1 lib/yao/resources/sample.rb
yao-0.4.0 lib/yao/resources/sample.rb
yao-0.3.8 lib/yao/resources/sample.rb
yao-0.3.7 lib/yao/resources/sample.rb
yao-0.3.6 lib/yao/resources/sample.rb
yao-0.3.5 lib/yao/resources/sample.rb
yao-0.3.4 lib/yao/resources/sample.rb
yao-0.3.3 lib/yao/resources/sample.rb
yao-0.3.2 lib/yao/resources/sample.rb
yao-0.3.1 lib/yao/resources/sample.rb
yao-0.3.0 lib/yao/resources/sample.rb
yao-0.2.13 lib/yao/resources/sample.rb