Class: Fastlane::Actions::FirebaseDeleteClientAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



32
33
34
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 32

def self.authors
  ["Tomas Kohout"]
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 45

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :username,
                            env_name: "FIREBASE_USERNAME",
                         description: "Username for your google account",
                            optional: false),
    FastlaneCore::ConfigItem.new(key: :project_number,
                            env_name: "FIREBASE_PROJECT_NUMBER",
                         description: "Project number",
                            optional: true),
    FastlaneCore::ConfigItem.new(key: :client_id,
                            env_name: "FIREBASE_CLIENT_ID",
                         description: "Client ID to be deleted",
                            optional: true),
    FastlaneCore::ConfigItem.new(key: :force,
                            env_name: "FIREBASE_FORCE",
                         description: "Force delete",
                            default_value: false)
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 28

def self.description
  "An unofficial tool to access Firebase"
end

.detailsObject



40
41
42
43
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 40

def self.details
  # Optional:
  "Firebase helps you list your projects, create applications, download configuration files and more..."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
69
70
71
72
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 66

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



36
37
38
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 36

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fastlane/plugin/firebase/actions/firebase_delete_client_action.rb', line 5

def self.run(params)
  manager = Firebase::Manager.new
  #Login
  api = manager.(params[:username])

  #Select project
  project = manager.select_project(params[:project_number])

  #Select project
  client = manager.select_client(project, params[:client_id])

  #Confirm
  if !params[:force] then
    UI.error "Caution, this is a permanent action. Deleting your app will delete the corresponding Analytics data, but not your app's API keys or OAuth clients."
    UI.confirm "Are you sure to delete #{client["clientId"]} (#{client["displayName"]})?"
  end

  #Delete
  api.delete_client(project["projectNumber"], client["clientId"])

  UI.success "Successfuly deleted #{client["clientId"]}"
end