Sha256: e9f821658b187c3801691eaee271d6af39bc3ffb4d48b56472d36444be203d9a

Contents?: true

Size: 806 Bytes

Versions: 25

Compression:

Stored size: 806 Bytes

Contents

module Hawkular
  module Metrics
    class BaseObject
      attr_reader :json
      attr_accessor :id

      def initialize(json)
        @json = json
        @id = @json['id'] unless json.nil?
      end
    end

    class Tenant < BaseObject
    end

    class MetricDefinition < BaseObject
      attr_accessor :tenant_id, :data_retention, :tags

      def initialize(json = nil)
        super(json)
        unless json.nil? # rubocop:disable Style/GuardClause
          @tenant_id = @json['tenantId']
          @data_retention = @json['dataRetention']
          @tags = @json['tags']
        end
      end

      def hash
        h = { id: @id, tenantId: @tenant_id,
              dataRetention: @data_retention, tags: @tags }
        h.delete_if { |_k, v| v.nil? }
        h
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hawkular-client-0.2.2 lib/metrics/types.rb
hawkular-client-0.2.1 lib/metrics/types.rb
hawkular-client-0.2.0 lib/metrics/types.rb
hawkular-client-0.1.2 lib/metrics/types.rb
hawkular-client-0.1.1 lib/metrics/types.rb