Class: Xcrowdin::CrowdinClient
- Inherits:
-
Object
- Object
- Xcrowdin::CrowdinClient
- Defined in:
- lib/xcrowdin/crowdin_client.rb
Constant Summary collapse
- TEMP =
Dir.tmpdir()
Instance Method Summary collapse
- #download ⇒ Object
- #export ⇒ Object
-
#initialize(api_key, project_id, crowdin_path) ⇒ CrowdinClient
constructor
A new instance of CrowdinClient.
- #update_file(file_path) ⇒ Object
Constructor Details
#initialize(api_key, project_id, crowdin_path) ⇒ CrowdinClient
Returns a new instance of CrowdinClient.
9 10 11 12 13 |
# File 'lib/xcrowdin/crowdin_client.rb', line 9 def initialize(api_key, project_id, crowdin_path) @crowdin = Crowdin::API.new(api_key: api_key, project_id: project_id) @crowdin.log = Logger.new $stderr @crowdin_path = crowdin_path end |
Instance Method Details
#download ⇒ Object
27 28 29 30 31 32 |
# File 'lib/xcrowdin/crowdin_client.rb', line 27 def download p "-- start cronwdin download translations en" @crowdin.download_translation('en', :output => "#{TEMP}/en.zip") p "-- start cronwdin download translations zh-TW" @crowdin.download_translation('zh-TW', :output => "#{TEMP}/zh-TW.zip") end |
#export ⇒ Object
22 23 24 25 |
# File 'lib/xcrowdin/crowdin_client.rb', line 22 def export p "-- start cronwdin exoprt translations" @crowdin.export_translations end |
#update_file(file_path) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/xcrowdin/crowdin_client.rb', line 15 def update_file(file_path) @crowdin.update_file( files = [ { :dest => @crowdin_path, :source => file_path } ]) end |