Class: ClashOfClansApi::Api

Inherits:
Object
  • Object
show all
Includes:
ApiFrame::EndpointMethods
Defined in:
lib/clash_of_clans_api/api.rb

Constant Summary collapse

BASE_URI =
URI('https://api.clashofclans.com/v1/')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token) ⇒ Api

Returns a new instance of Api.



17
18
19
# File 'lib/clash_of_clans_api/api.rb', line 17

def initialize(api_token)
	@api_token = api_token
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



15
16
17
# File 'lib/clash_of_clans_api/api.rb', line 15

def api_token
  @api_token
end

Instance Method Details

#base_uriObject



11
12
13
# File 'lib/clash_of_clans_api/api.rb', line 11

def base_uri
	BASE_URI
end

#default_headersObject



21
22
23
24
25
# File 'lib/clash_of_clans_api/api.rb', line 21

def default_headers
	{
		'Authorization' => "Bearer #{api_token}",
	}
end