Class: Fastlane::Actions::TransifexAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::TransifexAction
- Defined in:
- lib/fastlane/plugin/transifex/actions/transifex_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
38 39 40 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 38 def self. ["junjie"] end |
.available_options ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 51 def self. [ FastlaneCore::ConfigItem.new(key: :user_name, env_name: "TRANSIFEX_API_USER_NAME", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :password, env_name: "TRANSIFEX_API_PASSWORD", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :project, env_name: "TRANSIFEX_API_PROJECT", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :resource, env_name: "TRANSIFEX_API_PROJECT", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :lang_code, env_name: "TRANSIFEX_API_LANGUAGE_CODE", description: "A description of your option", optional: true, type: String) ] end |
.description ⇒ Object
34 35 36 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 34 def self.description "basic transifex wrapper" end |
.details ⇒ Object
46 47 48 49 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 46 def self.details # Optional: "basic transifex wrapper " end |
.is_supported?(platform) ⇒ Boolean
81 82 83 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 81 def self.is_supported?(platform) [:ios, :mac, :android].include?(platform) end |
.return_value ⇒ Object
42 43 44 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 42 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fastlane/plugin/transifex/actions/transifex_action.rb', line 4 def self.run(params) require 'json' require 'net/http' user_name = params[:user_name].shellescape password = params[:password].shellescape project = params[:project].shellescape resource = params[:resource].shellescape url = "https://www.transifex.com/api/2/project/#{project}/resource/#{resource}/stats/" url = url + params[:lang_code].shellescape if params[:lang_code] uri = URI.parse(url) request = Net::HTTP::Get.new(uri) request.basic_auth(user_name, password) = { use_ssl: uri.scheme == "https", } response = Net::HTTP.start(uri.hostname, uri.port, ) do |http| http.request(request) end UI.(response.body) JSON.parse(response.body) end |