Class: DeepL::Resources::Usage

Inherits:
Base
  • Object
show all
Defined in:
lib/deepl/resources/usage.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#request, #response

Instance Method Summary collapse

Constructor Details

#initialize(character_count, character_limit, *args) ⇒ Usage

Returns a new instance of Usage.



6
7
8
9
10
11
# File 'lib/deepl/resources/usage.rb', line 6

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

  @character_count = character_count
  @character_limit = character_limit
end

Instance Attribute Details

#character_countObject (readonly)

Returns the value of attribute character_count.



4
5
6
# File 'lib/deepl/resources/usage.rb', line 4

def character_count
  @character_count
end

#character_limitObject (readonly)

Returns the value of attribute character_limit.



4
5
6
# File 'lib/deepl/resources/usage.rb', line 4

def character_limit
  @character_limit
end

Instance Method Details

#quota_exceeded?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/deepl/resources/usage.rb', line 17

def quota_exceeded?
  character_count >= character_limit
end

#to_sObject



13
14
15
# File 'lib/deepl/resources/usage.rb', line 13

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