Class: MapkitToken::MapkitTokenController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/mapkit_token/mapkit_token_controller.rb

Instance Method Summary collapse

Instance Method Details

#apple_team_idObject



20
21
22
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 20

def apple_team_id
  mapkit[:apple_team_id]
end

#auth_keyObject



12
13
14
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 12

def auth_key
  File.read(mapkit[:auth_key_path])
end

#auth_key_idObject



16
17
18
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 16

def auth_key_id
  mapkit[:auth_key_id]
end

#base_urlObject



24
25
26
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 24

def base_url
  request.protocol + request.host
end

#mapkitObject



4
5
6
7
8
9
10
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 4

def mapkit
  if Rails.application.respond_to?(:credentials)
    Rails.application.credentials.mapkit
  else
    Rails.application.secrets.mapkit.symbolize_keys
  end
end

#showObject



28
29
30
# File 'app/controllers/mapkit_token/mapkit_token_controller.rb', line 28

def show
  render plain: Mapkit.token.generate(auth_key: auth_key, auth_key_id: auth_key_id, apple_team_id: apple_team_id, base_url: base_url)
end