transifex-interface-ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +17 -17
- data/.rspec +2 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +517 -513
- data/Rakefile +1 -1
- data/lib/transifex.rb +84 -87
- data/lib/transifex/crud_requests.rb +43 -33
- data/lib/transifex/errors.rb +4 -4
- data/lib/transifex/project_components/language.rb +1 -1
- data/lib/transifex/project_components/language_components/coordinators.rb +4 -6
- data/lib/transifex/project_components/language_components/reviewers.rb +5 -8
- data/lib/transifex/project_components/language_components/translators.rb +6 -9
- data/lib/transifex/project_components/languages.rb +1 -1
- data/lib/transifex/resource.rb +1 -1
- data/lib/transifex/resource_components/content.rb +1 -1
- data/lib/transifex/resource_components/source.rb +1 -1
- data/lib/transifex/resource_components/stats.rb +1 -1
- data/lib/transifex/resource_components/translation.rb +1 -1
- data/lib/transifex/resource_components/translation_components/string.rb +1 -1
- data/lib/transifex/resource_components/translation_components/strings.rb +1 -1
- data/lib/transifex/resources.rb +1 -1
- data/lib/transifex/version.rb +3 -3
- data/spec/cassettes/fetch_formats.yml +121 -0
- data/spec/cassettes/language/fetch_language_info.yml +58 -0
- data/spec/cassettes/language/fetch_languages_info.yml +58 -0
- data/spec/cassettes/project/components/create_language.yml +95 -0
- data/spec/cassettes/project/components/create_language_non_existing_coordinator.yml +48 -0
- data/spec/cassettes/project/components/create_language_without_coordinator.yml +48 -0
- data/spec/cassettes/project/components/fetch_languages.yml +53 -0
- data/spec/cassettes/project/delete_project.yml +108 -0
- data/spec/cassettes/project/fetch_private_project_info.yml +59 -0
- data/spec/cassettes/project/fetch_with_details_private_project_info.yml +66 -0
- data/spec/cassettes/project/language/delete_language.yml +140 -0
- data/spec/cassettes/project/language/fetch_coordinators.yml +56 -0
- data/spec/cassettes/project/language/fetch_language_info.yml +52 -0
- data/spec/cassettes/project/language/fetch_reviewers.yml +56 -0
- data/spec/cassettes/project/language/fetch_translators.yml +54 -0
- data/spec/cassettes/project/language/fetch_with_details_language_info.yml +54 -0
- data/spec/cassettes/project/language/update_coordinators.yml +104 -0
- data/spec/cassettes/project/language/update_language.yml +100 -0
- data/spec/cassettes/project/language/update_non_existing_coordinator.yml +48 -0
- data/spec/cassettes/project/language/update_non_existing_language.yml +49 -0
- data/spec/cassettes/project/language/update_non_existing_reviewer.yml +101 -0
- data/spec/cassettes/project/language/update_non_existing_translator.yml +101 -0
- data/spec/cassettes/project/language/update_reviewers.yml +157 -0
- data/spec/cassettes/project/language/update_translators.yml +157 -0
- data/spec/cassettes/project/update_non_existing_attribute_private_project.yml +54 -0
- data/spec/cassettes/project/update_private_project.yml +120 -0
- data/spec/cassettes/project/update_with_missing_params_private_project.yml +54 -0
- data/spec/cassettes/projects/create_private_project.yml +111 -0
- data/spec/cassettes/projects/create_public_project.yml +111 -0
- data/spec/cassettes/projects/create_used_slug_project.yml +55 -0
- data/spec/cassettes/projects/fetch_projects.yml +61 -0
- data/spec/cassettes/resource/delete_not_existing_resource.yml +55 -0
- data/spec/cassettes/resource/delete_resource.yml +160 -0
- data/spec/cassettes/resource/fetch_all_languages_stats.yml +66 -0
- data/spec/cassettes/resource/fetch_content_as_file.yml +56 -0
- data/spec/cassettes/resource/fetch_content_as_hash.yml +58 -0
- data/spec/cassettes/resource/fetch_language_stats.yml +61 -0
- data/spec/cassettes/resource/fetch_not_existing_resource.yml +55 -0
- data/spec/cassettes/resource/fetch_resource_info.yml +59 -0
- data/spec/cassettes/resource/fetch_source_string_metadata.yml +52 -0
- data/spec/cassettes/resource/fetch_translations.yml +57 -0
- data/spec/cassettes/resource/fetch_updated_resource_info.yml +60 -0
- data/spec/cassettes/resource/fetch_updated_source_string_metadata.yml +52 -0
- data/spec/cassettes/resource/fetch_with_details_resource_info.yml +65 -0
- data/spec/cassettes/resource/fetch_with_file_and_mode_translations.yml +56 -0
- data/spec/cassettes/resource/fetch_with_file_translations.yml +56 -0
- data/spec/cassettes/resource/update_content_json.yml +115 -0
- data/spec/cassettes/resource/update_content_with_wrong_mimetype.yml +59 -0
- data/spec/cassettes/resource/update_content_yml.yml +114 -0
- data/spec/cassettes/resource/update_not_existing_resource.yml +55 -0
- data/spec/cassettes/resource/update_resource_info.yml +114 -0
- data/spec/cassettes/resource/update_source_language.yml +54 -0
- data/spec/cassettes/resource/update_source_string_metadata.yml +100 -0
- data/spec/cassettes/resource/update_translation_for_language.yml +62 -0
- data/spec/cassettes/resources/create_from_file.yml +55 -0
- data/spec/cassettes/resources/create_from_string.yml +54 -0
- data/spec/cassettes/resources/fetch_as_array.yml +62 -0
- data/spec/cassettes/resources/non_existing_project.yml +55 -0
- data/spec/cassettes/translation/fetch_string.yml +55 -0
- data/spec/cassettes/translation/fetch_strings.yml +54 -0
- data/spec/cassettes/translation/fetch_with_details_and_context_strings.yml +51 -0
- data/spec/cassettes/translation/fetch_with_details_and_key_strings.yml +56 -0
- data/spec/cassettes/translation/fetch_with_details_strings.yml +56 -0
- data/spec/cassettes/translation/update_multiple_translation_strings.yml +107 -0
- data/spec/cassettes/translation/update_single_translation_strings.yml +104 -0
- data/spec/cassettes/translation/update_string.yml +104 -0
- data/spec/lib/transifex/coordinators_spec.rb +22 -16
- data/spec/lib/transifex/formats_spec.rb +8 -8
- data/spec/lib/transifex/language_spec.rb +9 -10
- data/spec/lib/transifex/languages_spec.rb +8 -8
- data/spec/lib/transifex/project_language_spec.rb +41 -28
- data/spec/lib/transifex/project_languages_spec.rb +34 -18
- data/spec/lib/transifex/project_spec.rb +46 -73
- data/spec/lib/transifex/projects_spec.rb +72 -37
- data/spec/lib/transifex/resource_content_spec.rb +41 -24
- data/spec/lib/transifex/resource_source_spec.rb +21 -19
- data/spec/lib/transifex/resource_spec.rb +69 -41
- data/spec/lib/transifex/resources_spec.rb +42 -34
- data/spec/lib/transifex/reviewers_spec.rb +23 -17
- data/spec/lib/transifex/stats_spec.rb +20 -24
- data/spec/lib/transifex/translation_spec.rb +60 -38
- data/spec/lib/transifex/translation_string_spec.rb +26 -20
- data/spec/lib/transifex/translation_strings_spec.rb +65 -43
- data/spec/lib/transifex/translators_spec.rb +23 -17
- data/spec/lib/transifex_spec.rb +15 -0
- data/spec/lib/yaml/eo.yml +3 -0
- data/spec/spec_helper.rb +19 -83
- data/spec/support/client_helper.rb +8 -0
- data/spec/support/content_helper.rb +346 -0
- data/transifex-interface-ruby.gemspec +28 -25
- metadata +198 -21
- data/spec/lib/transifex/configuration_spec.rb +0 -17
- data/spec/lib/yaml/resource_translation_default_content_test.yml +0 -4
- data/spec/lib/yaml/resource_translation_reviewed_content_test.yml +0 -9
@@ -1,32 +1,38 @@
|
|
1
|
-
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Transifex::ProjectComponents::LanguageComponents::Translators do
|
4
|
-
|
5
|
-
@project = Transifex::Project.new("projet-de-test-1")
|
6
|
-
end
|
4
|
+
let(:project) { Transifex::Project.new("ruby-client") }
|
7
5
|
|
8
|
-
describe "
|
9
|
-
it "
|
10
|
-
expect{ Transifex::ProjectComponents::LanguageComponents::Translators.new }
|
6
|
+
describe "Instantiation" do
|
7
|
+
it "raises an error when the project_slug is not provided" do
|
8
|
+
expect { Transifex::ProjectComponents::LanguageComponents::Translators.new }
|
9
|
+
.to raise_error(Transifex::MissingParametersError)
|
10
|
+
.with_message("The following attributes are missing: project_slug")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "Fetch" do
|
15
|
-
it "
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
expect(language_coordinators_infos.keys).to contain_exactly("translators")
|
15
|
+
it "retrieves the language translators" do
|
16
|
+
VCR.use_cassette "project/language/fetch_translators" do
|
17
|
+
expect(project.language("en").translators.fetch).to eq({"translators" => []})
|
18
|
+
end
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "Update" do
|
24
|
-
it "
|
25
|
-
|
23
|
+
it "updates the translators list" do
|
24
|
+
VCR.use_cassette "project/language/update_translators" do
|
25
|
+
expect(project.language("en").translators.update(["mupo"])).to eq "OK"
|
26
|
+
expect(project.language("en").translators.fetch).to eq({"translators" => ["mupo"]})
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
29
|
-
|
30
|
+
it "raises an error if the translator doesn't exist" do
|
31
|
+
VCR.use_cassette "project/language/update_non_existing_translator" do
|
32
|
+
expect { project.language("en").translators.update(["not_existing_translator"]) }
|
33
|
+
.to raise_error(Transifex::TransifexError)
|
34
|
+
.with_message("Users not_existing_translator do not exist.")
|
35
|
+
end
|
30
36
|
end
|
31
37
|
end
|
32
|
-
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Transifex do
|
4
|
+
describe ".configure" do
|
5
|
+
it "sets the client configuration to access the project" do
|
6
|
+
Transifex.configure do |c|
|
7
|
+
c.client_login = "client_login"
|
8
|
+
c.client_secret = "client_secret"
|
9
|
+
end
|
10
|
+
|
11
|
+
expect(Transifex.configuration.client_login).to eq("client_login")
|
12
|
+
expect(Transifex.configuration.client_secret).to eq("client_secret")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,94 +3,30 @@ Bundler.setup
|
|
3
3
|
|
4
4
|
require_relative '../lib/transifex'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb'))].each { |f| require f }
|
9
|
+
|
10
|
+
require "webmock/rspec"
|
11
|
+
require "vcr"
|
12
|
+
|
13
|
+
VCR.configure do |c|
|
14
|
+
c.configure_rspec_metadata!
|
15
|
+
c.cassette_library_dir = "spec/cassettes"
|
16
|
+
c.default_cassette_options = {record: :once}
|
17
|
+
c.hook_into :webmock
|
15
18
|
end
|
16
|
-
reset_transifex_configuration
|
17
19
|
|
18
|
-
|
19
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
20
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
21
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
22
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
23
|
-
#
|
24
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
25
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
26
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
27
|
-
# individual file that may not need all of that loaded. Instead, make a
|
28
|
-
# separate helper file that requires this one and then use it only in the specs
|
29
|
-
# that actually need it.
|
30
|
-
#
|
31
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
32
|
-
# users commonly want.
|
33
|
-
#
|
34
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
35
20
|
RSpec.configure do |config|
|
36
|
-
|
37
|
-
|
38
|
-
=begin
|
39
|
-
# These two settings work together to allow you to limit a spec run
|
40
|
-
# to individual examples or groups you care about by tagging them with
|
41
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
42
|
-
# get run.
|
43
|
-
config.filter_run :focus
|
44
|
-
config.run_all_when_everything_filtered = true
|
45
|
-
|
46
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
47
|
-
# file, and it's useful to allow more verbose output when running an
|
48
|
-
# individual spec file.
|
49
|
-
if config.files_to_run.one?
|
50
|
-
# Use the documentation formatter for detailed output,
|
51
|
-
# unless a formatter has already been configured
|
52
|
-
# (e.g. via a command-line flag).
|
53
|
-
config.default_formatter = 'doc'
|
21
|
+
config.before(:all) do
|
22
|
+
reset_transifex_configuration
|
54
23
|
end
|
55
24
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
config.profile_examples = 10
|
60
|
-
|
61
|
-
# Run specs in random order to surface order dependencies. If you find an
|
62
|
-
# order dependency and want to debug it, you can fix the order by providing
|
63
|
-
# the seed, which is printed after each run.
|
64
|
-
# --seed 1234
|
65
|
-
config.order = :random
|
66
|
-
|
67
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
68
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
69
|
-
# test failures related to randomization by passing the same `--seed` value
|
70
|
-
# as the one that triggered the failure.
|
71
|
-
Kernel.srand config.seed
|
72
|
-
|
73
|
-
# rspec-expectations config goes here. You can use an alternate
|
74
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
75
|
-
# assertions if you prefer.
|
76
|
-
config.expect_with :rspec do |expectations|
|
77
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
78
|
-
# For more details, see:
|
79
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
80
|
-
expectations.syntax = :expect
|
25
|
+
config.after(:suite) do # or :each or :all
|
26
|
+
File.delete("fetched.yml") if File.exists?("fetched.yml")
|
27
|
+
File.delete("translations.yml") if File.exists?("translations.yml")
|
81
28
|
end
|
82
29
|
|
83
|
-
|
84
|
-
|
85
|
-
config.mock_with :rspec do |mocks|
|
86
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
87
|
-
# For more details, see:
|
88
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
89
|
-
mocks.syntax = :expect
|
90
|
-
|
91
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
92
|
-
# a real object. This is generally recommended.
|
93
|
-
mocks.verify_partial_doubles = true
|
94
|
-
end
|
95
|
-
=end
|
30
|
+
config.include ContentHelper
|
31
|
+
config.include ClientHelper
|
96
32
|
end
|
@@ -0,0 +1,346 @@
|
|
1
|
+
module ContentHelper
|
2
|
+
def get_yaml_source_trad_file_path(locale)
|
3
|
+
"spec/lib/yaml/#{locale}.yml"
|
4
|
+
end
|
5
|
+
|
6
|
+
def resource_content_hash
|
7
|
+
{
|
8
|
+
"content" => %Q{eo:\n test_string: "test string"\n},
|
9
|
+
"mimetype" => "text/plain"
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def all_project_resources_array
|
14
|
+
[
|
15
|
+
{
|
16
|
+
"source_language_code" => "eo",
|
17
|
+
"name" => "JSON file example",
|
18
|
+
"i18n_type" => "KEYVALUEJSON",
|
19
|
+
"priority" => "0",
|
20
|
+
"slug" => "json",
|
21
|
+
"categories" => nil
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"source_language_code" => "eo",
|
25
|
+
"name" => "test",
|
26
|
+
"i18n_type" => "YML",
|
27
|
+
"priority" => "0",
|
28
|
+
"slug" => "test",
|
29
|
+
"categories" => nil
|
30
|
+
}
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def successful_resource_creation
|
35
|
+
[1, 0, 0]
|
36
|
+
end
|
37
|
+
|
38
|
+
def resource_source_string_metadata
|
39
|
+
{
|
40
|
+
"comment" => "",
|
41
|
+
"character_limit" => nil,
|
42
|
+
"tags" => nil
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def updated_resource_source_string_metadata
|
47
|
+
{
|
48
|
+
"comment" => "my comment",
|
49
|
+
"character_limit" => 140,
|
50
|
+
"tags" => ["tag1", "tag2"]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def basic_resource_info
|
55
|
+
{
|
56
|
+
"source_language_code" => "eo",
|
57
|
+
"name" => "JSON file example",
|
58
|
+
"i18n_type" => "KEYVALUEJSON",
|
59
|
+
"priority" => "0",
|
60
|
+
"slug" => "json",
|
61
|
+
"categories" => nil
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def detailed_resource_info
|
66
|
+
{
|
67
|
+
"source_language_code" => "eo",
|
68
|
+
"name" => "JSON file example",
|
69
|
+
"created" => "2017-04-27T13:36:43.747",
|
70
|
+
"wordcount"=> 2,
|
71
|
+
"i18n_type" => "KEYVALUEJSON",
|
72
|
+
"project_slug" => "ruby-client",
|
73
|
+
"accept_translations" => true,
|
74
|
+
"last_update" => "2017-04-27T13:43:29.019",
|
75
|
+
"priority" => "0",
|
76
|
+
"available_languages" => [
|
77
|
+
{
|
78
|
+
"code_aliases" => " ",
|
79
|
+
"code" => "en",
|
80
|
+
"name" => "English"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"code_aliases" => " ",
|
84
|
+
"code" => "eo",
|
85
|
+
"name" => "Esperanto"
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"total_entities" => 1,
|
89
|
+
"slug" => "json",
|
90
|
+
"categories" => nil
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
def updated_resource_info
|
95
|
+
{
|
96
|
+
"source_language_code" => "eo",
|
97
|
+
"name" => "updated name",
|
98
|
+
"i18n_type" => "YML",
|
99
|
+
"priority" => "0",
|
100
|
+
"slug" => "test",
|
101
|
+
"categories" => ["test1", "test2"]
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
def language_info
|
106
|
+
{
|
107
|
+
"rtl" => false,
|
108
|
+
"pluralequation" => "language.pluralequation",
|
109
|
+
"code" => "fr",
|
110
|
+
"name" => "French",
|
111
|
+
"nplurals" => 2
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
def basic_language_info
|
116
|
+
{
|
117
|
+
"coordinators" => ["wirido"],
|
118
|
+
"translators" => [],
|
119
|
+
"reviewers" => []
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
def detailed_language_info
|
124
|
+
{
|
125
|
+
"coordinators" => ["wirido"],
|
126
|
+
"reviewers" => [],
|
127
|
+
"total_segments" => 4,
|
128
|
+
"untranslated_segments" => 4,
|
129
|
+
"translated_words" => 0,
|
130
|
+
"reviewed_segments" => 0,
|
131
|
+
"translators" => [],
|
132
|
+
"translated_segments" => 0
|
133
|
+
}
|
134
|
+
end
|
135
|
+
|
136
|
+
def project_languages_info
|
137
|
+
[
|
138
|
+
{
|
139
|
+
"coordinators" => ["nirnaeth"],
|
140
|
+
"language_code" => "en",
|
141
|
+
"translators" => [],
|
142
|
+
"reviewers" => ["wirido"]
|
143
|
+
}
|
144
|
+
]
|
145
|
+
end
|
146
|
+
|
147
|
+
def private_project_info
|
148
|
+
{
|
149
|
+
"description" => "Private Ruby Client",
|
150
|
+
"source_language_code" => "eo",
|
151
|
+
"slug" => "private-ruby-client",
|
152
|
+
"name" => "Private Ruby Client"
|
153
|
+
}
|
154
|
+
end
|
155
|
+
|
156
|
+
def detailed_private_project_info
|
157
|
+
{
|
158
|
+
"archived" => false,
|
159
|
+
"auto_join" => false,
|
160
|
+
"description" => "Private Ruby Client",
|
161
|
+
"fill_up_resources" => false,
|
162
|
+
"homepage" => "",
|
163
|
+
"last_updated" => nil,
|
164
|
+
"long_description" => "",
|
165
|
+
"maintainers" => [{"username" => "nirnaeth"}],
|
166
|
+
"name" => "Private Ruby Client",
|
167
|
+
"organization" => {"slug" => "freego"},
|
168
|
+
"private" => true,
|
169
|
+
"resources" => [],
|
170
|
+
"slug" => "private-ruby-client",
|
171
|
+
"source_language_code" => "eo",
|
172
|
+
"tags" => "",
|
173
|
+
"team" => {"id" => 74153, "name" => "Ruby Client team"},
|
174
|
+
"teams" => ["en", "de"],
|
175
|
+
"trans_instructions" => ""
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
def public_project_info
|
180
|
+
{
|
181
|
+
"description" => "Public Ruby Client",
|
182
|
+
"source_language_code" => "it",
|
183
|
+
"slug" => "public-ruby-client",
|
184
|
+
"name" => "Public Ruby Client"
|
185
|
+
}
|
186
|
+
end
|
187
|
+
|
188
|
+
def all_projects_info
|
189
|
+
[
|
190
|
+
{
|
191
|
+
"description" => "Private Ruby Client",
|
192
|
+
"source_language_code" => "eo",
|
193
|
+
"slug" => "private-ruby-client",
|
194
|
+
"name" => "Private Ruby Client"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"description" => "Ruby Client",
|
198
|
+
"source_language_code" => "eo",
|
199
|
+
"slug" => "ruby-client",
|
200
|
+
"name" => "Ruby Client"
|
201
|
+
}
|
202
|
+
]
|
203
|
+
end
|
204
|
+
|
205
|
+
def all_languages_stats
|
206
|
+
{
|
207
|
+
"eo" => {
|
208
|
+
"reviewed_percentage" => "0%",
|
209
|
+
"completed" => "100%",
|
210
|
+
"untranslated_words" => 0,
|
211
|
+
"last_commiter" => "nirnaeth",
|
212
|
+
"reviewed" => 0,
|
213
|
+
"translated_entities" => 1,
|
214
|
+
"translated_words" => 2,
|
215
|
+
"last_update" => "2017-04-27 14:08:57",
|
216
|
+
"untranslated_entities" => 0
|
217
|
+
},
|
218
|
+
"en" => {
|
219
|
+
"reviewed_percentage" => "0%",
|
220
|
+
"completed" => "0%",
|
221
|
+
"untranslated_words" => 2,
|
222
|
+
"last_commiter" => "nirnaeth",
|
223
|
+
"reviewed" => 0,
|
224
|
+
"translated_entities" => 0,
|
225
|
+
"translated_words" => 0,
|
226
|
+
"last_update" => "2017-04-27 14:08:57",
|
227
|
+
"untranslated_entities" => 1
|
228
|
+
}
|
229
|
+
}
|
230
|
+
end
|
231
|
+
|
232
|
+
def translation_content
|
233
|
+
{
|
234
|
+
"content" => "en: {}\n",
|
235
|
+
"mimetype" => "text/plain"
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
def file_translation_content
|
240
|
+
"---\nen: {}\n"
|
241
|
+
end
|
242
|
+
|
243
|
+
def file_translation_content_with_mode
|
244
|
+
"---\nen:\n test_string: ''\n"
|
245
|
+
end
|
246
|
+
|
247
|
+
def updated_translations
|
248
|
+
{
|
249
|
+
"strings_added" => 0,
|
250
|
+
"strings_updated" => 0,
|
251
|
+
"strings_delete" => 0,
|
252
|
+
"redirect" => "/freego/ruby-client/test/"
|
253
|
+
}
|
254
|
+
end
|
255
|
+
|
256
|
+
def string_details
|
257
|
+
{
|
258
|
+
"comment" => "",
|
259
|
+
"context" => "",
|
260
|
+
"tags" => nil,
|
261
|
+
"character_limit" => nil,
|
262
|
+
"reviewed" => false,
|
263
|
+
"user" => "",
|
264
|
+
"key" => "test_string",
|
265
|
+
"source_string" => "test string",
|
266
|
+
"translation" => "",
|
267
|
+
"last_update" => "",
|
268
|
+
"pluralized" => false,
|
269
|
+
"occurrences" => nil
|
270
|
+
}
|
271
|
+
end
|
272
|
+
|
273
|
+
def language_strings
|
274
|
+
[
|
275
|
+
{
|
276
|
+
"comment" => "",
|
277
|
+
"context" => "",
|
278
|
+
"key" => "test_string",
|
279
|
+
"reviewed" => true,
|
280
|
+
"pluralized" => false,
|
281
|
+
"source_string" => "test string",
|
282
|
+
"translation" => "translated test string"
|
283
|
+
}
|
284
|
+
]
|
285
|
+
end
|
286
|
+
|
287
|
+
def language_strings_with_details
|
288
|
+
[
|
289
|
+
{
|
290
|
+
"comment" => "",
|
291
|
+
"context" => "",
|
292
|
+
"tags" => nil,
|
293
|
+
"character_limit" => nil,
|
294
|
+
"reviewed" => true,
|
295
|
+
"user" => "nirnaeth",
|
296
|
+
"key" => "test_string",
|
297
|
+
"source_string" => "test string",
|
298
|
+
"translation" => "translated test string",
|
299
|
+
"last_update" => "2017-05-04T12:22:46.171",
|
300
|
+
"pluralized" => false,
|
301
|
+
"occurrences" => nil
|
302
|
+
}
|
303
|
+
]
|
304
|
+
end
|
305
|
+
|
306
|
+
def multiple_language_strings
|
307
|
+
[
|
308
|
+
{
|
309
|
+
"comment" => "",
|
310
|
+
"context" => "",
|
311
|
+
"key" => "yet_another_string",
|
312
|
+
"reviewed" => false,
|
313
|
+
"pluralized" => false,
|
314
|
+
"source_string" => "yet another string",
|
315
|
+
"translation" => "yet another translation"
|
316
|
+
},
|
317
|
+
{
|
318
|
+
"comment" => "",
|
319
|
+
"context" => "",
|
320
|
+
"key" => "test_string",
|
321
|
+
"reviewed" => false,
|
322
|
+
"pluralized" => false,
|
323
|
+
"source_string" => "test string",
|
324
|
+
"translation" => "multiple translations"
|
325
|
+
}
|
326
|
+
]
|
327
|
+
end
|
328
|
+
|
329
|
+
def updated_resource_with_file
|
330
|
+
{
|
331
|
+
"strings_added" => 1,
|
332
|
+
"strings_updated" => 0,
|
333
|
+
"strings_delete" => 1,
|
334
|
+
"redirect" => "/ruby-client/test/"
|
335
|
+
}
|
336
|
+
end
|
337
|
+
|
338
|
+
def updated_resource_with_json
|
339
|
+
{
|
340
|
+
"strings_added" => 0,
|
341
|
+
"strings_updated" => 1,
|
342
|
+
"strings_delete" => 0,
|
343
|
+
"redirect" => "/ruby-client/json/"
|
344
|
+
}
|
345
|
+
end
|
346
|
+
end
|