Class: Discorb::Activity
- Inherits:
-
Object
- Object
- Discorb::Activity
- Defined in:
- lib/discorb/gateway_requests.rb
Overview
Represents an activity for Gateway Command.
Instance Method Summary collapse
-
#initialize(name, type = :playing, url = nil) ⇒ Activity
constructor
Initializes a new Activity.
- #inspect ⇒ Object
-
#to_hash ⇒ Hash
Converts the activity to a hash.
Constructor Details
#initialize(name, type = :playing, url = nil) ⇒ Activity
Initializes a new Activity.
25 26 27 28 29 30 |
# File 'lib/discorb/gateway_requests.rb', line 25 def initialize(name, type = :playing, url = nil) @name = name @type = TYPES[type] or raise ArgumentError, "Invalid activity type: #{type}" @url = url end |
Instance Method Details
#inspect ⇒ Object
41 42 43 |
# File 'lib/discorb/gateway_requests.rb', line 41 def inspect "#<#{self.class} @type=#{@type}>" end |
#to_hash ⇒ Hash
Converts the activity to a hash.
37 38 39 |
# File 'lib/discorb/gateway_requests.rb', line 37 def to_hash { name: @name, type: @type, url: @url } end |