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.



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

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.



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

def character_count
  @character_count
end

#character_limitObject (readonly)

Returns the value of attribute character_limit.



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

def character_limit
  @character_limit
end

Instance Method Details

#quota_exceeded?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/deepl/resources/usage.rb', line 22

def quota_exceeded?
  character_count >= character_limit
end

#to_sObject



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

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