Sha256: 3c120aa8872327560bbc8536aa5ed89f7ff8896df41de072e525148ec043ed49

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

# Copyright 2018 Daniel Herzog
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE.md file.
# frozen_string_literal: true

module DeepL
  module Resources
    class Usage < Base
      attr_reader :character_count, :character_limit

      def initialize(character_count, character_limit, *args)
        super(*args)

        @character_count = character_count
        @character_limit = character_limit
      end

      def to_s
        "#{character_count} / #{character_limit}"
      end

      def quota_exceeded?
        character_count >= character_limit
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deepl-rb-3.1.0 lib/deepl/resources/usage.rb
deepl-rb-3.0.2 lib/deepl/resources/usage.rb
deepl-rb-3.0.1 lib/deepl/resources/usage.rb
deepl-rb-3.0.0 lib/deepl/resources/usage.rb