Class: ClashOfClansApi::Models::Token

Inherits:
Base
  • Object
show all
Defined in:
lib/clash_of_clans_api/models/token.rb

Instance Method Summary collapse

Methods inherited from Base

#[], #cache_property, property, #property_cached?, #property_from_cache, #to_h, #validate!

Constructor Details

#initialize(hash, token_client:) ⇒ Token

Returns a new instance of Token.



17
18
19
20
21
# File 'lib/clash_of_clans_api/models/token.rb', line 17

def initialize(hash, token_client:)
  super(hash)
  
  @token_client = token_client
end

Instance Method Details

#client_from_tokenObject



27
28
29
# File 'lib/clash_of_clans_api/models/token.rb', line 27

def client_from_token
  ClashOfClansApi::Client.new(self.key)
end

#revokeObject



23
24
25
# File 'lib/clash_of_clans_api/models/token.rb', line 23

def revoke
  @token_client.revoke_api_key(self.id)
end