4me-sdk 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/README.md +8 -0
- data/lib/sdk4me/client.rb +3 -1
- data/lib/sdk4me/client/version.rb +1 -1
- data/spec/lib/sdk4me/client_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 864b07c2b953a22cde7b603d2ca40e0c922af5ab
|
4
|
+
data.tar.gz: 191f083e0183d044f77c9872a3b28f6e3541bf24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161e613f6c9e5af777051f09aad8c83cd4ade36395550e0c4da63c8d7ee4a399f161aadbd0c3ee965db44864c2faa3ed4f336017b98e85b9196c6a0ee8844d13
|
7
|
+
data.tar.gz: 348aa6bb7536b81c6cf0642e0b7376c3aea935d88dc6743af82cdf563b023d92f82773f72ef500c44458a448eb96b0027bce74d9e4b79f7f9c2901f3483bb013
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
4me-sdk (1.1.
|
5
|
-
activesupport
|
6
|
-
gem_config
|
7
|
-
mime-types
|
4
|
+
4me-sdk (1.1.4)
|
5
|
+
activesupport (>= 4.2)
|
6
|
+
gem_config (>= 0.3)
|
7
|
+
mime-types (>= 3.0)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
@@ -32,19 +32,19 @@ GEM
|
|
32
32
|
minitest (5.11.3)
|
33
33
|
public_suffix (3.0.3)
|
34
34
|
rake (12.3.1)
|
35
|
-
rspec (3.
|
36
|
-
rspec-core (~> 3.
|
37
|
-
rspec-expectations (~> 3.
|
38
|
-
rspec-mocks (~> 3.
|
39
|
-
rspec-core (3.
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-expectations (3.
|
35
|
+
rspec (3.8.0)
|
36
|
+
rspec-core (~> 3.8.0)
|
37
|
+
rspec-expectations (~> 3.8.0)
|
38
|
+
rspec-mocks (~> 3.8.0)
|
39
|
+
rspec-core (3.8.0)
|
40
|
+
rspec-support (~> 3.8.0)
|
41
|
+
rspec-expectations (3.8.2)
|
42
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-mocks (3.
|
43
|
+
rspec-support (~> 3.8.0)
|
44
|
+
rspec-mocks (3.8.0)
|
45
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-support (3.
|
46
|
+
rspec-support (~> 3.8.0)
|
47
|
+
rspec-support (3.8.0)
|
48
48
|
safe_yaml (1.0.4)
|
49
49
|
simplecov (0.16.1)
|
50
50
|
docile (~> 1.1)
|
@@ -71,4 +71,4 @@ DEPENDENCIES
|
|
71
71
|
webmock (~> 2)
|
72
72
|
|
73
73
|
BUNDLED WITH
|
74
|
-
1.16.
|
74
|
+
1.16.2
|
data/README.md
CHANGED
@@ -309,6 +309,14 @@ By default all actions on the 4me SDK Client will block until the 4me API is acc
|
|
309
309
|
By setting the _block_at_rate_limit_ to `true` in the [configuration](#configuration) all actions will also block in case the [rate limit](http://developer.4me.com/v1/#rate-limiting) is reached. The action is retried every 5 minutes until the [rate limit](http://developer.4me.com/v1/#rate-limiting) is lifted again, which might take up to 1 hour.
|
310
310
|
|
311
311
|
|
312
|
+
### Translations
|
313
|
+
|
314
|
+
When exporting translations, the _locale_ parameter is required:
|
315
|
+
|
316
|
+
```
|
317
|
+
response = Itrp::Client.new.export('translations', nil, false, 'nl')
|
318
|
+
```
|
319
|
+
|
312
320
|
### Exception handling
|
313
321
|
|
314
322
|
The standard methods `get`, `post`, `put` and `delete` will always return a Response with an [error message](http://developer.4me.com/v1/#http-status-codes) in case something went wrong.
|
data/lib/sdk4me/client.rb
CHANGED
@@ -151,10 +151,12 @@ module Sdk4me
|
|
151
151
|
# @param types: The types to export, e.g. person, organization, people_contact_details
|
152
152
|
# @param from: Retrieve all files since a given data and time
|
153
153
|
# @param block_until_completed: Set to true to monitor the export progress
|
154
|
+
# @param locale: Required for translations export
|
154
155
|
# @raise Sdk4me::Exception in case the export progress could not be monitored
|
155
|
-
def export(types, from = nil, block_until_completed = false)
|
156
|
+
def export(types, from = nil, block_until_completed = false, locale = nil)
|
156
157
|
data = {type: [types].flatten.join(',')}
|
157
158
|
data[:from] = from unless from.blank?
|
159
|
+
data[:locale] = locale unless locale.blank?
|
158
160
|
response = post('/export', data)
|
159
161
|
if response.valid?
|
160
162
|
if response.raw.code.to_s == '204'
|
@@ -402,6 +402,14 @@ describe Sdk4me::Client do
|
|
402
402
|
expect(response[:token]).to eq('68ef5ef0f64c0')
|
403
403
|
end
|
404
404
|
|
405
|
+
it 'should export with locale' do
|
406
|
+
stub_request(:post, 'https://api.4me.com/v1/export').with(basic_auth: ['secret', 'x']).with(body: {type: 'translations', locale: 'nl'}).to_return(body: {token: '68ef5ef0f64c0'}.to_json)
|
407
|
+
expect_log("Export for 'translations' successfully queued with token '68ef5ef0f64c0'.")
|
408
|
+
|
409
|
+
response = @client.export('translations', nil, nil, 'nl')
|
410
|
+
expect(response[:token]).to eq('68ef5ef0f64c0')
|
411
|
+
end
|
412
|
+
|
405
413
|
it 'should wait for the export to complete' do
|
406
414
|
stub_request(:post, 'https://api.4me.com/v1/export').with(basic_auth: ['secret', 'x']).with(body: {type: 'people'}).to_return(body: {token: '68ef5ef0f64c0'}.to_json)
|
407
415
|
progress_stub = stub_request(:get, 'https://api.4me.com/v1/export/68ef5ef0f64c0').with(basic_auth: ['secret', 'x'])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 4me-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 4me
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|