4me-sdk 1.1.5 → 2.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/4me-sdk.gemspec +12 -13
- data/Gemfile.lock +58 -39
- data/LICENSE +1 -1
- data/README.md +64 -39
- data/lib/sdk4me.rb +10 -8
- data/lib/sdk4me/ca-bundle.crt +1327 -1802
- data/lib/sdk4me/client.rb +116 -92
- data/lib/sdk4me/client/attachments.rb +106 -76
- data/lib/sdk4me/client/multipart.rb +16 -18
- data/lib/sdk4me/client/response.rb +22 -19
- data/lib/sdk4me/client/version.rb +1 -1
- data/spec/lib/sdk4me/attachments_spec.rb +307 -143
- data/spec/lib/sdk4me/certificate_spec.rb +17 -4
- data/spec/lib/sdk4me/client_spec.rb +490 -475
- data/spec/lib/sdk4me/response_spec.rb +249 -233
- data/spec/lib/sdk4me_spec.rb +9 -9
- data/spec/spec_helper.rb +5 -8
- data/spec/support/matchers/never_raise.rb +16 -21
- data/spec/support/util.rb +2 -2
- metadata +38 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c4c1ac14f3525802639a4aa78223d0635533ffee6527fed0a02e9f8b41aca54
|
4
|
+
data.tar.gz: 5e8b18fa02b940a0883b2ed6349a619cda9048201c87c4d953f53e373e64d88f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0752a3cac273d81a7cafa7d43ca5a69088db6143418a9bb70b6a95f1111db422d8eb03d8f669f5d74efd1f0e05d2004f284f21e173605da0f4f3fcb601d62b
|
7
|
+
data.tar.gz: 41079af50a9db8a791614849197a5d5aee2049d1b2f9900c345802ff1a6439869f86f9f341309883cfe2c0233c590f352b1ef4c9f5ba81f4cf7506183d95c139
|
data/4me-sdk.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'sdk4me/client/version'
|
5
4
|
|
@@ -7,34 +6,34 @@ Gem::Specification.new do |spec|
|
|
7
6
|
spec.name = '4me-sdk'
|
8
7
|
spec.version = Sdk4me::Client::VERSION
|
9
8
|
spec.platform = Gem::Platform::RUBY
|
10
|
-
spec.required_ruby_version = '>= 2.
|
9
|
+
spec.required_ruby_version = '>= 2.5.0'
|
11
10
|
spec.authors = ['4me']
|
12
|
-
spec.email =
|
13
|
-
spec.description =
|
14
|
-
spec.summary =
|
15
|
-
spec.homepage =
|
11
|
+
spec.email = 'developers@4me.com'
|
12
|
+
spec.description = 'SDK for accessing the 4me REST API'
|
13
|
+
spec.summary = 'The official 4me SDK for Ruby. Provides easy access to the REST APIs found at https://developer.4me.com'
|
14
|
+
spec.homepage = 'https://github.com/code4me/4me-sdk-ruby'
|
16
15
|
spec.license = 'MIT'
|
17
16
|
|
18
|
-
spec.files = Dir.glob('lib/**/*') + %w
|
17
|
+
spec.files = Dir.glob('lib/**/*') + %w[
|
19
18
|
LICENSE
|
20
19
|
README.md
|
21
20
|
Gemfile
|
22
21
|
Gemfile.lock
|
23
22
|
4me-sdk.gemspec
|
24
|
-
|
25
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
]
|
24
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
26
25
|
spec.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
27
26
|
spec.require_paths = ['lib']
|
28
27
|
spec.rdoc_options = ['--charset=UTF-8']
|
29
28
|
|
30
|
-
spec.add_runtime_dependency 'gem_config', '>=0.3'
|
31
29
|
spec.add_runtime_dependency 'activesupport', '>= 4.2'
|
30
|
+
spec.add_runtime_dependency 'gem_config', '>=0.3'
|
32
31
|
spec.add_runtime_dependency 'mime-types', '>= 3.0'
|
33
32
|
|
34
33
|
spec.add_development_dependency 'bundler', '~> 1'
|
35
34
|
spec.add_development_dependency 'rake', '~> 12'
|
36
35
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
37
|
-
spec.add_development_dependency '
|
36
|
+
spec.add_development_dependency 'rubocop', '>= 0.49.0'
|
38
37
|
spec.add_development_dependency 'simplecov', '~> 0'
|
39
|
-
|
38
|
+
spec.add_development_dependency 'webmock', '~> 3'
|
40
39
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
4me-sdk (
|
4
|
+
4me-sdk (2.0.0.pre.rc.1)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
gem_config (>= 0.3)
|
7
7
|
mime-types (>= 3.0)
|
@@ -9,55 +9,73 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (6.0.3.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
+
addressable (2.7.0)
|
19
|
+
public_suffix (>= 2.0.2, < 5.0)
|
20
|
+
ast (2.4.1)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
crack (0.4.4)
|
23
|
+
diff-lcs (1.4.4)
|
24
|
+
docile (1.3.2)
|
25
|
+
gem_config (0.3.2)
|
26
|
+
hashdiff (1.0.1)
|
27
|
+
i18n (1.8.5)
|
27
28
|
concurrent-ruby (~> 1.0)
|
28
|
-
|
29
|
-
mime-types (3.2.2)
|
29
|
+
mime-types (3.3.1)
|
30
30
|
mime-types-data (~> 3.2015)
|
31
|
-
mime-types-data (3.
|
32
|
-
minitest (5.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
rspec
|
31
|
+
mime-types-data (3.2020.1104)
|
32
|
+
minitest (5.14.2)
|
33
|
+
parallel (1.19.2)
|
34
|
+
parser (2.7.2.0)
|
35
|
+
ast (~> 2.4.1)
|
36
|
+
public_suffix (4.0.6)
|
37
|
+
rainbow (3.0.0)
|
38
|
+
rake (12.3.3)
|
39
|
+
regexp_parser (1.8.2)
|
40
|
+
rexml (3.2.4)
|
41
|
+
rspec (3.10.0)
|
42
|
+
rspec-core (~> 3.10.0)
|
43
|
+
rspec-expectations (~> 3.10.0)
|
44
|
+
rspec-mocks (~> 3.10.0)
|
45
|
+
rspec-core (3.10.0)
|
46
|
+
rspec-support (~> 3.10.0)
|
47
|
+
rspec-expectations (3.10.0)
|
42
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-mocks (3.10.0)
|
45
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-support (3.
|
48
|
-
|
49
|
-
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-support (3.10.0)
|
54
|
+
rubocop (0.93.1)
|
55
|
+
parallel (~> 1.10)
|
56
|
+
parser (>= 2.7.1.5)
|
57
|
+
rainbow (>= 2.2.2, < 4.0)
|
58
|
+
regexp_parser (>= 1.8)
|
59
|
+
rexml
|
60
|
+
rubocop-ast (>= 0.6.0)
|
61
|
+
ruby-progressbar (~> 1.7)
|
62
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
63
|
+
rubocop-ast (1.1.1)
|
64
|
+
parser (>= 2.7.1.5)
|
65
|
+
ruby-progressbar (1.10.1)
|
66
|
+
simplecov (0.19.1)
|
50
67
|
docile (~> 1.1)
|
51
|
-
|
52
|
-
|
53
|
-
simplecov-html (0.10.2)
|
68
|
+
simplecov-html (~> 0.11)
|
69
|
+
simplecov-html (0.12.3)
|
54
70
|
thread_safe (0.3.6)
|
55
|
-
tzinfo (1.2.
|
71
|
+
tzinfo (1.2.7)
|
56
72
|
thread_safe (~> 0.1)
|
57
|
-
|
73
|
+
unicode-display_width (1.7.0)
|
74
|
+
webmock (3.9.4)
|
58
75
|
addressable (>= 2.3.6)
|
59
76
|
crack (>= 0.3.2)
|
60
|
-
hashdiff
|
77
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
78
|
+
zeitwerk (2.4.1)
|
61
79
|
|
62
80
|
PLATFORMS
|
63
81
|
ruby
|
@@ -67,8 +85,9 @@ DEPENDENCIES
|
|
67
85
|
bundler (~> 1)
|
68
86
|
rake (~> 12)
|
69
87
|
rspec (~> 3.3)
|
88
|
+
rubocop (>= 0.49.0)
|
70
89
|
simplecov (~> 0)
|
71
|
-
webmock (~>
|
90
|
+
webmock (~> 3)
|
72
91
|
|
73
92
|
BUNDLED WITH
|
74
|
-
1.16.
|
93
|
+
1.16.6
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Sdk4me::Client
|
2
2
|
|
3
|
-
Client for accessing the [4me REST API](
|
3
|
+
Client for accessing the [4me REST API](https://developer.4me.com/v1/)
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -22,7 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
```
|
24
24
|
Sdk4me.configure do |config|
|
25
|
-
config.
|
25
|
+
config.access_token = 'd41f5868feb65fc87fa2311a473a8766ea38bc40'
|
26
26
|
config.account = 'my-sandbox'
|
27
27
|
config.logger = Rails.logger
|
28
28
|
...
|
@@ -32,18 +32,21 @@ end
|
|
32
32
|
All options available:
|
33
33
|
|
34
34
|
* _logger_: The [Ruby Logger](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html) instance, default: `Logger.new(STDOUT)`
|
35
|
-
* _host_: The [4me API host](
|
36
|
-
* _api_version_: The [4me API version](
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
40
|
-
*
|
35
|
+
* _host_: The [4me REST API host](https://developer.4me.com/v1/#service-url), default: 'https://api.4me.com'
|
36
|
+
* _api_version_: The [4me REST API version](https://developer.4me.com/v1/#service-url), default: 'v1'
|
37
|
+
* _access_token_: (**required**) The [4me access token](https://developer.4me.com/v1/#authentication)
|
38
|
+
* _api_token_: (**deprecated**) The [4me API token](https://developer.4me.com/v1/#api-tokens)
|
39
|
+
* _account_: Specify a [different account](https://developer.4me.com/v1/#multiple-accounts) to work with
|
40
|
+
* _source_: The [source](https://developer.4me.com/v1/general/source/) used when creating new records
|
41
|
+
* _user_agent_: The User-Agent header of each request. Defaults to 4me-sdk-ruby/(version)
|
42
|
+
* _max_retry_time_: maximum nr of seconds to retry a request on a failed response (default = 300 = 5 minutes)<br/>
|
41
43
|
The sleep time between retries starts at 2 seconds and doubles after each retry, i.e.
|
42
|
-
2, 6, 18, 54, 162, 486, 1458,
|
44
|
+
2, 6, 18, 54, 162, 486, 1458, ... seconds.<br/>
|
43
45
|
Set to 0 to prevent retries.
|
44
46
|
* _read_timeout_: [HTTP read timeout](http://ruby-doc.org/stdlib-2.0.0/libdoc/net/http/rdoc/Net/HTTP.html#method-i-read_timeout-3D) in seconds (default = 25)
|
45
|
-
* _block_at_rate_limit_: Set to `true` to block the request until the [rate limit](
|
46
|
-
The `Retry-After` header is used to compute when the retry should be performed. If that moment is later than the
|
47
|
+
* _block_at_rate_limit_: Set to `true` to block the request until the [rate limit](https://developer.4me.com/v1/#rate-limiting) is lifted, default: `true`<br/>
|
48
|
+
The `Retry-After` header is used to compute when the retry should be performed. If that moment is later than the _max_throttle_time_ the request will not be blocked and the throttled response is returned.
|
49
|
+
* _max_throttle_time_: maximum nr of seconds to retry a request on a rate limiter (default = 3660 = 1 hour and 1 minute)<br/>
|
47
50
|
* _proxy_host_: Define in case HTTP traffic needs to go through a proxy
|
48
51
|
* _proxy_port_: Port of the proxy, defaults to 8080
|
49
52
|
* _proxy_user_: Proxy user
|
@@ -69,7 +72,7 @@ Minimal example:
|
|
69
72
|
```
|
70
73
|
require 'sdk4me/client'
|
71
74
|
|
72
|
-
client = Sdk4me::Client.new(
|
75
|
+
client = Sdk4me::Client.new(access_token: '3a4e4590179263839...')
|
73
76
|
response = client.get('me')
|
74
77
|
puts response[:primary_email]
|
75
78
|
```
|
@@ -83,7 +86,7 @@ response = Sdk4me::Client.new.get('organizations/4321')
|
|
83
86
|
puts response[:name]
|
84
87
|
```
|
85
88
|
|
86
|
-
By default this call will return all [fields](
|
89
|
+
By default this call will return all [fields](https://developer.4me.com/v1/organizations/#fields) of the Organization.
|
87
90
|
|
88
91
|
The fields can be accessed using *symbols* and *strings*, and it is possible chain a number of keys in one go:
|
89
92
|
```
|
@@ -104,8 +107,8 @@ end
|
|
104
107
|
puts "Found #{count} organizations"
|
105
108
|
```
|
106
109
|
|
107
|
-
By default this call will return all [collection fields](
|
108
|
-
For more fields, check out the [field selection](
|
110
|
+
By default this call will return all [collection fields](https://developer.4me.com/v1/organizations/#collection-fields) for each Organization.
|
111
|
+
For more fields, check out the [field selection](https://developer.4me.com/v1/general/field_selection/#collection-of-resources) documentation.
|
109
112
|
|
110
113
|
The fields can be accessed using *symbols* and *strings*, and it is possible chain a number of keys in one go:
|
111
114
|
```
|
@@ -122,7 +125,7 @@ Note that an `Sdk4me::Exception` could be thrown in case one of the API requests
|
|
122
125
|
|
123
126
|
The `each` method [described above](#browse-through-a-collection-of-records) is the preferred way to work with collections of data.
|
124
127
|
|
125
|
-
If you really want to [paginate](
|
128
|
+
If you really want to [paginate](https://developer.4me.com/v1/general/pagination/) yourself, the `get` method is your friend.
|
126
129
|
|
127
130
|
```
|
128
131
|
@client = Sdk4me::Client.new
|
@@ -140,8 +143,8 @@ next_page = @client.get(response.pagination_link(:next))
|
|
140
143
|
last_page = @client.get(response.pagination_link(:last))
|
141
144
|
```
|
142
145
|
|
143
|
-
By default this call will return all [collection fields](
|
144
|
-
For more fields, check out the [field selection](
|
146
|
+
By default this call will return all [collection fields](https://developer.4me.com/v1/organizations/#collection-fields) for each Organization.
|
147
|
+
For more fields, check out the [field selection](https://developer.4me.com/v1/general/field_selection/#collection-of-resources) documentation.
|
145
148
|
|
146
149
|
The fields can be accessed using *symbols* and *strings*, and it is possible chain a number of keys in one go:
|
147
150
|
```
|
@@ -197,31 +200,38 @@ end
|
|
197
200
|
Make sure to validate the success by calling `response.valid?` and to take appropriate action in case the response is not valid.
|
198
201
|
|
199
202
|
|
200
|
-
###
|
203
|
+
### Attachments
|
201
204
|
|
202
|
-
|
203
|
-
|
205
|
+
Adding attachments and inline images to rich text fields is a two-step process.
|
206
|
+
First upload the attachments to 4me, and then refer to the uploaded attachments
|
207
|
+
when creating or updating a 4me record.
|
204
208
|
|
205
|
-
To make
|
209
|
+
To make this process easy, refer to the files using string filepaths or
|
210
|
+
File references:
|
206
211
|
|
207
212
|
```
|
208
213
|
response = Sdk4me::Client.new.put('requests/416621', {
|
209
214
|
status: 'waiting_for_customer',
|
210
|
-
note: 'Please complete the attached forms and
|
211
|
-
|
215
|
+
note: 'Please complete the attached forms and assign the request back to us.',
|
216
|
+
note_attachments: [
|
217
|
+
'/tmp/forms/README.txt',
|
218
|
+
File.open('/tmp/forms/PersonalData.xls', 'rb')
|
219
|
+
]
|
212
220
|
})
|
213
221
|
```
|
214
222
|
|
215
|
-
|
216
|
-
|
223
|
+
It is also possible to add inline attachments. Refer to attachments by their
|
224
|
+
array index, with the index being zero-based. Text can only refer to inline
|
225
|
+
images in its own attachments collection. For example:
|
217
226
|
|
218
227
|
```
|
219
228
|
begin
|
220
|
-
|
229
|
+
data = {
|
221
230
|
status: 'waiting_for_customer',
|
222
|
-
note: '
|
223
|
-
|
224
|
-
}
|
231
|
+
note: 'See [note_attachments: 0] and [note_attachments: 1]',
|
232
|
+
note_attachments: ['/tmp/info.png', '/tmp/help.png']
|
233
|
+
}
|
234
|
+
response = Sdk4me::Client.new.put('requests/416621', data)
|
225
235
|
if response.valid?
|
226
236
|
puts "Request #{response[:id]} updated and attachments added to the note"
|
227
237
|
else
|
@@ -234,7 +244,7 @@ end
|
|
234
244
|
|
235
245
|
### Importing CSV files
|
236
246
|
|
237
|
-
4me also provides an [Import API](
|
247
|
+
4me also provides an [Import API](https://developer.4me.com/v1/import/). The 4me SDK Client can be used to upload files to that API.
|
238
248
|
|
239
249
|
```
|
240
250
|
response = Sdk4me::Client.new.import('\tmp\people.csv', 'people')
|
@@ -246,9 +256,9 @@ end
|
|
246
256
|
|
247
257
|
```
|
248
258
|
|
249
|
-
The second argument contains the [import type](
|
259
|
+
The second argument contains the [import type](https://developer.4me.com/v1/import/#parameters).
|
250
260
|
|
251
|
-
It is also possible to [monitor the progress](
|
261
|
+
It is also possible to [monitor the progress](https://developer.4me.com/v1/import/#import-progress) of the import and block until the import is complete. In that case you will need to add some exception handling to your code.
|
252
262
|
|
253
263
|
```
|
254
264
|
begin
|
@@ -268,7 +278,7 @@ Note that blocking for the import to finish is required when you import multiple
|
|
268
278
|
|
269
279
|
### Exporting CSV files
|
270
280
|
|
271
|
-
4me also provides an [Export API](
|
281
|
+
4me also provides an [Export API](https://developer.4me.com/v1/export/). The 4me SDK Client can be used to download (zipped) CSV files using that API.
|
272
282
|
|
273
283
|
```
|
274
284
|
response = Sdk4me::Client.new.export(['people', 'people_contact_details'], DateTime.new(2012,03,30,23,00,00))
|
@@ -280,10 +290,10 @@ end
|
|
280
290
|
|
281
291
|
```
|
282
292
|
|
283
|
-
The first argument contains the [export types](
|
293
|
+
The first argument contains the [export types](https://developer.4me.com/v1/export/#parameters).
|
284
294
|
The second argument is optional and limits the export to all changed records since the given time.
|
285
295
|
|
286
|
-
It is also possible to [monitor the progress](
|
296
|
+
It is also possible to [monitor the progress](https://developer.4me.com/v1/export/#export-progress) of the export and block until the export is complete. In that case you will need to add some exception handling to your code.
|
287
297
|
|
288
298
|
```
|
289
299
|
require 'open-uri'
|
@@ -305,10 +315,17 @@ Note that blocking for the export to finish is recommended as you will get direc
|
|
305
315
|
|
306
316
|
### Blocking
|
307
317
|
|
308
|
-
|
318
|
+
When the currently used API token hits the [4me rate limiter](https://developer.4me.com/v1/#rate-limiting) a HTTP 429 response is returned that specifies after how many seconds the rate limit will be lifted.
|
309
319
|
|
310
|
-
|
320
|
+
If that time lies within the _max_throttle_time_ the 4me SDK Client will wait and retry the action, if not, the throttled response will be returned. You can verify if a response was throttled using:
|
321
|
+
```
|
322
|
+
response = client.get('me')
|
323
|
+
puts response.throttled?
|
324
|
+
```
|
325
|
+
|
326
|
+
By setting the _block_at_rate_limit_ to `false` in the [configuration](#configuration) the 4me SDK Client will never wait when a rate limit is hit.
|
311
327
|
|
328
|
+
Note that 4me has different rate limiters. If the intention is to only wait when the short-burst (max 20 requests in 2 seconds) rate limiter is hit, you could set the _max_throttle_time_ to e.g. 5 seconds.
|
312
329
|
|
313
330
|
### Translations
|
314
331
|
|
@@ -320,7 +337,7 @@ When exporting translations, the _locale_ parameter is required:
|
|
320
337
|
|
321
338
|
### Exception handling
|
322
339
|
|
323
|
-
The standard methods `get`, `post`, `put` and `delete` will always return a Response with an [error message](
|
340
|
+
The standard methods `get`, `post`, `put` and `delete` will always return a Response with an [error message](https://developer.4me.com/v1/#http-status-codes) in case something went wrong.
|
324
341
|
|
325
342
|
By calling `response.valid?` you will know if the action succeeded or not, and `response.message` provides additinal information in case the response was invalid.
|
326
343
|
|
@@ -331,3 +348,11 @@ puts response.message
|
|
331
348
|
```
|
332
349
|
|
333
350
|
The methods `each` and `import` may throw an `Sdk4me::Exception` in case something failed, see the examples above.
|
351
|
+
|
352
|
+
## Changelog
|
353
|
+
|
354
|
+
The changelog is available [here](CHANGELOG.md).
|
355
|
+
|
356
|
+
## Copyright
|
357
|
+
|
358
|
+
Copyright (c) 2020 4me, Inc. See [LICENSE](LICENSE) for further details.
|
data/lib/sdk4me.rb
CHANGED
@@ -5,19 +5,20 @@ module Sdk4me
|
|
5
5
|
include GemConfig::Base
|
6
6
|
|
7
7
|
with_configuration do
|
8
|
-
has :logger, classes: ::Logger, default: ::Logger.new(
|
8
|
+
has :logger, classes: ::Logger, default: ::Logger.new($stdout)
|
9
9
|
|
10
10
|
has :host, classes: String, default: 'https://api.4me.com'
|
11
11
|
has :api_version, values: ['v1'], default: 'v1'
|
12
|
+
has :access_token, classes: String
|
12
13
|
has :api_token, classes: String
|
13
14
|
|
14
15
|
has :account, classes: String
|
15
16
|
has :source, classes: String
|
16
17
|
|
17
|
-
has :max_retry_time, classes: Integer, default:
|
18
|
+
has :max_retry_time, classes: Integer, default: 300
|
18
19
|
has :read_timeout, classes: Integer, default: 25
|
19
|
-
has :block_at_rate_limit, classes: [TrueClass, FalseClass], default:
|
20
|
-
|
20
|
+
has :block_at_rate_limit, classes: [TrueClass, FalseClass], default: true
|
21
|
+
has :max_throttle_time, classes: Integer, default: 3660
|
21
22
|
has :proxy_host, classes: String
|
22
23
|
has :proxy_port, classes: Integer, default: 8080
|
23
24
|
has :proxy_user, classes: String
|
@@ -30,8 +31,9 @@ module Sdk4me
|
|
30
31
|
configuration.logger
|
31
32
|
end
|
32
33
|
|
33
|
-
class Exception < ::Exception
|
34
|
-
|
35
|
-
class UploadFailed < Exception; end # ::Sdk4me::UploadFailed class
|
34
|
+
class Exception < ::Exception
|
35
|
+
end
|
36
36
|
|
37
|
-
|
37
|
+
class UploadFailed < Exception
|
38
|
+
end
|
39
|
+
end
|