Sha256: d4366d2f0c7443fa5aceb8b76e92dea63f416e6e4cc6bbba7259770016b9089e

Contents?: true

Size: 777 Bytes

Versions: 12

Compression:

Stored size: 777 Bytes

Contents

module Yao::Resources
  class Meter < Base

    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 user
      @user ||= Yao::User.get(user_id)
    end

    self.service        = "metering"
    self.api_version    = "v2"
    self.resources_name = "meters"

    class << self
      private
      def resource_from_json(json)
        new(json)
      end

      # override Yao::Resources::RestfullyAccessible.resources_from_json
      # @param [Array]
      # @return [Array<Yao::Resources::Meter>]
      def resources_from_json(json)
        json.map{|d| new(d)}
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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