crowdin-api 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-and-lint.yml +1 -1
- data/.gitignore +2 -2
- data/.rubocop_todo.yml +37 -30
- data/README.md +23 -12
- data/bin/crowdin-console +4 -4
- data/lib/crowdin-api/api-resources/dictionaries.rb +34 -0
- data/lib/crowdin-api/api-resources/distributions.rb +99 -0
- data/lib/crowdin-api/api-resources/glossaries.rb +217 -0
- data/lib/crowdin-api/api-resources/labels.rb +117 -0
- data/lib/crowdin-api/api-resources/languages.rb +1 -0
- data/lib/crowdin-api/api-resources/machine_translation_engines.rb +74 -0
- data/lib/crowdin-api/api-resources/projects.rb +15 -1
- data/lib/crowdin-api/api-resources/reports.rb +138 -0
- data/lib/crowdin-api/api-resources/screenshots.rb +186 -0
- data/lib/crowdin-api/api-resources/source_files.rb +3 -2
- data/lib/crowdin-api/api-resources/storages.rb +5 -1
- data/lib/crowdin-api/api-resources/string_comments.rb +73 -0
- data/lib/crowdin-api/api-resources/string_translations.rb +220 -0
- data/lib/crowdin-api/api-resources/tasks.rb +113 -0
- data/lib/crowdin-api/api-resources/teams.rb +144 -0
- data/lib/crowdin-api/api-resources/translation_memory.rb +145 -0
- data/lib/crowdin-api/api-resources/translations.rb +8 -6
- data/lib/crowdin-api/api-resources/users.rb +129 -0
- data/lib/crowdin-api/api-resources/vendors.rb +21 -0
- data/lib/crowdin-api/api-resources/webhooks.rb +73 -0
- data/lib/crowdin-api/api-resources/workflows.rb +3 -0
- data/lib/crowdin-api/client/client.rb +41 -28
- data/lib/crowdin-api/client/configuration.rb +10 -6
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors.rb +2 -1
- data/lib/crowdin-api/core/{api_errors_raiser.rb → errors_raisers.rb} +21 -11
- data/lib/crowdin-api/core/request.rb +8 -5
- data/lib/crowdin-api/core/utils.rb +10 -0
- data/lib/crowdin-api.rb +22 -6
- data/spec/client/client-instance_spec.rb +14 -0
- data/spec/{core/config-instance_spec.rb → client/configuration-instance_spec.rb} +7 -7
- metadata +21 -5
- data/spec/crowdin-api_spec.rb +0 -7
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Users
|
6
|
+
def get_authenticated_user
|
7
|
+
request = Web::Request.new(
|
8
|
+
self,
|
9
|
+
:get,
|
10
|
+
'/user'
|
11
|
+
)
|
12
|
+
|
13
|
+
request.perform
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_project_members(query = {}, project_id = config.project_id)
|
17
|
+
project_id || raise_project_id_is_required_error
|
18
|
+
|
19
|
+
request = Web::Request.new(
|
20
|
+
self,
|
21
|
+
:get,
|
22
|
+
"/projects/#{project_id}/members",
|
23
|
+
query
|
24
|
+
)
|
25
|
+
|
26
|
+
request.perform
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_member_info(member_id = nil, project_id = config.project_id)
|
30
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
31
|
+
project_id || raise_project_id_is_required_error
|
32
|
+
|
33
|
+
request = Web::Request.new(
|
34
|
+
self,
|
35
|
+
:get,
|
36
|
+
"/projects/#{project_id}/members/#{member_id}"
|
37
|
+
)
|
38
|
+
|
39
|
+
request.perform
|
40
|
+
end
|
41
|
+
|
42
|
+
# -- For Enterprise mode only --
|
43
|
+
|
44
|
+
def add_project_member(query = {}, project_id = config.project_id)
|
45
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
46
|
+
project_id || raise_project_id_is_required_error
|
47
|
+
|
48
|
+
request = Web::Request.new(
|
49
|
+
self,
|
50
|
+
:post,
|
51
|
+
"/projects/#{project_id}/members",
|
52
|
+
query
|
53
|
+
)
|
54
|
+
|
55
|
+
request.perform
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_project_member_permissions(member_id = nil, project_id = config.project_id)
|
59
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
60
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
61
|
+
project_id || raise_project_id_is_required_error
|
62
|
+
|
63
|
+
request = Web::Request.new(
|
64
|
+
self,
|
65
|
+
:get,
|
66
|
+
"/projects/#{project_id}/members/#{member_id}"
|
67
|
+
)
|
68
|
+
|
69
|
+
request.perform
|
70
|
+
end
|
71
|
+
|
72
|
+
def replace_project_permissions(member_id = nil, query = {}, project_id = config.project_id)
|
73
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
74
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
75
|
+
project_id || raise_project_id_is_required_error
|
76
|
+
|
77
|
+
request = Web::Request.new(
|
78
|
+
self,
|
79
|
+
:put,
|
80
|
+
"/projects/#{project_id}/members/#{member_id}",
|
81
|
+
query
|
82
|
+
)
|
83
|
+
|
84
|
+
request.perform
|
85
|
+
end
|
86
|
+
|
87
|
+
def delete_member_from_project(member_id = nil, query = {}, project_id = config.project_id)
|
88
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
89
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
90
|
+
project_id || raise_project_id_is_required_error
|
91
|
+
|
92
|
+
request = Web::Request.new(
|
93
|
+
self,
|
94
|
+
:delete,
|
95
|
+
"/projects/#{project_id}/members/#{member_id}",
|
96
|
+
query
|
97
|
+
)
|
98
|
+
|
99
|
+
request.perform
|
100
|
+
end
|
101
|
+
|
102
|
+
def list_users(query = {})
|
103
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
104
|
+
|
105
|
+
request = Web::Request.new(
|
106
|
+
self,
|
107
|
+
:get,
|
108
|
+
'/users',
|
109
|
+
query
|
110
|
+
)
|
111
|
+
|
112
|
+
request.perform
|
113
|
+
end
|
114
|
+
|
115
|
+
def get_user(user_id = nil)
|
116
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
117
|
+
user_id || raise_parameter_is_required_error(:user_id)
|
118
|
+
|
119
|
+
request = Web::Request.new(
|
120
|
+
self,
|
121
|
+
:get,
|
122
|
+
"/users/#{user_id}"
|
123
|
+
)
|
124
|
+
|
125
|
+
request.perform
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
# -- For Enterprise mode only --
|
6
|
+
module Vendors
|
7
|
+
def list_vendors(query = {})
|
8
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
9
|
+
|
10
|
+
request = Web::Request.new(
|
11
|
+
self,
|
12
|
+
:get,
|
13
|
+
'/vendors',
|
14
|
+
query
|
15
|
+
)
|
16
|
+
|
17
|
+
request.perform
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Webhooks
|
6
|
+
def list_webhooks(query = {}, project_id = config.project_id)
|
7
|
+
project_id || raise_project_id_is_required_error
|
8
|
+
|
9
|
+
request = Web::Request.new(
|
10
|
+
self,
|
11
|
+
:get,
|
12
|
+
"/projects/#{project_id}/webhooks",
|
13
|
+
query
|
14
|
+
)
|
15
|
+
|
16
|
+
request.perform
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_webhook(query = {}, project_id = config.project_id)
|
20
|
+
project_id || raise_project_id_is_required_error
|
21
|
+
|
22
|
+
request = Web::Request.new(
|
23
|
+
self,
|
24
|
+
:post,
|
25
|
+
"/projects/#{project_id}/webhooks",
|
26
|
+
query
|
27
|
+
)
|
28
|
+
|
29
|
+
request.perform
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_webhook(webhook_id = nil, project_id = config.project_id)
|
33
|
+
webhook_id || raise_parameter_is_required_error(:webhook_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
35
|
+
|
36
|
+
request = Web::Request.new(
|
37
|
+
self,
|
38
|
+
:get,
|
39
|
+
"/projects/#{project_id}/webhooks/#{webhook_id}"
|
40
|
+
)
|
41
|
+
|
42
|
+
request.perform
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete_webhook(webhook_id = nil, project_id = config.project_id)
|
46
|
+
webhook_id || raise_parameter_is_required_error(:webhook_id)
|
47
|
+
project_id || raise_project_id_is_required_error
|
48
|
+
|
49
|
+
request = Web::Request.new(
|
50
|
+
self,
|
51
|
+
:delete,
|
52
|
+
"/projects/#{project_id}/webhooks/#{webhook_id}"
|
53
|
+
)
|
54
|
+
|
55
|
+
request.perform
|
56
|
+
end
|
57
|
+
|
58
|
+
def edit_screenshot(webhook_id = nil, query = {}, project_id = config.project_id)
|
59
|
+
webhook_id || raise_parameter_is_required_error(:webhook_id)
|
60
|
+
project_id || raise_project_id_is_required_error
|
61
|
+
|
62
|
+
request = Web::Request.new(
|
63
|
+
self,
|
64
|
+
:patch,
|
65
|
+
"/projects/#{project_id}/webhooks/#{webhook_id}",
|
66
|
+
query
|
67
|
+
)
|
68
|
+
|
69
|
+
request.perform
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Crowdin
|
4
4
|
module ApiResources
|
5
|
+
# -- For Enterprise mode only --
|
5
6
|
module Workflows
|
6
7
|
def list_workflow_steps(query = {}, project_id = config.project_id)
|
7
8
|
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
@@ -32,6 +33,8 @@ module Crowdin
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def list_workflow_templates(query = {})
|
36
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
37
|
+
|
35
38
|
request = Web::Request.new(
|
36
39
|
self,
|
37
40
|
:get,
|
@@ -1,42 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# A wrapper and interface to the Crowdin API. Please visit the Crowdin developers site
|
5
|
+
# for a full explanation of what each of the Crowdin api methods expect and perform.
|
5
6
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# require 'crowdin-api'
|
9
|
-
#
|
10
|
-
# crowdin = Crowdin::Client.new do |config|
|
11
|
-
# config.api_token = 'YOUR_API_TOKEN'
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# crowdin.list_projects
|
7
|
+
# https://support.crowdin.com/api/v2/
|
8
|
+
# https://support.crowdin.com/enterprise/api/
|
15
9
|
#
|
16
10
|
module Crowdin
|
11
|
+
#
|
12
|
+
# === Example
|
13
|
+
#
|
14
|
+
# require 'crowdin-api'
|
15
|
+
#
|
16
|
+
# crowdin = Crowdin::Client.new do |config|
|
17
|
+
# config.api_token = 'YOUR_API_TOKEN'
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# crowdin.list_projects
|
21
|
+
#
|
17
22
|
class Client
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
include
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
extend Utils
|
24
|
+
|
25
|
+
# API Resources modules
|
26
|
+
API_RESOURCES_MODULES = %i[Storages Languages Projects Workflows SourceFiles Translations SourceStrings
|
27
|
+
StringTranslations StringComments Screenshots Glossaries TranslationMemory
|
28
|
+
MachineTranslationEngines Reports Tasks Users Teams Vendors Webhooks
|
29
|
+
Dictionaries Distributions Labels TranslationStatus].freeze
|
30
|
+
|
31
|
+
# Error Raisers modules
|
32
|
+
ERROR_RAISERS_MODULES = %i[ApiErrorsRaiser ClientErrorsRaiser].freeze
|
33
|
+
|
34
|
+
# Processing all API Resources modules to include them to the Client
|
35
|
+
API_RESOURCES_MODULES.each do |module_name|
|
36
|
+
Client.send(:include, fetch_module_full_name_from_string("Crowdin::ApiResources::#{module_name}"))
|
37
|
+
end
|
38
|
+
|
39
|
+
# Processing all Error Raisers modules to include them to the Client
|
40
|
+
ERROR_RAISERS_MODULES.each do |module_name|
|
41
|
+
Client.send(:include, fetch_module_full_name_from_string("Crowdin::Errors::#{module_name}"))
|
42
|
+
end
|
36
43
|
|
37
44
|
attr_reader :config
|
38
45
|
attr_reader :connection
|
39
46
|
attr_reader :options
|
47
|
+
attr_reader :logger
|
40
48
|
|
41
49
|
def initialize(&block)
|
42
50
|
build_configuration(&block)
|
@@ -51,6 +59,11 @@ module Crowdin
|
|
51
59
|
!config.logger_enabled? || logger.debug(message)
|
52
60
|
end
|
53
61
|
|
62
|
+
def logger=(logger)
|
63
|
+
raise_logger_are_not_enabled_error unless config.logger_enabled?
|
64
|
+
@logger = logger
|
65
|
+
end
|
66
|
+
|
54
67
|
private
|
55
68
|
|
56
69
|
def build_configuration
|
@@ -9,8 +9,7 @@ module Crowdin
|
|
9
9
|
|
10
10
|
attr_reader :target_api_url
|
11
11
|
|
12
|
-
alias logger_enabled?
|
13
|
-
alias enterprise_mode? organization_domain
|
12
|
+
alias logger_enabled? enable_logger
|
14
13
|
|
15
14
|
def initialize
|
16
15
|
@target_api_url = '/api/v2'
|
@@ -20,16 +19,16 @@ module Crowdin
|
|
20
19
|
{
|
21
20
|
headers: {},
|
22
21
|
timeout: nil,
|
23
|
-
json:
|
22
|
+
json: true
|
24
23
|
}
|
25
24
|
end
|
26
25
|
|
27
26
|
def headers
|
28
27
|
{
|
29
|
-
'Accept'
|
28
|
+
'Accept' => 'application/json',
|
30
29
|
'Authorization' => "Bearer #{api_token}",
|
31
|
-
'Content-Type'
|
32
|
-
'User-Agent'
|
30
|
+
'Content-Type' => 'application/json',
|
31
|
+
'User-Agent' => "crowdin-rb/#{Crowdin::Client::VERSION}/#{RUBY_VERSION}/#{RUBY_PLATFORM}"
|
33
32
|
}
|
34
33
|
end
|
35
34
|
|
@@ -40,5 +39,10 @@ module Crowdin
|
|
40
39
|
'https://api.crowdin.com'
|
41
40
|
end
|
42
41
|
end
|
42
|
+
|
43
|
+
def organization_domain?
|
44
|
+
!!organization_domain
|
45
|
+
end
|
46
|
+
alias enterprise_mode? organization_domain?
|
43
47
|
end
|
44
48
|
end
|
@@ -2,9 +2,29 @@
|
|
2
2
|
|
3
3
|
module Crowdin
|
4
4
|
module Errors
|
5
|
+
# Client errors raiser
|
6
|
+
module ClientErrorsRaiser
|
7
|
+
def raise_logger_are_not_enabled_error
|
8
|
+
raise(LoggerAreNotEnabledError, 'Logger are not enabled in your Client configuration, enable it ' \
|
9
|
+
'before setting your own logger')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Command-Line Client errors raiser
|
14
|
+
module ClcErrorsRaiser
|
15
|
+
def raise_api_token_is_required_error
|
16
|
+
raise(ArgumentError, '--api-token option is required')
|
17
|
+
end
|
18
|
+
|
19
|
+
def raise_organization_domain_is_required_error
|
20
|
+
raise(ArgumentError, '--organization-domain option is required for Enterprise mode')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# API errors raiser
|
5
25
|
module ApiErrorsRaiser
|
6
26
|
def raise_only_for_enterprise_mode_error
|
7
|
-
raise(
|
27
|
+
raise(OnlyForEnterpriseModeError, 'This method can be called only for Enterprise mode')
|
8
28
|
end
|
9
29
|
|
10
30
|
def raise_project_id_is_required_error
|
@@ -14,16 +34,6 @@ module Crowdin
|
|
14
34
|
def raise_parameter_is_required_error(parameter)
|
15
35
|
raise(ArgumentError, ":#{parameter} is required")
|
16
36
|
end
|
17
|
-
|
18
|
-
# crowdin-console errors
|
19
|
-
|
20
|
-
def raise_api_token_is_required_error
|
21
|
-
raise(ArgumentError, '--api-token option is required')
|
22
|
-
end
|
23
|
-
|
24
|
-
def raise_organization_domain_is_required_error
|
25
|
-
raise(ArgumentError, '--organization-domain option is required for Enterprise mode')
|
26
|
-
end
|
27
37
|
end
|
28
38
|
end
|
29
39
|
end
|
@@ -30,7 +30,7 @@ module Crowdin
|
|
30
30
|
rescue StandardError => error
|
31
31
|
client.log! error
|
32
32
|
|
33
|
-
@errors << "Something went wrong while proccessing
|
33
|
+
@errors << "Something went wrong while request proccessing. Details - #{error.class}"
|
34
34
|
end
|
35
35
|
|
36
36
|
def process_response!
|
@@ -55,7 +55,7 @@ module Crowdin
|
|
55
55
|
rescue StandardError => error
|
56
56
|
client.log! error
|
57
57
|
|
58
|
-
@errors << "Something went wrong while proccessing
|
58
|
+
@errors << "Something went wrong while response proccessing. Details - #{error.class}"
|
59
59
|
|
60
60
|
fetch_errors
|
61
61
|
end
|
@@ -68,10 +68,13 @@ module Crowdin
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def download_file(url)
|
71
|
-
download
|
72
|
-
|
71
|
+
download = URI.parse(url).open
|
72
|
+
destination = @destination || download.meta['content-disposition']
|
73
|
+
.match(/filename=("?)(.+)\1/)[2]
|
73
74
|
|
74
|
-
|
75
|
+
IO.copy_stream(download, destination)
|
76
|
+
|
77
|
+
destination
|
75
78
|
rescue StandardError => error
|
76
79
|
client.log! error
|
77
80
|
|
data/lib/crowdin-api.rb
CHANGED
@@ -7,20 +7,36 @@ require 'rest-client'
|
|
7
7
|
|
8
8
|
# Core modules
|
9
9
|
require 'crowdin-api/core/errors'
|
10
|
-
require 'crowdin-api/core/
|
10
|
+
require 'crowdin-api/core/errors_raisers'
|
11
11
|
require 'crowdin-api/core/request'
|
12
|
+
require 'crowdin-api/core/utils'
|
12
13
|
|
13
|
-
#
|
14
|
+
# API modules
|
15
|
+
require 'crowdin-api/api-resources/storages'
|
14
16
|
require 'crowdin-api/api-resources/languages'
|
15
17
|
require 'crowdin-api/api-resources/projects'
|
18
|
+
require 'crowdin-api/api-resources/workflows'
|
16
19
|
require 'crowdin-api/api-resources/source_files'
|
17
|
-
require 'crowdin-api/api-resources/storages'
|
18
|
-
require 'crowdin-api/api-resources/translation_status'
|
19
20
|
require 'crowdin-api/api-resources/translations'
|
20
|
-
require 'crowdin-api/api-resources/workflows'
|
21
21
|
require 'crowdin-api/api-resources/source_strings'
|
22
|
+
require 'crowdin-api/api-resources/string_translations'
|
23
|
+
require 'crowdin-api/api-resources/string_comments'
|
24
|
+
require 'crowdin-api/api-resources/screenshots'
|
25
|
+
require 'crowdin-api/api-resources/glossaries'
|
26
|
+
require 'crowdin-api/api-resources/translation_memory'
|
27
|
+
require 'crowdin-api/api-resources/machine_translation_engines'
|
28
|
+
require 'crowdin-api/api-resources/reports'
|
29
|
+
require 'crowdin-api/api-resources/tasks'
|
30
|
+
require 'crowdin-api/api-resources/users'
|
31
|
+
require 'crowdin-api/api-resources/teams'
|
32
|
+
require 'crowdin-api/api-resources/vendors'
|
33
|
+
require 'crowdin-api/api-resources/webhooks'
|
34
|
+
require 'crowdin-api/api-resources/dictionaries'
|
35
|
+
require 'crowdin-api/api-resources/distributions'
|
36
|
+
require 'crowdin-api/api-resources/labels'
|
37
|
+
require 'crowdin-api/api-resources/translation_status'
|
22
38
|
|
23
|
-
# Client
|
39
|
+
# Client modules
|
24
40
|
require 'crowdin-api/client/version'
|
25
41
|
require 'crowdin-api/client/configuration'
|
26
42
|
require 'crowdin-api/client/client'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Config instance' do
|
4
|
+
before do
|
5
|
+
@crowdin = Crowdin::Client.new do |config|
|
6
|
+
config.api_token = 'api_token'
|
7
|
+
config.project_id = 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should have a version' do
|
12
|
+
expect(Crowdin::Client::VERSION).to_not be_nil
|
13
|
+
end
|
14
|
+
end
|
@@ -8,7 +8,7 @@ describe 'Config instance' do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
it '
|
11
|
+
it 'should have a #project_id' do
|
12
12
|
expect(@crowdin.config.project_id).to_not be_nil
|
13
13
|
end
|
14
14
|
|
@@ -16,12 +16,12 @@ describe 'Config instance' do
|
|
16
16
|
expect(@crowdin.config.api_token).to_not be_nil
|
17
17
|
end
|
18
18
|
|
19
|
-
it '#target_api_url should equal
|
19
|
+
it '#target_api_url should equal \'api/v2\' by default' do
|
20
20
|
expect(@crowdin.config.target_api_url).to eq('/api/v2')
|
21
21
|
end
|
22
22
|
|
23
23
|
describe '#logger_enabled?' do
|
24
|
-
it 'should
|
24
|
+
it 'should equal false by default' do
|
25
25
|
expect(@crowdin.config.logger_enabled?).to be_falsey
|
26
26
|
end
|
27
27
|
|
@@ -35,11 +35,11 @@ describe 'Config instance' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '#enterprise_mode?' do
|
38
|
-
it 'should
|
38
|
+
it 'should equal false by default' do
|
39
39
|
expect(@crowdin.config.enterprise_mode?).to be_falsey
|
40
40
|
end
|
41
41
|
|
42
|
-
it 'should equal
|
42
|
+
it 'should equal true if user specify organization domain' do
|
43
43
|
@crowdin = Crowdin::Client.new do |config|
|
44
44
|
config.organization_domain = 'organization_domain'
|
45
45
|
end
|
@@ -49,7 +49,7 @@ describe 'Config instance' do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe '#base_url' do
|
52
|
-
it 'should equal https://api.crowdin.com by default' do
|
52
|
+
it 'should equal \'https://api.crowdin.com\' by default' do
|
53
53
|
expect(@crowdin.config.base_url).to eq('https://api.crowdin.com')
|
54
54
|
end
|
55
55
|
|
@@ -61,7 +61,7 @@ describe 'Config instance' do
|
|
61
61
|
expect(@crowdin.config.base_url).to eq('https://organization_domain.api.crowdin.com')
|
62
62
|
end
|
63
63
|
|
64
|
-
it 'should equal full specified organization domain when user specify full url (with .com)' do
|
64
|
+
it 'should equal full specified organization domain when user specify full url (with \'.com\')' do
|
65
65
|
@crowdin = Crowdin::Client.new do |config|
|
66
66
|
config.organization_domain = 'organization_domain.com'
|
67
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|
@@ -185,22 +185,38 @@ files:
|
|
185
185
|
- bin/setup
|
186
186
|
- crowdin-api.gemspec
|
187
187
|
- lib/crowdin-api.rb
|
188
|
+
- lib/crowdin-api/api-resources/dictionaries.rb
|
189
|
+
- lib/crowdin-api/api-resources/distributions.rb
|
190
|
+
- lib/crowdin-api/api-resources/glossaries.rb
|
191
|
+
- lib/crowdin-api/api-resources/labels.rb
|
188
192
|
- lib/crowdin-api/api-resources/languages.rb
|
193
|
+
- lib/crowdin-api/api-resources/machine_translation_engines.rb
|
189
194
|
- lib/crowdin-api/api-resources/projects.rb
|
195
|
+
- lib/crowdin-api/api-resources/reports.rb
|
196
|
+
- lib/crowdin-api/api-resources/screenshots.rb
|
190
197
|
- lib/crowdin-api/api-resources/source_files.rb
|
191
198
|
- lib/crowdin-api/api-resources/source_strings.rb
|
192
199
|
- lib/crowdin-api/api-resources/storages.rb
|
200
|
+
- lib/crowdin-api/api-resources/string_comments.rb
|
201
|
+
- lib/crowdin-api/api-resources/string_translations.rb
|
202
|
+
- lib/crowdin-api/api-resources/tasks.rb
|
203
|
+
- lib/crowdin-api/api-resources/teams.rb
|
204
|
+
- lib/crowdin-api/api-resources/translation_memory.rb
|
193
205
|
- lib/crowdin-api/api-resources/translation_status.rb
|
194
206
|
- lib/crowdin-api/api-resources/translations.rb
|
207
|
+
- lib/crowdin-api/api-resources/users.rb
|
208
|
+
- lib/crowdin-api/api-resources/vendors.rb
|
209
|
+
- lib/crowdin-api/api-resources/webhooks.rb
|
195
210
|
- lib/crowdin-api/api-resources/workflows.rb
|
196
211
|
- lib/crowdin-api/client/client.rb
|
197
212
|
- lib/crowdin-api/client/configuration.rb
|
198
213
|
- lib/crowdin-api/client/version.rb
|
199
|
-
- lib/crowdin-api/core/api_errors_raiser.rb
|
200
214
|
- lib/crowdin-api/core/errors.rb
|
215
|
+
- lib/crowdin-api/core/errors_raisers.rb
|
201
216
|
- lib/crowdin-api/core/request.rb
|
202
|
-
-
|
203
|
-
- spec/
|
217
|
+
- lib/crowdin-api/core/utils.rb
|
218
|
+
- spec/client/client-instance_spec.rb
|
219
|
+
- spec/client/configuration-instance_spec.rb
|
204
220
|
- spec/spec_helper.rb
|
205
221
|
homepage: https://github.com/crowdin/crowdin-api-client-ruby
|
206
222
|
licenses:
|