Class: TridentAssistant::CLI::Base

Inherits:
Thor
  • Object
show all
Defined in:
lib/trident_assistant/cli/base.rb

Overview

Base class of CLI

Direct Known Subclasses

Collectible, Collection, Command, Metadata, NFO, Order, Utils

Constant Summary collapse

UI =
::CLI::UI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/trident_assistant/cli/base.rb', line 14

def initialize(*args)
  super

  endpoint = options[:endpoint] || "https://thetrident.one"

  @api =
    begin
      TridentAssistant::API.new(
        endpoint: endpoint,
        keystore: options[:keystore]
      )
    rescue JSON::ParserError
      log UI.fmt("{{x}} falied to parse keystore.json: #{options[:keystore]}")
    rescue StandardError => e
      log UI.fmt "{{x}} Failed to initialize Mixin bot, maybe your keystore is incorrect. #{e.inspect}"
    end
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



12
13
14
# File 'lib/trident_assistant/cli/base.rb', line 12

def api
  @api
end

#botObject (readonly)

Returns the value of attribute bot.



12
13
14
# File 'lib/trident_assistant/cli/base.rb', line 12

def bot
  @bot
end

#clientObject (readonly)

Returns the value of attribute client.



12
13
14
# File 'lib/trident_assistant/cli/base.rb', line 12

def client
  @client
end

#keystoreObject (readonly)

Returns the value of attribute keystore.



12
13
14
# File 'lib/trident_assistant/cli/base.rb', line 12

def keystore
  @keystore
end