crowdin-api 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -64,11 +64,13 @@ First parameter is array of files that should be updated in Crowdin project.
64
64
  Every file is hash:
65
65
  * `:dest` - file name with path in Crowdin project (_required_)
66
66
  * `:source` - uploaded file (_required_)
67
+ * `:title` - title for uploaded file (_optional_)
68
+ * `:export_pattern` - string that defines name of resulted file (_optional_)
67
69
 
68
70
  ```ruby
69
71
  crowdin.update_file(
70
72
  files = [
71
- { :dest => '/directory/array.xml', :source => 'array.xml' },
73
+ { :dest => '/directory/array.xml', :source => 'array.xml', :export_pattern => '/values-%two_letter_code%/%original_file_name%'},
72
74
  { :dest => 'strings.xml', :source => 'strings.xml' }
73
75
  ])
74
76
 
@@ -47,10 +47,12 @@ module Crowdin
47
47
  #
48
48
  # == Parameters
49
49
  #
50
- # files - Array of files that should be added to Crowdin project.
50
+ # files - Array of files that should be updated in Crowdin project.
51
51
  # file is a Hash {:dest, :source}
52
52
  # * :dest - file name with path in Crowdin project (required)
53
53
  # * :source - path for uploaded file (required)
54
+ # * :title - title in Crowdin UI (optional)
55
+ # * :export_pattern - Resulted file name (optional)
54
56
  #
55
57
  # == Request
56
58
  #
@@ -62,6 +64,14 @@ module Crowdin
62
64
  ::File.open(f[:source] || raise(ArgumentError, "'`:source` is required'") )
63
65
  ] }]
64
66
 
67
+ params[:titles] = Hash[files.map{ |f| [f[:dest], f[:title]] }]
68
+ params[:titles].delete_if{ |k, v| v.nil? }
69
+
70
+ params[:export_patterns] = Hash[files.map{ |f| [f[:dest], f[:export_pattern]] }]
71
+ params[:export_patterns].delete_if{ |k, v| v.nil? }
72
+
73
+ params.delete_if{ |k, v| v.empty? }
74
+
65
75
  request(
66
76
  :method => :post,
67
77
  :path => "/api/project/#{@project_id}/update-file",
@@ -1,5 +1,5 @@
1
1
  module Crowdin
2
2
  class API
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdin-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: