Class: DeepL::Resources::DeveloperKey
- Defined in:
- lib/deepl/resources/developer_key.rb
Overview
A developer key. label and usage_limits are nil when the response does not contain
them.
Instance Attribute Summary collapse
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#deactivated_time ⇒ Object
readonly
Returns the value of attribute deactivated_time.
-
#is_deactivated ⇒ Object
readonly
Returns the value of attribute is_deactivated.
-
#key_id ⇒ Object
readonly
Returns the value of attribute key_id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#usage_limits ⇒ Object
readonly
Returns the value of attribute usage_limits.
Attributes inherited from Base
Instance Method Summary collapse
- #deactivated? ⇒ Boolean
-
#initialize(developer_key, *args) ⇒ DeveloperKey
constructor
A new instance of DeveloperKey.
- #to_s ⇒ Object
Constructor Details
#initialize(developer_key, *args) ⇒ DeveloperKey
Returns a new instance of DeveloperKey.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/deepl/resources/developer_key.rb', line 30 def initialize(developer_key, *args) super(*args) developer_key = {} unless developer_key.is_a?(Hash) @key_id = developer_key['key_id'].is_a?(String) ? developer_key['key_id'] : '' @label = developer_key['label'].is_a?(String) ? developer_key['label'] : nil @creation_time = Utils::TimeParser.parse_optional_utc_time(developer_key['creation_time']) @deactivated_time = Utils::TimeParser.parse_optional_utc_time(developer_key['deactivated_time']) @is_deactivated = developer_key['is_deactivated'] == true @usage_limits = parse_usage_limits(developer_key['usage_limits']) end |
Instance Attribute Details
#creation_time ⇒ Object (readonly)
Returns the value of attribute creation_time.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def creation_time @creation_time end |
#deactivated_time ⇒ Object (readonly)
Returns the value of attribute deactivated_time.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def deactivated_time @deactivated_time end |
#is_deactivated ⇒ Object (readonly)
Returns the value of attribute is_deactivated.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def is_deactivated @is_deactivated end |
#key_id ⇒ Object (readonly)
Returns the value of attribute key_id.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def key_id @key_id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def label @label end |
#usage_limits ⇒ Object (readonly)
Returns the value of attribute usage_limits.
27 28 29 |
# File 'lib/deepl/resources/developer_key.rb', line 27 def usage_limits @usage_limits end |
Instance Method Details
#deactivated? ⇒ Boolean
42 43 44 |
# File 'lib/deepl/resources/developer_key.rb', line 42 def deactivated? is_deactivated end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/deepl/resources/developer_key.rb', line 46 def to_s label.nil? ? key_id : "#{label} (#{key_id})" end |