class Fastlane::Actions::FarolAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 37
def self.authors
  ["Felipe Plets"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 50
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :token,
                            env_name: "TOKEN",
                         description: "The token for your Farol App",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :app_id,
                            env_name: "APP_ID",
                         description: "The app id for your Farol App",
                            optional: false,
                                type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 33
def self.description
  "Enable your app to use Farol Platform services"
end
details() click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 45
def self.details
  # Optional:
  "Integrate your app with the Farol Platform using services like push notifications"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 65
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_value() click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 41
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 4
def self.run(params)
  base_folder     = ''
  target_folder   = base_folder + 'Target/'

  # Reset target folder
  FileUtils.rm_rf Dir.glob(target_folder)
  Dir.mkdir(target_folder)

  # Create Farol Api
  api = Farol::Api.new
  token = params[:token]

  # Download event content
  result = api.request(token, 'get', 'event/event')
  self.save_file('Event', result)

  # Download app content
  result = api.request(token, 'get', 'app/' + params[:app_id])
  self.save_file('App', result)
end
save_file(file_name, result) click to toggle source
# File lib/fastlane/plugin/farol/actions/farol_action.rb, line 25
def self.save_file(file_name, result)
  base_folder     = ''
  target_folder   = base_folder + 'Target/'
  File.open(target_folder + file_name + '.json', 'w') do |f|
    f.puts JSON.pretty_generate(result)
  end
end