Class: Ruqqus::Badge
- Inherits:
-
Object
- Object
- Ruqqus::Badge
- Defined in:
- lib/ruqqus/types/badge.rb
Overview
Describes a trophy that can be earned/issued to an account for specific accomplishments.
Instance Attribute Summary collapse
-
#created ⇒ Time?
readonly
The time the badge was earned, or
nil
if not defined. -
#created_utc ⇒ Integer?
readonly
The time the badge was earned in seconds since the Unix epoch, or
0
if not defined. -
#name ⇒ String?
readonly
The name of the badge.
-
#text ⇒ String?
readonly
A brief description of the badge.
-
#url ⇒ String?
readonly
The URL associated with the badge, or
nil
if not defined.
Instance Method Summary collapse
-
#initialize(data) ⇒ Badge
constructor
Creates a new instance of the Badge class.
-
#to_s ⇒ String
The string representation of the object.
Constructor Details
#initialize(data) ⇒ Badge
Creates a new instance of the Ruqqus::Badge class.
30 31 32 |
# File 'lib/ruqqus/types/badge.rb', line 30 def initialize(data) @data = data || raise(ArgumentError, 'data cannot be nil') end |
Instance Attribute Details
#created ⇒ Time? (readonly)
Returns the time the badge was earned, or nil
if not defined.
|
# File 'lib/ruqqus/types/badge.rb', line 22
|
#created_utc ⇒ Integer? (readonly)
Returns the time the badge was earned in seconds since the Unix epoch, or 0
if not defined.
|
# File 'lib/ruqqus/types/badge.rb', line 18
|
#name ⇒ String? (readonly)
Returns the name of the badge.
|
# File 'lib/ruqqus/types/badge.rb', line 6
|
#text ⇒ String? (readonly)
Returns a brief description of the badge.
|
# File 'lib/ruqqus/types/badge.rb', line 10
|
#url ⇒ String? (readonly)
Returns the URL associated with the badge, or nil
if not defined.
|
# File 'lib/ruqqus/types/badge.rb', line 14
|
Instance Method Details
#to_s ⇒ String
Returns the string representation of the object.
57 58 59 |
# File 'lib/ruqqus/types/badge.rb', line 57 def to_s @data[:text] || inspect end |