class Fastlane::Actions::UploadStringsToPoeditorAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 28
def self.authors
  ["Kostia Myts"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 40
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :language_file_path,
                            env_name: "LANGUAGE_FILE_PATH",
                         description: "Langage file to upload in POEditor",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :api_key,
                            env_name: "POEDITOR_API_KEY",
                         description: "API Key for POEditor",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :project_id,
                            env_name: "POEDITOR_PROJECT_ID",
                         description: "Project Id in POEditor",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :language,
                            env_name: "POEDITOR_LANGUAGE",
                         description: "Exported language",
                            optional: false,
                                type: String),

  ]
end
description() click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 24
def self.description
  "Upload strings to POEditor"
end
details() click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 36
def self.details
  "Upload strings to POEditor."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 66
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 32
def self.return_value
  "The content of POEditor API response"
end
run(params) click to toggle source
# File lib/fastlane/plugin/poeditor/actions/upload_strings_to_poeditor.rb, line 6
def self.run(params)
  UI.message("Uploading localization file #{params[:language_file_path]} to POEditor")

  response = RestClient.post('https://api.poeditor.com/v2/projects/upload/',
    :api_token => params[:api_key],
    :id => params[:project_id],
    :updating => 'terms_translations',
    :read_from_source => '1',
    :language => params[:language],
    :file => File.new(params[:language_file_path], 'rb'),
  )

  UI.message("Finished uploading file")
  UI.message("#{response}")

  return response
end