Class: Sendly::ApiKey
- Inherits:
-
Object
- Object
- Sendly::ApiKey
- Defined in:
- lib/sendly/types.rb
Overview
Represents an API key
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_revoked ⇒ Object
readonly
Returns the value of attribute is_revoked.
-
#last_four ⇒ Object
readonly
Returns the value of attribute last_four.
-
#last_used_at ⇒ Object
readonly
Returns the value of attribute last_used_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data) ⇒ ApiKey
constructor
A new instance of ApiKey.
- #live? ⇒ Boolean
- #revoked? ⇒ Boolean
- #test? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ ApiKey
Returns a new instance of ApiKey.
469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/sendly/types.rb', line 469 def initialize(data) @id = data["id"] @name = data["name"] @type = data["type"] @prefix = data["prefix"] @last_four = data["last_four"] || data["lastFour"] @permissions = data["permissions"] || [] @created_at = parse_time(data["created_at"] || data["createdAt"]) @last_used_at = parse_time(data["last_used_at"] || data["lastUsedAt"]) @expires_at = parse_time(data["expires_at"] || data["expiresAt"]) @is_revoked = data["is_revoked"] || data["isRevoked"] || false end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def created_at @created_at end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def id @id end |
#is_revoked ⇒ Object (readonly)
Returns the value of attribute is_revoked.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def is_revoked @is_revoked end |
#last_four ⇒ Object (readonly)
Returns the value of attribute last_four.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def last_four @last_four end |
#last_used_at ⇒ Object (readonly)
Returns the value of attribute last_used_at.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def last_used_at @last_used_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def name @name end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def @permissions end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def prefix @prefix end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
466 467 468 |
# File 'lib/sendly/types.rb', line 466 def type @type end |
Instance Method Details
#live? ⇒ Boolean
486 487 488 |
# File 'lib/sendly/types.rb', line 486 def live? type == "live" end |
#revoked? ⇒ Boolean
490 491 492 |
# File 'lib/sendly/types.rb', line 490 def revoked? is_revoked end |
#test? ⇒ Boolean
482 483 484 |
# File 'lib/sendly/types.rb', line 482 def test? type == "test" end |