Class: Rubord::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/rubord/models/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, client) ⇒ Application

Returns a new instance of Application.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubord/models/application.rb', line 9

def initialize(data, client)
  @client      = client
  @id          = data["id"]
  @name        = data["name"]
  @icon        = data["icon"]
  @description = data["description"]

  @owner = Rubord::User.new(data["owner"])
  client.users.set(@owner.id, @owner)

  @emojis = []
  fetched_emojis = client.rest.get_application_emojis(@id)["items"] || []
  fetched_emojis.each do |emoji_data|
    @emojis << Rubord::Emoji.new(emoji_data, client)
  end
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def description
  @description
end

#emojisObject (readonly)

Returns the value of attribute emojis.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def emojis
  @emojis
end

#iconObject (readonly)

Returns the value of attribute icon.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def icon
  @icon
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



3
4
5
# File 'lib/rubord/models/application.rb', line 3

def owner
  @owner
end

Instance Method Details

#inspectObject



26
27
28
# File 'lib/rubord/models/application.rb', line 26

def inspect
  "#<Rubord::Application id=#{@id}"
end