crowdin-api 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +96 -31
  3. data/README.md +8 -6
  4. data/bin/crowdin-console +1 -1
  5. data/crowdin-api.gemspec +1 -2
  6. data/lib/crowdin-api/{api-resources → api_resources}/dictionaries.rb +8 -10
  7. data/lib/crowdin-api/{api-resources → api_resources}/distributions.rb +25 -32
  8. data/lib/crowdin-api/{api-resources → api_resources}/glossaries.rb +64 -82
  9. data/lib/crowdin-api/{api-resources → api_resources}/labels.rb +28 -47
  10. data/lib/crowdin-api/api_resources/languages.rb +61 -0
  11. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +79 -0
  12. data/lib/crowdin-api/api_resources/projects.rb +124 -0
  13. data/lib/crowdin-api/api_resources/reports.rb +120 -0
  14. data/lib/crowdin-api/{api-resources → api_resources}/screenshots.rb +47 -61
  15. data/lib/crowdin-api/{api-resources → api_resources}/source_files.rb +68 -131
  16. data/lib/crowdin-api/{api-resources → api_resources}/source_strings.rb +19 -24
  17. data/lib/crowdin-api/api_resources/storages.rb +54 -0
  18. data/lib/crowdin-api/{api-resources → api_resources}/string_comments.rb +18 -23
  19. data/lib/crowdin-api/{api-resources → api_resources}/string_translations.rb +63 -90
  20. data/lib/crowdin-api/{api-resources → api_resources}/tasks.rb +30 -41
  21. data/lib/crowdin-api/api_resources/teams.rb +135 -0
  22. data/lib/crowdin-api/{api-resources → api_resources}/translation_memory.rb +38 -52
  23. data/lib/crowdin-api/{api-resources → api_resources}/translation_status.rb +24 -30
  24. data/lib/crowdin-api/{api-resources → api_resources}/translations.rb +40 -58
  25. data/lib/crowdin-api/api_resources/users.rb +161 -0
  26. data/lib/crowdin-api/api_resources/vendors.rb +21 -0
  27. data/lib/crowdin-api/{api-resources → api_resources}/webhooks.rb +19 -24
  28. data/lib/crowdin-api/api_resources/workflows.rb +59 -0
  29. data/lib/crowdin-api/client/client.rb +51 -42
  30. data/lib/crowdin-api/client/configuration.rb +12 -12
  31. data/lib/crowdin-api/client/version.rb +1 -1
  32. data/lib/crowdin-api/core/errors_raisers.rb +1 -1
  33. data/lib/crowdin-api/core/request.rb +53 -88
  34. data/lib/crowdin-api/core/send_request.rb +67 -0
  35. data/lib/crowdin-api.rb +17 -24
  36. data/spec/api_resources/dictionaries_spec.rb +23 -0
  37. data/spec/api_resources/distributions_spec.rb +71 -0
  38. data/spec/api_resources/glossaries_spec.rb +167 -0
  39. data/spec/api_resources/labels_spec.rb +71 -0
  40. data/spec/api_resources/languages_spec.rb +51 -0
  41. data/spec/api_resources/machine_translation_engines_spec.rb +63 -0
  42. data/spec/api_resources/projects_spec.rb +215 -0
  43. data/spec/api_resources/reports_spec.rb +95 -0
  44. data/spec/api_resources/screenshots_spec.rb +134 -0
  45. data/spec/api_resources/source_files_spec.rb +13 -0
  46. data/spec/api_resources/source_strings_spec.rb +51 -0
  47. data/spec/api_resources/storages_spec.rb +13 -0
  48. data/spec/api_resources/string_comments_spec.rb +13 -0
  49. data/spec/api_resources/string_translations_spec.rb +13 -0
  50. data/spec/api_resources/tasks_spec.rb +79 -0
  51. data/spec/api_resources/teams_spec.rb +13 -0
  52. data/spec/api_resources/translation_memory_spec.rb +13 -0
  53. data/spec/api_resources/translation_status_spec.rb +15 -0
  54. data/spec/api_resources/translations_spec.rb +107 -0
  55. data/spec/api_resources/users_spec.rb +117 -0
  56. data/spec/api_resources/vendors_spec.rb +13 -0
  57. data/spec/api_resources/webhooks_spec.rb +51 -0
  58. data/spec/api_resources/workflows_spec.rb +41 -0
  59. data/spec/spec_helper.rb +20 -2
  60. data/spec/unit/client_spec.rb +85 -0
  61. metadata +64 -43
  62. data/bin/setup +0 -6
  63. data/lib/crowdin-api/api-resources/languages.rb +0 -82
  64. data/lib/crowdin-api/api-resources/machine_translation_engines.rb +0 -74
  65. data/lib/crowdin-api/api-resources/projects.rb +0 -148
  66. data/lib/crowdin-api/api-resources/reports.rb +0 -138
  67. data/lib/crowdin-api/api-resources/storages.rb +0 -106
  68. data/lib/crowdin-api/api-resources/teams.rb +0 -144
  69. data/lib/crowdin-api/api-resources/users.rb +0 -129
  70. data/lib/crowdin-api/api-resources/vendors.rb +0 -21
  71. data/lib/crowdin-api/api-resources/workflows.rb +0 -62
  72. data/lib/crowdin-api/core/utils.rb +0 -10
  73. data/spec/client/client-instance_spec.rb +0 -14
  74. data/spec/client/configuration-instance_spec.rb +0 -72
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12e4090258b99a1702202afb42fa199658b4afcd544372b9c5360d1807f65960
4
- data.tar.gz: a11f40b227a80f556e4947c05189df7ac226d9141f4103d2aa6f93d3f08ca164
3
+ metadata.gz: 61895ba4796676e716e2a62d4255f518cfcf3b2c138912f201cddce16250a474
4
+ data.tar.gz: 6cd484b5d394e9b0c2ed2597003d1a64db1d656242d241728c3d4d9f650df87d
5
5
  SHA512:
6
- metadata.gz: 34da514b4e85ea10655d92971b6b495c3d8c141c7c7e195128ff0668883bda4bb9966433899e2f4c8297ad669d2c9af0f72ab6eaa6e07e2f5e9d4ab83ed0b963
7
- data.tar.gz: 74e30dac5d1d2c0bba0c0a47c8eae3adb359770272165eb3506cf7e0ff918555cc204d7d0e3bdcbc16bc549d563d9140dd9d9bc3392dfb3a3912ec1373cf2f28
6
+ metadata.gz: 14a37cc1eba04d6170dfe082d50ff3ddc033997c1f4f3eab26ab3f9c04b7b35a419c5642cda28b0fbfb258588b234d24dbb685a004cf14841d85bf7f3b12a790
7
+ data.tar.gz: 4c60ed5dbb6dbe6ab2dfd64f92d508be2f13ac2223a6a34292fb09c1fa1ebcb320ce3ee0ee2c56ba04fc15bc5d598d569528212bc505076d23c7c5ace0515f72
data/.rubocop_todo.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-02-14 06:05:44 UTC using RuboCop version 1.23.0.
3
+ # on 2022-05-09 23:17:26 UTC using RuboCop version 1.26.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Cop supports --auto-correct.
10
+ # This cop supports safe auto-correction (--auto-correct).
11
11
  # Configuration parameters: Include.
12
12
  # Include: **/*.gemspec
13
13
  Gemspec/RequireMFA:
@@ -21,8 +21,19 @@ Gemspec/RequiredRubyVersion:
21
21
  Exclude:
22
22
  - 'crowdin-api.gemspec'
23
23
 
24
+ # Offense count: 18
25
+ # This cop supports safe auto-correction (--auto-correct).
26
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
27
+ Layout/ExtraSpacing:
28
+ Exclude:
29
+ - 'lib/crowdin-api/api_resources/machine_translation_engines.rb'
30
+ - 'lib/crowdin-api/api_resources/reports.rb'
31
+ - 'lib/crowdin-api/api_resources/teams.rb'
32
+ - 'lib/crowdin-api/api_resources/users.rb'
33
+ - 'lib/crowdin-api/api_resources/workflows.rb'
34
+
24
35
  # Offense count: 4
25
- # Cop supports --auto-correct.
36
+ # This cop supports safe auto-correction (--auto-correct).
26
37
  # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
27
38
  # SupportedHashRocketStyles: key, separator, table
28
39
  # SupportedColonStyles: key, separator, table
@@ -31,36 +42,68 @@ Layout/HashAlignment:
31
42
  Exclude:
32
43
  - 'lib/crowdin-api/client/configuration.rb'
33
44
 
34
- # Offense count: 1
35
- # Cop supports --auto-correct.
45
+ # Offense count: 13
46
+ # This cop supports safe auto-correction (--auto-correct).
47
+ # Configuration parameters: EnforcedStyle.
48
+ # SupportedStyles: normal, indented_internal_methods
49
+ Layout/IndentationConsistency:
50
+ Exclude:
51
+ - 'lib/crowdin-api/client/client.rb'
52
+ - 'lib/crowdin-api/core/request.rb'
53
+ - 'lib/crowdin-api/core/send_request.rb'
54
+
55
+ # Offense count: 13
56
+ # This cop supports safe auto-correction (--auto-correct).
57
+ # Configuration parameters: Width, IgnoredPatterns.
58
+ Layout/IndentationWidth:
59
+ Exclude:
60
+ - 'lib/crowdin-api/client/client.rb'
61
+ - 'lib/crowdin-api/core/request.rb'
62
+ - 'lib/crowdin-api/core/send_request.rb'
63
+
64
+ # Offense count: 22
65
+ # This cop supports safe auto-correction (--auto-correct).
36
66
  # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
37
67
  # SupportedStylesForExponentOperator: space, no_space
38
68
  Layout/SpaceAroundOperators:
39
69
  Exclude:
40
70
  - 'crowdin-api.gemspec'
71
+ - 'lib/crowdin-api/api_resources/machine_translation_engines.rb'
72
+ - 'lib/crowdin-api/api_resources/reports.rb'
73
+ - 'lib/crowdin-api/api_resources/teams.rb'
74
+ - 'lib/crowdin-api/api_resources/users.rb'
75
+ - 'lib/crowdin-api/api_resources/workflows.rb'
76
+ - 'spec/api_resources/projects_spec.rb'
77
+
78
+ # Offense count: 1
79
+ # This cop supports safe auto-correction (--auto-correct).
80
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
81
+ Lint/UnusedMethodArgument:
82
+ Exclude:
83
+ - 'lib/crowdin-api/core/send_request.rb'
41
84
 
42
85
  # Offense count: 2
43
86
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
44
87
  Metrics/AbcSize:
45
88
  Max: 23
46
89
 
47
- # Offense count: 1
90
+ # Offense count: 4
48
91
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
49
92
  # IgnoredMethods: refine
50
93
  Metrics/BlockLength:
51
- Max: 54
94
+ Max: 171
52
95
 
53
- # Offense count: 12
96
+ # Offense count: 13
54
97
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
55
98
  Metrics/MethodLength:
56
99
  Max: 18
57
100
 
58
- # Offense count: 8
101
+ # Offense count: 9
59
102
  # Configuration parameters: CountComments, CountAsOne.
60
103
  Metrics/ModuleLength:
61
104
  Max: 199
62
105
 
63
- # Offense count: 2
106
+ # Offense count: 3
64
107
  # Configuration parameters: CountKeywordArgs.
65
108
  Metrics/ParameterLists:
66
109
  MaxOptionalParameters: 4
@@ -69,55 +112,62 @@ Metrics/ParameterLists:
69
112
  # Offense count: 2
70
113
  Naming/AccessorMethodName:
71
114
  Exclude:
72
- - 'lib/crowdin-api/api-resources/users.rb'
73
- - 'lib/crowdin-api/core/request.rb'
115
+ - 'lib/crowdin-api/api_resources/users.rb'
116
+ - 'lib/crowdin-api/core/send_request.rb'
74
117
 
75
- # Offense count: 3
118
+ # Offense count: 1
76
119
  # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
77
120
  # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
78
121
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
79
122
  Naming/FileName:
80
123
  Exclude:
81
124
  - 'lib/crowdin-api.rb'
82
- - 'spec/client/client-instance_spec.rb'
83
- - 'spec/client/configuration-instance_spec.rb'
84
125
 
85
- # Offense count: 3
126
+ # Offense count: 2
86
127
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
87
128
  # SupportedStylesForLeadingUnderscores: disallowed, required, optional
88
129
  Naming/MemoizedInstanceVariableName:
89
130
  Exclude:
90
131
  - 'lib/crowdin-api/client/client.rb'
91
132
 
92
- # Offense count: 3
93
- # Cop supports --auto-correct.
133
+ # Offense count: 6
134
+ # This cop supports safe auto-correction (--auto-correct).
94
135
  # Configuration parameters: PreferredName.
95
136
  Naming/RescuedExceptionsVariableName:
96
137
  Exclude:
97
- - 'lib/crowdin-api/core/request.rb'
138
+ - 'lib/crowdin-api/core/send_request.rb'
98
139
 
99
- # Offense count: 8
100
- # Cop supports --auto-correct.
140
+ # Offense count: 7
141
+ # This cop supports safe auto-correction (--auto-correct).
101
142
  # Configuration parameters: EnforcedStyle.
102
143
  # SupportedStyles: separated, grouped
103
144
  Style/AccessorGrouping:
104
145
  Exclude:
105
- - 'lib/crowdin-api/client/client.rb'
106
146
  - 'lib/crowdin-api/client/configuration.rb'
147
+ - 'lib/crowdin-api/core/request.rb'
107
148
 
108
- # Offense count: 2
109
- # Cop supports --auto-correct.
149
+ # Offense count: 4
150
+ # This cop supports unsafe auto-correction (--auto-correct-all).
110
151
  Style/CollectionCompact:
111
152
  Exclude:
112
153
  - 'lib/crowdin-api/core/request.rb'
154
+ - 'lib/crowdin-api/core/send_request.rb'
113
155
 
114
- # Offense count: 22
156
+ # Offense count: 24
115
157
  # Configuration parameters: AllowedConstants.
116
158
  Style/Documentation:
117
159
  Enabled: false
118
160
 
119
161
  # Offense count: 1
120
- # Cop supports --auto-correct.
162
+ # This cop supports safe auto-correction (--auto-correct).
163
+ # Configuration parameters: EnforcedStyle.
164
+ # SupportedStyles: allowed_in_returns, forbidden
165
+ Style/DoubleNegation:
166
+ Exclude:
167
+ - 'lib/crowdin-api/client/configuration.rb'
168
+
169
+ # Offense count: 1
170
+ # This cop supports safe auto-correction (--auto-correct).
121
171
  # Configuration parameters: EnforcedStyle.
122
172
  # SupportedStyles: always, always_true, never
123
173
  Style/FrozenStringLiteralComment:
@@ -130,17 +180,32 @@ Style/MixinUsage:
130
180
  - 'bin/crowdin-console'
131
181
 
132
182
  # Offense count: 2
133
- # Cop supports --auto-correct.
183
+ # This cop supports safe auto-correction (--auto-correct).
134
184
  # Configuration parameters: EnforcedStyle.
135
185
  # SupportedStyles: implicit, explicit
136
186
  Style/RescueStandardError:
137
187
  Exclude:
138
- - 'lib/crowdin-api/api-resources/labels.rb'
139
- - 'lib/crowdin-api/api-resources/string_translations.rb'
188
+ - 'lib/crowdin-api/api_resources/labels.rb'
189
+ - 'lib/crowdin-api/api_resources/string_translations.rb'
190
+
191
+ # Offense count: 1
192
+ # This cop supports unsafe auto-correction (--auto-correct-all).
193
+ # Configuration parameters: Mode.
194
+ Style/StringConcatenation:
195
+ Exclude:
196
+ - 'lib/crowdin-api/api_resources/projects.rb'
197
+
198
+ # Offense count: 8
199
+ # This cop supports safe auto-correction (--auto-correct).
200
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
201
+ # SupportedStyles: single_quotes, double_quotes
202
+ Style/StringLiterals:
203
+ Exclude:
204
+ - 'spec/api_resources/projects_spec.rb'
140
205
 
141
206
  # Offense count: 1
142
- # Cop supports --auto-correct.
207
+ # This cop supports safe auto-correction (--auto-correct).
143
208
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
144
209
  # URISchemes: http, https
145
210
  Layout/LineLength:
146
- Max: 122
211
+ Max: 121
data/README.md CHANGED
@@ -40,7 +40,7 @@ For more about Crowdin API v2 see the documentation:
40
40
  Add this line to your application's Gemfile:
41
41
 
42
42
  ```gemfile
43
- gem 'crowdin-api', '~> 1.2.1'
43
+ gem 'crowdin-api', '~> 1.3.0'
44
44
  ```
45
45
 
46
46
  And then execute:
@@ -74,7 +74,7 @@ crowdin = Crowdin::Client.new do |config|
74
74
  config.api_token = 'YourApiToken'
75
75
  end
76
76
 
77
- # Or you can intialize Enterprise Client instance by specifying your
77
+ # Or you can initialize Enterprise Client instance by specifying your
78
78
  # organization_domain in config options
79
79
  crowdin = Crowdin::Client.new do |config|
80
80
  config.api_token = 'YourEnterpriseApiToken'
@@ -82,7 +82,7 @@ crowdin = Crowdin::Client.new do |config|
82
82
  end
83
83
  # Note: we use full specified organization domain if that includes '.com'
84
84
  # config.organization_domain = your_domain -> https://your_domain.api.crowdin.com
85
- # config.organization_domain = your_domain.com -> your_domain.com
85
+ # config.organization_domain = your_domain.com -> https://your_domain.com
86
86
 
87
87
  # All supported Crowdin Client config options now:
88
88
  crowdin = Crowdin::Client.new do |config|
@@ -121,9 +121,9 @@ projects = crowdin.list_projects(offset: 10, limit: 20)
121
121
  project = crowdin.get_project(your_project_id)
122
122
 
123
123
  # Edit project
124
- project = crowdin.edit_project(project_id, [{op: 'replace',
125
- path: '/name',
126
- value: 'your_new_project_name'}])
124
+ project = crowdin.edit_project(project_id, [{ op: 'replace',
125
+ path: '/name',
126
+ value: 'your_new_project_name' }])
127
127
 
128
128
  # Add Storage
129
129
  storage = crowdin.add_storage(File.open('YourFilename.extension', 'r'))
@@ -141,6 +141,8 @@ file = crowdin.download_file(your_file_id, your_destination, your_project_id)
141
141
  file_revisions = crowdin.list_file_revisions(your_file_id, limit: 10)
142
142
  # or you can specify your project_id
143
143
  file_revisions = crowdin.list_file_revisions(your_file_id, { limit: 10 }, your_project_id)
144
+
145
+ # Note: more examples you can find in spec folder
144
146
  ```
145
147
 
146
148
  ### Command-Line Client
data/bin/crowdin-console CHANGED
@@ -12,7 +12,7 @@ require 'optparse'
12
12
  #
13
13
  # bundle exec crowdin-console --enable-logger --api-token YOUR_API_TOKEN --project-id YOUR_PROJECT_ID
14
14
  #
15
- # or Enterpise API:
15
+ # or Enterprise API:
16
16
  #
17
17
  # bundle exec crowdin-console --enterprise --api-token YOUR_ENTERPRISE_API_TOKEN --organization-domain YOUR_DOMAIN
18
18
  #
data/crowdin-api.gemspec CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |gem|
13
13
  gem.license = 'MIT'
14
14
 
15
15
  gem.files = `git ls-files`.split("\n")
16
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
16
  gem.require_paths = ['lib']
18
17
  gem.bindir = 'bin'
19
18
  gem.executables << 'crowdin-console'
@@ -25,9 +24,9 @@ Gem::Specification.new do |gem|
25
24
 
26
25
  gem.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.32'
27
26
  gem.add_development_dependency 'codecov', '~> 0.6.0'
27
+ gem.add_development_dependency 'pry', '~> 0.14.1'
28
28
  gem.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
29
29
  gem.add_development_dependency 'rspec', '~> 3.10'
30
30
  gem.add_development_dependency 'rubocop', '~> 1.23'
31
- gem.add_development_dependency 'sinatra', '~> 2.1'
32
31
  gem.add_development_dependency 'webmock', '~> 3.14'
33
32
  end
@@ -7,13 +7,12 @@ module Crowdin
7
7
  project_id || raise_project_id_is_required_error
8
8
 
9
9
  request = Web::Request.new(
10
- self,
10
+ connection,
11
11
  :get,
12
- "/projects/#{project_id}/dictionaries",
13
- query
12
+ "#{config.target_api_url}/projects/#{project_id}/dictionaries",
13
+ { params: query }
14
14
  )
15
-
16
- request.perform
15
+ Web::SendRequest.new(request).perform
17
16
  end
18
17
 
19
18
  def edit_dictionary(language_id = nil, query = {}, project_id = config.project_id)
@@ -21,13 +20,12 @@ module Crowdin
21
20
  project_id || raise_project_id_is_required_error
22
21
 
23
22
  request = Web::Request.new(
24
- self,
23
+ connection,
25
24
  :patch,
26
- "/projects/#{project_id}/dictionaries/#{language_id}",
27
- query
25
+ "#{config.target_api_url}/projects/#{project_id}/dictionaries/#{language_id}",
26
+ { params: query }
28
27
  )
29
-
30
- request.perform
28
+ Web::SendRequest.new(request).perform
31
29
  end
32
30
  end
33
31
  end
@@ -7,26 +7,24 @@ module Crowdin
7
7
  project_id || raise_project_id_is_required_error
8
8
 
9
9
  request = Web::Request.new(
10
- self,
10
+ connection,
11
11
  :get,
12
- "/projects/#{project_id}/distributions",
13
- query
12
+ "#{config.target_api_url}/projects/#{project_id}/distributions",
13
+ { params: query }
14
14
  )
15
-
16
- request.perform
15
+ Web::SendRequest.new(request).perform
17
16
  end
18
17
 
19
18
  def add_distribution(query = {}, project_id = config.project_id)
20
19
  project_id || raise_project_id_is_required_error
21
20
 
22
21
  request = Web::Request.new(
23
- self,
22
+ connection,
24
23
  :post,
25
- "/projects/#{project_id}/distributions",
26
- query
24
+ "#{config.target_api_url}/projects/#{project_id}/distributions",
25
+ { params: query }
27
26
  )
28
-
29
- request.perform
27
+ Web::SendRequest.new(request).perform
30
28
  end
31
29
 
32
30
  def get_distribution(hash = nil, project_id = config.project_id)
@@ -34,12 +32,11 @@ module Crowdin
34
32
  project_id || raise_project_id_is_required_error
35
33
 
36
34
  request = Web::Request.new(
37
- self,
35
+ connection,
38
36
  :get,
39
- "/projects/#{project_id}/distributions/#{hash}"
37
+ "#{config.target_api_url}/projects/#{project_id}/distributions/#{hash}"
40
38
  )
41
-
42
- request.perform
39
+ Web::SendRequest.new(request).perform
43
40
  end
44
41
 
45
42
  def delete_distribution(hash = nil, project_id = config.project_id)
@@ -47,12 +44,11 @@ module Crowdin
47
44
  project_id || raise_project_id_is_required_error
48
45
 
49
46
  request = Web::Request.new(
50
- self,
47
+ connection,
51
48
  :delete,
52
- "/projects/#{project_id}/distributions/#{hash}"
49
+ "#{config.target_api_url}/projects/#{project_id}/distributions/#{hash}"
53
50
  )
54
-
55
- request.perform
51
+ Web::SendRequest.new(request).perform
56
52
  end
57
53
 
58
54
  def edit_distribution(hash = nil, query = {}, project_id = config.project_id)
@@ -60,26 +56,24 @@ module Crowdin
60
56
  project_id || raise_project_id_is_required_error
61
57
 
62
58
  request = Web::Request.new(
63
- self,
59
+ connection,
64
60
  :patch,
65
- "/projects/#{project_id}/distributions/#{hash}",
66
- query
61
+ "#{config.target_api_url}/projects/#{project_id}/distributions/#{hash}",
62
+ { params: query }
67
63
  )
68
-
69
- request.perform
64
+ Web::SendRequest.new(request).perform
70
65
  end
71
66
 
72
- def get_destribution_release(hash = nil, project_id = config.project_id)
67
+ def get_distribution_release(hash = nil, project_id = config.project_id)
73
68
  hash || raise_parameter_is_required_error(:hash)
74
69
  project_id || raise_project_id_is_required_error
75
70
 
76
71
  request = Web::Request.new(
77
- self,
72
+ connection,
78
73
  :get,
79
- "/projects/#{project_id}/distributions/#{hash}/release"
74
+ "#{config.target_api_url}/projects/#{project_id}/distributions/#{hash}/release"
80
75
  )
81
-
82
- request.perform
76
+ Web::SendRequest.new(request).perform
83
77
  end
84
78
 
85
79
  def release_distribution(hash = nil, project_id = config.project_id)
@@ -87,12 +81,11 @@ module Crowdin
87
81
  project_id || raise_project_id_is_required_error
88
82
 
89
83
  request = Web::Request.new(
90
- self,
84
+ connection,
91
85
  :post,
92
- "/projects/#{project_id}/distributions/#{hash}/release"
86
+ "#{config.target_api_url}/projects/#{project_id}/distributions/#{hash}/release"
93
87
  )
94
-
95
- request.perform
88
+ Web::SendRequest.new(request).perform
96
89
  end
97
90
  end
98
91
  end