Sha256: 9f62f62b74172482932e727e4625690ee9427d7104ae3d8143ddf01f124195e3

Contents?: true

Size: 578 Bytes

Versions: 15

Compression:

Stored size: 578 Bytes

Contents

module Yao::Resources
  class Sample < Base
    friendly_attributes :id, :metadata, :meter,
                        :source, :type, :unit, :volume,
                        :resource_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 user
      @user ||= Yao::User.get(user_id)
    end

    self.service        = "metering"
    self.api_version    = "v2"
    self.resources_name = "samples"
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
yao-0.13.4 lib/yao/resources/sample.rb
yao-0.13.3 lib/yao/resources/sample.rb
yao-0.13.2 lib/yao/resources/sample.rb
yao-0.13.1 lib/yao/resources/sample.rb
yao-0.13.0 lib/yao/resources/sample.rb
yao-0.12.0 lib/yao/resources/sample.rb
yao-0.11.3 lib/yao/resources/sample.rb
yao-0.11.2 lib/yao/resources/sample.rb
yao-0.11.1 lib/yao/resources/sample.rb
yao-0.11.0 lib/yao/resources/sample.rb
yao-0.10.1 lib/yao/resources/sample.rb
yao-0.10.0 lib/yao/resources/sample.rb
yao-0.9.1 lib/yao/resources/sample.rb
yao-0.9.0 lib/yao/resources/sample.rb
yao-0.8.0 lib/yao/resources/sample.rb