ruby-lokalise-api 4.3.0 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CONTRIBUTING.md +1 -1
- data/README.md +11 -3
- data/lib/ruby-lokalise-api/client.rb +4 -1
- data/lib/ruby-lokalise-api/collections/base.rb +19 -7
- data/lib/ruby-lokalise-api/collections/segment.rb +15 -0
- data/lib/ruby-lokalise-api/connection.rb +1 -1
- data/lib/ruby-lokalise-api/data/attributes.json +26 -0
- data/lib/ruby-lokalise-api/error.rb +4 -3
- data/lib/ruby-lokalise-api/oauth_client.rb +11 -0
- data/lib/ruby-lokalise-api/request.rb +3 -2
- data/lib/ruby-lokalise-api/resources/base.rb +18 -7
- data/lib/ruby-lokalise-api/resources/branch.rb +3 -1
- data/lib/ruby-lokalise-api/resources/contributor.rb +1 -1
- data/lib/ruby-lokalise-api/resources/custom_translation_status.rb +1 -1
- data/lib/ruby-lokalise-api/resources/key.rb +1 -0
- data/lib/ruby-lokalise-api/resources/key_comment.rb +1 -1
- data/lib/ruby-lokalise-api/resources/order.rb +1 -0
- data/lib/ruby-lokalise-api/resources/payment_card.rb +1 -0
- data/lib/ruby-lokalise-api/resources/project.rb +1 -0
- data/lib/ruby-lokalise-api/resources/project_comment.rb +1 -0
- data/lib/ruby-lokalise-api/resources/project_language.rb +1 -1
- data/lib/ruby-lokalise-api/resources/queued_process.rb +1 -1
- data/lib/ruby-lokalise-api/resources/screenshot.rb +1 -0
- data/lib/ruby-lokalise-api/resources/segment.rb +19 -0
- data/lib/ruby-lokalise-api/resources/snapshot.rb +1 -0
- data/lib/ruby-lokalise-api/resources/task.rb +1 -0
- data/lib/ruby-lokalise-api/resources/team_user.rb +1 -1
- data/lib/ruby-lokalise-api/resources/team_user_billing_details.rb +14 -0
- data/lib/ruby-lokalise-api/resources/team_user_group.rb +1 -1
- data/lib/ruby-lokalise-api/resources/translation.rb +1 -0
- data/lib/ruby-lokalise-api/resources/translation_provider.rb +1 -1
- data/lib/ruby-lokalise-api/resources/webhook.rb +1 -0
- data/lib/ruby-lokalise-api/rest/segments.rb +43 -0
- data/lib/ruby-lokalise-api/rest/team_user_billing_details.rb +34 -0
- data/lib/ruby-lokalise-api/utils/attribute_helpers.rb +3 -1
- data/lib/ruby-lokalise-api/utils/string_utils.rb +24 -18
- data/lib/ruby-lokalise-api/version.rb +1 -1
- data/lib/ruby-lokalise-api.rb +19 -1
- data/ruby-lokalise-api.gemspec +18 -15
- data/spec/lib/ruby-lokalise-api/connection_spec.rb +6 -0
- data/spec/lib/ruby-lokalise-api/error_spec.rb +8 -0
- data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +2 -2
- data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +1 -1
- data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +2 -2
- data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +1 -1
- data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +2 -2
- data/spec/lib/ruby-lokalise-api/rest/segments_spec.rb +106 -0
- data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +1 -1
- data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +2 -2
- data/spec/lib/ruby-lokalise-api/rest/team_user_billing_details_spec.rb +48 -0
- data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +1 -1
- data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +1 -1
- data/spec/lib/ruby-lokalise-api_spec.rb +16 -1
- data/spec/support/test_client.rb +4 -0
- metadata +19 -10
- data/spec/lib/ruby-lokalise-api/utils/snakecase_spec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3db69f1caef4a81c8cb7da9cafb25e68dc4d98abcf7c5806fb748370cd5a335
|
4
|
+
data.tar.gz: 22e61446ba7bb1b9e0a446c2a0411e1f0fa27ef7615d78fc1eb50f4da9b63411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b8381002e892638238ecd2fcd50f3052f7f18e454dab05e3962fbfe61d36b17be3488ce9af3eaaf64733684e25c7f888a24a350601672f3bfc493ac6670c22
|
7
|
+
data.tar.gz: 0dc3679409dd32bf1eeac182a17b21114b2233bc7b9dc33d0e74bae48f9361557d067c576cba49f90b773dd74b304157b54d58e8e2e67550511fd275c22944e6
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
2. [Create a topic branch.][branch]
|
5
5
|
3. Implement your feature or bug fix.
|
6
6
|
4. Don't forget to add specs and make sure they pass by running `rspec .`.
|
7
|
-
5. Make sure your code complies with the style guide by running `rubocop`. `rubocop -a` can automatically fix most issues for you.
|
7
|
+
5. Make sure your code complies with the style guide by running `rubocop`. `rubocop -a` can automatically fix most issues for you. Run `rubocop -A` to make it more aggressive.
|
8
8
|
6. If necessary, add documentation for your feature or bug fix.
|
9
9
|
7. Commit and push your changes.
|
10
10
|
8. [Submit a pull request.][pr]
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Lokalise API v2 official Ruby interface
|
2
2
|
|
3
3
|
![Gem](https://img.shields.io/gem/v/ruby-lokalise-api)
|
4
|
-
|
4
|
+
![CI](https://github.com/lokalise/ruby-lokalise-api/actions/workflows/ci.yml/badge.svg)
|
5
5
|
[![Test Coverage](https://codecov.io/gh/lokalise/ruby-lokalise-api/graph/badge.svg)](https://codecov.io/gh/lokalise/ruby-lokalise-api)
|
6
6
|
![Downloads total](https://img.shields.io/gem/dt/ruby-lokalise-api)
|
7
7
|
|
8
8
|
Official opinionated Ruby interface for the [Lokalise API](https://app.lokalise.com/api2docs/curl/) that represents returned data as Ruby objects.
|
9
9
|
|
10
|
-
Looking for a Rails integration? Try the
|
10
|
+
Looking for a Rails integration? Try the [lokalise_rails gem](https://github.com/bodrovis/lokalise_rails). Also you can use a [lokalise_manager gem](https://github.com/bodrovis/lokalise_manager) which allows to exchange translation files between Lokalise and *any* Ruby script.
|
11
11
|
|
12
12
|
## Quickstart
|
13
13
|
|
@@ -39,12 +39,20 @@ process = @client.upload_file project_id,
|
|
39
39
|
process.status
|
40
40
|
```
|
41
41
|
|
42
|
+
Alternatively instantiate your client with an [OAuth2 token](http://docs.lokalise.com/en/articles/5574713-oauth-2):
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
@client = Lokalise.oauth_client 'YOUR_OAUTH_TOKEN_HERE'
|
46
|
+
```
|
47
|
+
|
42
48
|
## Usage
|
43
49
|
|
44
50
|
Detailed documentation can be found at [lokalise.github.io/ruby-lokalise-api](https://lokalise.github.io/ruby-lokalise-api/).
|
45
51
|
|
52
|
+
You can also check [this repo containing some usage examples](https://github.com/bodrovis-learning/Lokalise-APIv2-Samples) and [this blog post with explanations](https://lokalise.com/blog/lokalise-apiv2-in-practice).
|
53
|
+
|
46
54
|
## License
|
47
55
|
|
48
56
|
This gem is licensed under the [BSD 3 Clause license](https://github.com/lokalise/ruby-lokalise-api/blob/master/LICENSE). Prior to version 4 the license type was MIT.
|
49
57
|
|
50
|
-
Copyright (c) [Lokalise team](http://lokalise.co)
|
58
|
+
Copyright (c) [Lokalise team](http://lokalise.co) and [Ilya Bodrov](http://bodrovis.tech)
|
@@ -20,10 +20,12 @@ require 'ruby-lokalise-api/rest/translation_providers'
|
|
20
20
|
require 'ruby-lokalise-api/rest/team_user_group'
|
21
21
|
require 'ruby-lokalise-api/rest/custom_translation_statuses'
|
22
22
|
require 'ruby-lokalise-api/rest/webhooks'
|
23
|
+
require 'ruby-lokalise-api/rest/segments'
|
24
|
+
require 'ruby-lokalise-api/rest/team_user_billing_details'
|
23
25
|
|
24
26
|
module Lokalise
|
25
27
|
class Client
|
26
|
-
attr_reader :token
|
28
|
+
attr_reader :token, :token_header
|
27
29
|
attr_accessor :timeout, :open_timeout, :enable_compression
|
28
30
|
|
29
31
|
def initialize(token, params = {})
|
@@ -31,6 +33,7 @@ module Lokalise
|
|
31
33
|
@timeout = params.fetch(:timeout, nil)
|
32
34
|
@open_timeout = params.fetch(:open_timeout, nil)
|
33
35
|
@enable_compression = params.fetch(:enable_compression, false)
|
36
|
+
@token_header = 'x-api-token'
|
34
37
|
end
|
35
38
|
|
36
39
|
# rubocop:disable Metrics/ParameterLists
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Lokalise
|
4
4
|
module Collections
|
5
5
|
class Base
|
6
|
+
using Lokalise::Utils::StringUtils
|
7
|
+
|
6
8
|
extend Lokalise::Request
|
7
9
|
extend Lokalise::Utils::AttributeHelpers
|
8
10
|
include Lokalise::Utils::AttributeHelpers
|
@@ -19,14 +21,8 @@ module Lokalise
|
|
19
21
|
def initialize(response, params = {})
|
20
22
|
produce_collection_for response
|
21
23
|
populate_pagination_data_for response
|
22
|
-
# Project, team id, user id, and branch may not be present in some cases
|
23
|
-
@project_id = response['content']['project_id']
|
24
|
-
@team_id = response['content']['team_id']
|
25
|
-
@user_id = response['content']['user_id']
|
26
|
-
@branch = response['content']['branch']
|
27
24
|
@request_params = params
|
28
|
-
|
29
|
-
@path = response['path']
|
25
|
+
popular_common_attrs response
|
30
26
|
end
|
31
27
|
|
32
28
|
class << self
|
@@ -90,6 +86,8 @@ module Lokalise
|
|
90
86
|
# Dynamically produces collection of resources based on the given response
|
91
87
|
# Collection example: `{ "content": {"comments": [ ... ]} }`
|
92
88
|
def produce_collection_for(response)
|
89
|
+
return unless response['content']
|
90
|
+
|
93
91
|
model_class = self.class.name.base_class_name
|
94
92
|
data_key_plural = data_key_for model_class: model_class, plural: true, collection: true
|
95
93
|
|
@@ -101,6 +99,20 @@ module Lokalise
|
|
101
99
|
'base_path' => response['path']
|
102
100
|
end
|
103
101
|
end
|
102
|
+
|
103
|
+
def popular_common_attrs(response)
|
104
|
+
@client = response['client']
|
105
|
+
@path = response['path']
|
106
|
+
|
107
|
+
return unless response['content']
|
108
|
+
|
109
|
+
content = response['content']
|
110
|
+
# Project, team id, user id, and branch may not be present in some cases
|
111
|
+
@project_id = content['project_id']
|
112
|
+
@team_id = content['team_id']
|
113
|
+
@user_id = content['user_id']
|
114
|
+
@branch = content['branch']
|
115
|
+
end
|
104
116
|
end
|
105
117
|
end
|
106
118
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lokalise
|
4
|
+
module Collections
|
5
|
+
class Segment < Base
|
6
|
+
class << self
|
7
|
+
def endpoint(project_id, key_id, lang_iso, *_args)
|
8
|
+
path_from projects: project_id,
|
9
|
+
keys: key_id,
|
10
|
+
segments: lang_iso
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -134,6 +134,20 @@
|
|
134
134
|
"created_at",
|
135
135
|
"created_at_timestamp"
|
136
136
|
],
|
137
|
+
"segment": [
|
138
|
+
"segment_number",
|
139
|
+
"language_iso",
|
140
|
+
"modified_at",
|
141
|
+
"modified_at_timestamp",
|
142
|
+
"modified_by",
|
143
|
+
"modified_by_email",
|
144
|
+
"value",
|
145
|
+
"is_fuzzy",
|
146
|
+
"is_reviewed",
|
147
|
+
"reviewed_by",
|
148
|
+
"words",
|
149
|
+
"custom_translation_statuses"
|
150
|
+
],
|
137
151
|
"snapshot": [
|
138
152
|
"snapshot_id",
|
139
153
|
"title",
|
@@ -188,6 +202,18 @@
|
|
188
202
|
"created_at_timestamp",
|
189
203
|
"role"
|
190
204
|
],
|
205
|
+
"team_user_billing_details": [
|
206
|
+
"billing_email",
|
207
|
+
"country_code",
|
208
|
+
"zip",
|
209
|
+
"state_code",
|
210
|
+
"address1",
|
211
|
+
"address2",
|
212
|
+
"city",
|
213
|
+
"phone",
|
214
|
+
"company",
|
215
|
+
"vatnumber"
|
216
|
+
],
|
191
217
|
"team_user_group": [
|
192
218
|
"group_id",
|
193
219
|
"name",
|
@@ -13,7 +13,7 @@ module Lokalise
|
|
13
13
|
TooManyRequests = Class.new(ClientError)
|
14
14
|
Forbidden = Class.new(ClientError)
|
15
15
|
Locked = Class.new(ClientError)
|
16
|
-
|
16
|
+
MethodNotAllowed = Class.new(ClientError)
|
17
17
|
|
18
18
|
NotImplemented = Class.new(ServerError)
|
19
19
|
BadGateway = Class.new(ServerError)
|
@@ -25,7 +25,7 @@ module Lokalise
|
|
25
25
|
401 => Lokalise::Error::Unauthorized,
|
26
26
|
403 => Lokalise::Error::Forbidden,
|
27
27
|
404 => Lokalise::Error::NotFound,
|
28
|
-
405 => Lokalise::Error::
|
28
|
+
405 => Lokalise::Error::MethodNotAllowed,
|
29
29
|
406 => Lokalise::Error::NotAcceptable,
|
30
30
|
409 => Lokalise::Error::Conflict,
|
31
31
|
423 => Lokalise::Error::Locked,
|
@@ -39,7 +39,8 @@ module Lokalise
|
|
39
39
|
class << self
|
40
40
|
# Create a new error from an HTTP response
|
41
41
|
def from_response(body)
|
42
|
-
|
42
|
+
msg = body.key?('error') ? body['error']['message'] : body['message']
|
43
|
+
new msg.to_s
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -58,7 +58,8 @@ module Lokalise
|
|
58
58
|
def respond_with(response, client)
|
59
59
|
body = custom_load response.body
|
60
60
|
uri = Addressable::URI.parse response.env.url
|
61
|
-
|
61
|
+
status = response.status
|
62
|
+
respond_with_error status, body if status.between?(400, 599) || (body.respond_to?(:has_key?) && body.key?('error'))
|
62
63
|
extract_headers_from(response).
|
63
64
|
merge('content' => body,
|
64
65
|
'client' => client,
|
@@ -74,7 +75,7 @@ module Lokalise
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def respond_with_error(code, body)
|
77
|
-
raise(Lokalise::Error, body['error']) unless Lokalise::Error::ERRORS.key? code
|
78
|
+
raise(Lokalise::Error, body['error'] || body) unless Lokalise::Error::ERRORS.key? code
|
78
79
|
|
79
80
|
raise Lokalise::Error::ERRORS[code].from_response(body)
|
80
81
|
end
|
@@ -3,12 +3,14 @@
|
|
3
3
|
module Lokalise
|
4
4
|
module Resources
|
5
5
|
class Base
|
6
|
+
using Lokalise::Utils::StringUtils
|
7
|
+
|
6
8
|
extend Lokalise::Request
|
7
9
|
extend Lokalise::Utils::AttributeHelpers
|
8
10
|
include Lokalise::Utils::AttributeHelpers
|
9
11
|
extend Lokalise::Utils::EndpointHelpers
|
10
12
|
|
11
|
-
attr_reader :raw_data, :project_id, :client, :path, :branch, :user_id, :team_id
|
13
|
+
attr_reader :raw_data, :project_id, :client, :path, :branch, :user_id, :team_id, :key_id
|
12
14
|
|
13
15
|
# Initializes a new resource based on the response.
|
14
16
|
# `endpoint_generator` is used in cases when a new instance is generated
|
@@ -107,10 +109,11 @@ module Lokalise
|
|
107
109
|
end
|
108
110
|
|
109
111
|
def produce_resource(model_class, response)
|
112
|
+
content = response['content']
|
110
113
|
data_key_singular = data_key_for model_class: model_class
|
111
|
-
if
|
112
|
-
data =
|
113
|
-
|
114
|
+
if content.key? data_key_singular
|
115
|
+
data = content.delete data_key_singular
|
116
|
+
content.merge! data
|
114
117
|
end
|
115
118
|
|
116
119
|
new response
|
@@ -131,7 +134,7 @@ module Lokalise
|
|
131
134
|
|
132
135
|
def path_with_id(response, id_key, data_key, endpoint_generator = nil)
|
133
136
|
# Some resources do not have ids at all
|
134
|
-
return
|
137
|
+
return unless response['content'] && (response['content'].key?(id_key) || response['content'].key?(data_key))
|
135
138
|
|
136
139
|
# ID of the resource
|
137
140
|
id = id_from response, id_key, data_key
|
@@ -155,15 +158,20 @@ module Lokalise
|
|
155
158
|
# Content may be `{"project_id": '123', ...}` or {"snapshot": {"snapshot_id": '123', ...}}
|
156
159
|
# Sometimes there is an `id_key` but it has a value of `null`
|
157
160
|
# (for example when we do not place the actual order but only check its price).
|
161
|
+
# In rare cases the actual identifier does not have an "_id" suffix
|
162
|
+
# (for segments that have "segment_number" field instead)
|
158
163
|
# Therefore we must explicitly check if the key is present
|
159
|
-
|
164
|
+
content = response['content']
|
165
|
+
return content[id_key] if content.respond_to?(:key?) && content&.key?(id_key)
|
160
166
|
|
161
|
-
|
167
|
+
content[data_key][id_key]
|
162
168
|
end
|
163
169
|
|
164
170
|
# Store all resources attributes under the corresponding instance variables.
|
165
171
|
# `ATTRIBUTES` is defined inside resource-specific classes
|
166
172
|
def populate_attributes_for(content)
|
173
|
+
return unless content
|
174
|
+
|
167
175
|
data_key = data_key_for model_class: self.class.name.base_class_name
|
168
176
|
|
169
177
|
self.class.const_get(:ATTRIBUTES).each do |attr|
|
@@ -181,10 +189,13 @@ module Lokalise
|
|
181
189
|
# Some of them may be absent in certain cases.
|
182
190
|
# rubocop:disable Naming/MemoizedInstanceVariableName
|
183
191
|
def extract_common_attributes_for(content)
|
192
|
+
return unless content
|
193
|
+
|
184
194
|
@raw_data = content
|
185
195
|
@project_id ||= content['project_id']
|
186
196
|
@user_id ||= content['user_id']
|
187
197
|
@team_id ||= content['team_id']
|
198
|
+
@key_id ||= content['key_id']
|
188
199
|
@branch ||= content['branch']
|
189
200
|
end
|
190
201
|
# rubocop:enable Naming/MemoizedInstanceVariableName
|
@@ -3,10 +3,12 @@
|
|
3
3
|
module Lokalise
|
4
4
|
module Resources
|
5
5
|
class Branch < Base
|
6
|
+
ID_KEY = 'branch_id'
|
6
7
|
supports :update, :destroy, [:reload_data, '', :find]
|
7
8
|
|
8
9
|
def merge(params = {})
|
9
|
-
|
10
|
+
klass = self.class
|
11
|
+
klass.merge @client, klass.endpoint(project_id, branch_id, :merge), params
|
10
12
|
end
|
11
13
|
|
12
14
|
class << self
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lokalise
|
4
|
+
module Resources
|
5
|
+
class Segment < Base
|
6
|
+
DATA_KEY = 'Segment'
|
7
|
+
ID_KEY = 'segment_number'
|
8
|
+
supports :update, [:reload_data, '', :find]
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def endpoint(project_id, key_id, lang_iso, segment_number = nil)
|
12
|
+
path_from projects: project_id,
|
13
|
+
keys: key_id,
|
14
|
+
segments: [lang_iso, segment_number]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lokalise
|
4
|
+
class Client
|
5
|
+
# Returns all segments for the given key and language ISO code
|
6
|
+
#
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-segments-for-key-language-get
|
8
|
+
# @return [Lokalise::Collection::Segments<Lokalise::Resources::Segment>]
|
9
|
+
# @param project_id [String]
|
10
|
+
# @param key_id [String, Integer]
|
11
|
+
# @param lang_iso [String]
|
12
|
+
# @param params [Hash]
|
13
|
+
def segments(project_id, key_id, lang_iso, params = {})
|
14
|
+
c_r Lokalise::Collections::Segment, :all, [project_id, key_id, lang_iso], params
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns a segment under a given number for the given key and language ISO code
|
18
|
+
#
|
19
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-segment-for-key-language-get
|
20
|
+
# @return [Lokalise::Resources::Segment]
|
21
|
+
# @param project_id [String]
|
22
|
+
# @param key_id [String, Integer]
|
23
|
+
# @param lang_iso [String]
|
24
|
+
# @params segment_number [Integer, String]
|
25
|
+
# @param params [Hash]
|
26
|
+
def segment(project_id, key_id, lang_iso, segment_number, params = {})
|
27
|
+
c_r Lokalise::Resources::Segment, :find, [project_id, key_id, lang_iso, segment_number], params
|
28
|
+
end
|
29
|
+
|
30
|
+
# Updates a segment under a given number for the given key and language ISO code
|
31
|
+
#
|
32
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-segment-post
|
33
|
+
# @return [Lokalise::Resources::Segment]
|
34
|
+
# @param project_id [String]
|
35
|
+
# @param key_id [String, Integer]
|
36
|
+
# @param lang_iso [String]
|
37
|
+
# @params segment_number [Integer, String]
|
38
|
+
# @param params [Hash]
|
39
|
+
def update_segment(project_id, key_id, lang_iso, segment_number, params = {})
|
40
|
+
c_r Lokalise::Resources::Segment, :update, [project_id, key_id, lang_iso, segment_number], params
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lokalise
|
4
|
+
class Client
|
5
|
+
# Returns team user billing details
|
6
|
+
#
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-team-user-billing-details-get
|
8
|
+
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
9
|
+
# @param team_id [String]
|
10
|
+
def team_user_billing_details(team_id)
|
11
|
+
c_r Lokalise::Resources::TeamUserBillingDetails, :find, team_id
|
12
|
+
end
|
13
|
+
|
14
|
+
# Creates team user billing details
|
15
|
+
#
|
16
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-team-user-billing-details-post
|
17
|
+
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
18
|
+
# @param team_id [String]
|
19
|
+
# @param params [Hash]
|
20
|
+
def create_team_user_billing_details(team_id, params)
|
21
|
+
c_r Lokalise::Resources::TeamUserBillingDetails, :create, team_id, params
|
22
|
+
end
|
23
|
+
|
24
|
+
# Updates team user billing details
|
25
|
+
#
|
26
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-team-user-billing-details-post
|
27
|
+
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
28
|
+
# @param team_id [String]
|
29
|
+
# @param params [Hash]
|
30
|
+
def update_team_user_billing_details(team_id, params)
|
31
|
+
c_r Lokalise::Resources::TeamUserBillingDetails, :update, team_id, params
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|