Class: Fastlane::Actions::TransifexApiAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::TransifexApiAction
- Defined in:
- lib/fastlane/plugin/transifex_api/actions/transifex_api_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
41 42 43 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 41 def self. ["alexander sun"] end |
.available_options ⇒ Object
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 80 81 82 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 54 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
37 38 39 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 37 def self.description "basic transifex api wrapper" end |
.details ⇒ Object
49 50 51 52 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 49 def self.details # Optional: "basic transifex api wrapper " end |
.is_supported?(platform) ⇒ Boolean
84 85 86 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 84 def self.is_supported?(platform) [:ios, :mac, :android].include?(platform) end |
.return_value ⇒ Object
45 46 47 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_action.rb', line 45 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 33 34 35 |
# File 'lib/fastlane/plugin/transifex_api/actions/transifex_api_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 = "http://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("[email protected]", "Senha123") = { 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 |