4me-sdk 2.0.0 → 2.0.4
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.
- checksums.yaml +4 -4
- data/4me-sdk.gemspec +2 -1
- data/Gemfile.lock +47 -47
- data/README.md +17 -11
- data/lib/sdk4me/client/attachments.rb +1 -1
- data/lib/sdk4me/client/multipart.rb +2 -1
- data/lib/sdk4me/client/response.rb +6 -3
- data/lib/sdk4me/client/version.rb +1 -1
- data/lib/sdk4me/client.rb +9 -2
- data/spec/lib/sdk4me/attachments_spec.rb +1 -1
- data/spec/lib/sdk4me/certificate_spec.rb +2 -2
- data/spec/lib/sdk4me/client_spec.rb +24 -2
- data/spec/lib/sdk4me/response_spec.rb +5 -5
- metadata +21 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fb02daf6964d0f17c4f084d8035b50497e218830a823f8b2f8a40c7af26b659
|
|
4
|
+
data.tar.gz: fa1a5f86490b2cc33ba9221ba2a0fd79968116b9e66988f2f25345a4dea40128
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4826f9e6545ac80ac3fc674ede10c53f20d87a27d286bfe2814ebd13c526ec80d743af7320947d5e6a1dafbfe2c8f1e501f388e9f4022e5f4cabfc889440ccf1
|
|
7
|
+
data.tar.gz: 8a80bccaf9cd74342aea7505c35395032c118dbe36fb119c785b9c1b8f435db2c18f9302192bbf4cb58e590379c01c76c24708577da0acbd36ec07f8abbb8e0d
|
data/4me-sdk.gemspec
CHANGED
|
@@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.add_runtime_dependency 'gem_config', '>=0.3'
|
|
31
31
|
spec.add_runtime_dependency 'mime-types', '>= 3.0'
|
|
32
32
|
|
|
33
|
-
spec.add_development_dependency 'bundler'
|
|
33
|
+
spec.add_development_dependency 'bundler'
|
|
34
|
+
spec.add_development_dependency 'json', '>= 2.6'
|
|
34
35
|
spec.add_development_dependency 'rake', '~> 12'
|
|
35
36
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
|
36
37
|
spec.add_development_dependency 'rubocop', '>= 0.49.0'
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
4me-sdk (2.0.
|
|
4
|
+
4me-sdk (2.0.4)
|
|
5
5
|
activesupport (>= 4.2)
|
|
6
6
|
gem_config (>= 0.3)
|
|
7
7
|
mime-types (>= 3.0)
|
|
@@ -9,80 +9,80 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
activesupport (
|
|
12
|
+
activesupport (7.0.1)
|
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
|
-
i18n (>=
|
|
15
|
-
minitest (
|
|
16
|
-
tzinfo (~>
|
|
17
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
|
14
|
+
i18n (>= 1.6, < 2)
|
|
15
|
+
minitest (>= 5.1)
|
|
16
|
+
tzinfo (~> 2.0)
|
|
18
17
|
addressable (2.7.0)
|
|
19
18
|
public_suffix (>= 2.0.2, < 5.0)
|
|
20
|
-
ast (2.4.
|
|
21
|
-
concurrent-ruby (1.1.
|
|
19
|
+
ast (2.4.2)
|
|
20
|
+
concurrent-ruby (1.1.9)
|
|
22
21
|
crack (0.4.4)
|
|
23
|
-
diff-lcs (1.
|
|
24
|
-
docile (1.3.
|
|
22
|
+
diff-lcs (1.3)
|
|
23
|
+
docile (1.3.1)
|
|
25
24
|
gem_config (0.3.2)
|
|
26
25
|
hashdiff (1.0.1)
|
|
27
|
-
i18n (1.8.
|
|
26
|
+
i18n (1.8.11)
|
|
28
27
|
concurrent-ruby (~> 1.0)
|
|
29
|
-
|
|
28
|
+
json (2.6.1)
|
|
29
|
+
mime-types (3.4.1)
|
|
30
30
|
mime-types-data (~> 3.2015)
|
|
31
|
-
mime-types-data (3.
|
|
32
|
-
minitest (5.
|
|
33
|
-
parallel (1.
|
|
34
|
-
parser (
|
|
31
|
+
mime-types-data (3.2022.0105)
|
|
32
|
+
minitest (5.15.0)
|
|
33
|
+
parallel (1.20.1)
|
|
34
|
+
parser (3.0.0.0)
|
|
35
35
|
ast (~> 2.4.1)
|
|
36
36
|
public_suffix (4.0.6)
|
|
37
37
|
rainbow (3.0.0)
|
|
38
|
-
rake (12.3.
|
|
39
|
-
regexp_parser (
|
|
38
|
+
rake (12.3.1)
|
|
39
|
+
regexp_parser (2.0.3)
|
|
40
40
|
rexml (3.2.4)
|
|
41
|
-
rspec (3.
|
|
42
|
-
rspec-core (~> 3.
|
|
43
|
-
rspec-expectations (~> 3.
|
|
44
|
-
rspec-mocks (~> 3.
|
|
45
|
-
rspec-core (3.
|
|
46
|
-
rspec-support (~> 3.
|
|
47
|
-
rspec-expectations (3.
|
|
41
|
+
rspec (3.8.0)
|
|
42
|
+
rspec-core (~> 3.8.0)
|
|
43
|
+
rspec-expectations (~> 3.8.0)
|
|
44
|
+
rspec-mocks (~> 3.8.0)
|
|
45
|
+
rspec-core (3.8.0)
|
|
46
|
+
rspec-support (~> 3.8.0)
|
|
47
|
+
rspec-expectations (3.8.2)
|
|
48
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
|
-
rspec-support (~> 3.
|
|
50
|
-
rspec-mocks (3.
|
|
49
|
+
rspec-support (~> 3.8.0)
|
|
50
|
+
rspec-mocks (3.8.0)
|
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
52
|
-
rspec-support (~> 3.
|
|
53
|
-
rspec-support (3.
|
|
54
|
-
rubocop (
|
|
52
|
+
rspec-support (~> 3.8.0)
|
|
53
|
+
rspec-support (3.8.0)
|
|
54
|
+
rubocop (1.8.1)
|
|
55
55
|
parallel (~> 1.10)
|
|
56
|
-
parser (>=
|
|
56
|
+
parser (>= 3.0.0.0)
|
|
57
57
|
rainbow (>= 2.2.2, < 4.0)
|
|
58
|
-
regexp_parser (>= 1.8)
|
|
58
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
59
59
|
rexml
|
|
60
|
-
rubocop-ast (>=
|
|
60
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
61
61
|
ruby-progressbar (~> 1.7)
|
|
62
|
-
unicode-display_width (>= 1.4.0, <
|
|
63
|
-
rubocop-ast (1.
|
|
62
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
63
|
+
rubocop-ast (1.4.1)
|
|
64
64
|
parser (>= 2.7.1.5)
|
|
65
|
-
ruby-progressbar (1.
|
|
66
|
-
simplecov (0.
|
|
65
|
+
ruby-progressbar (1.11.0)
|
|
66
|
+
simplecov (0.16.1)
|
|
67
67
|
docile (~> 1.1)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
tzinfo (
|
|
72
|
-
|
|
73
|
-
unicode-display_width (
|
|
74
|
-
webmock (3.9.
|
|
68
|
+
json (>= 1.8, < 3)
|
|
69
|
+
simplecov-html (~> 0.10.0)
|
|
70
|
+
simplecov-html (0.10.2)
|
|
71
|
+
tzinfo (2.0.4)
|
|
72
|
+
concurrent-ruby (~> 1.0)
|
|
73
|
+
unicode-display_width (2.0.0)
|
|
74
|
+
webmock (3.9.1)
|
|
75
75
|
addressable (>= 2.3.6)
|
|
76
76
|
crack (>= 0.3.2)
|
|
77
77
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
78
|
-
zeitwerk (2.4.1)
|
|
79
78
|
|
|
80
79
|
PLATFORMS
|
|
81
80
|
ruby
|
|
82
81
|
|
|
83
82
|
DEPENDENCIES
|
|
84
83
|
4me-sdk!
|
|
85
|
-
bundler
|
|
84
|
+
bundler
|
|
85
|
+
json (>= 2.6)
|
|
86
86
|
rake (~> 12)
|
|
87
87
|
rspec (~> 3.3)
|
|
88
88
|
rubocop (>= 0.49.0)
|
|
@@ -90,4 +90,4 @@ DEPENDENCIES
|
|
|
90
90
|
webmock (~> 3)
|
|
91
91
|
|
|
92
92
|
BUNDLED WITH
|
|
93
|
-
1.
|
|
93
|
+
1.17.3
|
data/README.md
CHANGED
|
@@ -129,18 +129,16 @@ If you really want to [paginate](https://developer.4me.com/v1/general/pagination
|
|
|
129
129
|
|
|
130
130
|
```
|
|
131
131
|
@client = Sdk4me::Client.new
|
|
132
|
-
response = @client.get('organizations', {per_page:
|
|
132
|
+
response = @client.get('organizations', { per_page: 100 })
|
|
133
133
|
|
|
134
134
|
puts response.json # all data in an array
|
|
135
135
|
|
|
136
136
|
puts "showing page #{response.current_page}/#{response.total_pages}, with #{response.per_page} records per page"
|
|
137
137
|
puts "total number of records #{response.total_entries}"
|
|
138
138
|
|
|
139
|
-
# retrieve collection for
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
next_page = @client.get(response.pagination_link(:next))
|
|
143
|
-
last_page = @client.get(response.pagination_link(:last))
|
|
139
|
+
# retrieve collection for previous and next pages directly from the response
|
|
140
|
+
prev_page = @client.get(response.pagination_relative_link(:prev))
|
|
141
|
+
next_page = @client.get(response.pagination_relative_link(:next))
|
|
144
142
|
```
|
|
145
143
|
|
|
146
144
|
By default this call will return all [collection fields](https://developer.4me.com/v1/organizations/#collection-fields) for each Organization.
|
|
@@ -148,7 +146,7 @@ For more fields, check out the [field selection](https://developer.4me.com/v1/ge
|
|
|
148
146
|
|
|
149
147
|
The fields can be accessed using *symbols* and *strings*, and it is possible chain a number of keys in one go:
|
|
150
148
|
```
|
|
151
|
-
response = Sdk4me::Client.new.get('organizations', {per_page:
|
|
149
|
+
response = Sdk4me::Client.new.get('organizations', { per_page: 100, fields: 'parent' })
|
|
152
150
|
puts response[:parent, :name] # an array with the parent organization names
|
|
153
151
|
puts response['parent', 'name'] # strings are also accepted as keys
|
|
154
152
|
```
|
|
@@ -265,7 +263,10 @@ begin
|
|
|
265
263
|
response = Sdk4me::Client.new.import('\tmp\people.csv', 'people', true)
|
|
266
264
|
puts response[:state]
|
|
267
265
|
puts response[:results]
|
|
268
|
-
puts response[:
|
|
266
|
+
puts response[:logfile]
|
|
267
|
+
unless response.valid?
|
|
268
|
+
puts "Import completed with errors: #{response[:message]}"
|
|
269
|
+
end
|
|
269
270
|
catch Sdk4me::UploadFailed => ex
|
|
270
271
|
puts "Could not upload the people import file: #{ex.message}"
|
|
271
272
|
catch Sdk4me::Exception => ex
|
|
@@ -301,8 +302,13 @@ require 'open-uri'
|
|
|
301
302
|
begin
|
|
302
303
|
response = Sdk4me::Client.new.export(['people', 'people_contact_details'], nil, true)
|
|
303
304
|
puts response[:state]
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
if response.valid?
|
|
306
|
+
# write the export file to disk
|
|
307
|
+
File.open('/tmp/export.zip', 'wb') { |f| f.write(open(response[:url]).read) }
|
|
308
|
+
else
|
|
309
|
+
puts "Export failed with errors: #{response[:message]}"
|
|
310
|
+
puts response[:logfile]
|
|
311
|
+
end
|
|
306
312
|
catch Sdk4me::UploadFailed => ex
|
|
307
313
|
puts "Could not queue the people export: #{ex.message}"
|
|
308
314
|
catch Sdk4me::Exception => ex
|
|
@@ -355,4 +361,4 @@ The changelog is available [here](CHANGELOG.md).
|
|
|
355
361
|
|
|
356
362
|
## Copyright
|
|
357
363
|
|
|
358
|
-
Copyright (c)
|
|
364
|
+
Copyright (c) 2022 4me, Inc. See [LICENSE](LICENSE) for further details.
|
|
@@ -32,7 +32,7 @@ module Sdk4me
|
|
|
32
32
|
# data = {
|
|
33
33
|
# note: "Hello  and ",
|
|
34
34
|
# note_attachments: [
|
|
35
|
-
# { key: 'storage/abc/
|
|
35
|
+
# { key: 'storage/abc/adjhajdhjaadf.png', filesize: 12345, inline: true },
|
|
36
36
|
# { key: 'storage/abc/fskdhakjfkjdssdf.png'], filesize: 98765, inline: true }
|
|
37
37
|
# ],
|
|
38
38
|
# ...
|
|
@@ -66,7 +66,8 @@ module Sdk4me
|
|
|
66
66
|
def to_multipart
|
|
67
67
|
# If we can tell the possible mime-type from the filename, use the first in the list; otherwise, use "application/octet-stream"
|
|
68
68
|
mime_type = MIME::Types.type_for(filename)[0] || MIME::Types['application/octet-stream'][0]
|
|
69
|
-
%(Content-Disposition: form-data; name="#{CGI.escape(k.to_s)}"; filename="#{filename}"\r\
|
|
69
|
+
%(Content-Disposition: form-data; name="#{CGI.escape(k.to_s)}"; filename="#{filename}"\r\n) +
|
|
70
|
+
%(Content-Type: #{mime_type.simplified}\r\n\r\n#{content.force_encoding('UTF-8')}\r\n)
|
|
70
71
|
end
|
|
71
72
|
end
|
|
72
73
|
end
|
|
@@ -98,14 +98,17 @@ module Sdk4me
|
|
|
98
98
|
@total_entries ||= @response.header['X-Pagination-Total-Entries'].to_i
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
# pagination urls (full paths with server) - relations :first, :prev
|
|
101
|
+
# pagination urls (full paths with server) - relations :first, :prev
|
|
102
102
|
# Link: <https://api.4me.com/v1/requests?page=1&per_page=25>; rel="first", <https://api.4me.com/v1/requests?page=2&per_page=25>; rel="prev", etc.
|
|
103
103
|
def pagination_link(relation)
|
|
104
104
|
# split on ',' select the [url] in '<[url]>; rel="[relation]"', compact to all url's found (at most one) and take the first
|
|
105
|
-
(@pagination_links ||= {})[relation] ||= @response.header['Link'] &&
|
|
105
|
+
(@pagination_links ||= {})[relation] ||= @response.header['Link'] &&
|
|
106
|
+
@response.header['Link']
|
|
107
|
+
.split(/,\s*(?:<|$)/)
|
|
108
|
+
.map { |link| link[/^\s*<?(.*?)>?;\s*rel="#{relation}"\s*$/, 1] }.compact.first
|
|
106
109
|
end
|
|
107
110
|
|
|
108
|
-
# pagination urls (relative paths without server) - relations :first, :prev, :next
|
|
111
|
+
# pagination urls (relative paths without server) - relations :first, :prev, :next
|
|
109
112
|
def pagination_relative_link(relation)
|
|
110
113
|
(@pagination_relative_links ||= {})[relation] ||= pagination_link(relation) && pagination_link(relation)[%r{^https?://[^/]*(.*)}, 1]
|
|
111
114
|
end
|
data/lib/sdk4me/client.rb
CHANGED
|
@@ -145,9 +145,13 @@ module Sdk4me
|
|
|
145
145
|
token = response[:token]
|
|
146
146
|
loop do
|
|
147
147
|
response = get("/import/#{token}")
|
|
148
|
+
return response if response[:state] == 'error'
|
|
149
|
+
|
|
148
150
|
unless response.valid?
|
|
149
151
|
sleep(5)
|
|
150
152
|
response = get("/import/#{token}") # single retry to recover from a network error
|
|
153
|
+
return response if response[:state] == 'error'
|
|
154
|
+
|
|
151
155
|
raise ::Sdk4me::Exception, "Unable to monitor progress for #{type} import. #{response.message}" unless response.valid?
|
|
152
156
|
end
|
|
153
157
|
# wait 30 seconds while the response is OK and import is still busy
|
|
@@ -186,9 +190,13 @@ module Sdk4me
|
|
|
186
190
|
token = response[:token]
|
|
187
191
|
loop do
|
|
188
192
|
response = get("/export/#{token}")
|
|
193
|
+
return response if response[:state] == 'error'
|
|
194
|
+
|
|
189
195
|
unless response.valid?
|
|
190
196
|
sleep(5)
|
|
191
197
|
response = get("/export/#{token}") # single retry to recover from a network error
|
|
198
|
+
return response if response[:state] == 'error'
|
|
199
|
+
|
|
192
200
|
raise ::Sdk4me::Exception, "Unable to monitor progress for '#{data[:type]}' export. #{response.message}" unless response.valid?
|
|
193
201
|
end
|
|
194
202
|
# wait 30 seconds while the response is OK and export is still busy
|
|
@@ -216,9 +224,8 @@ module Sdk4me
|
|
|
216
224
|
request
|
|
217
225
|
end
|
|
218
226
|
|
|
219
|
-
URI_ESCAPE_PATTERN = Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
|
220
227
|
def uri_escape(value)
|
|
221
|
-
URI.
|
|
228
|
+
URI.encode_www_form_component(value).gsub('+', '%20').gsub('.', '%2E')
|
|
222
229
|
end
|
|
223
230
|
|
|
224
231
|
# Expand the given header with the default header
|
|
@@ -12,7 +12,7 @@ describe 'ca-bundle.crt' do
|
|
|
12
12
|
expect(response.valid?).to be_falsey
|
|
13
13
|
|
|
14
14
|
# expecting 401 error
|
|
15
|
-
expect(response.message).to
|
|
15
|
+
expect(response.message).to start_with('401:')
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it 'should be able to connect to the 4me REST API (access token)' do
|
|
@@ -26,7 +26,7 @@ describe 'ca-bundle.crt' do
|
|
|
26
26
|
expect(response.valid?).to be_falsey
|
|
27
27
|
|
|
28
28
|
# expecting 401 error
|
|
29
|
-
expect(response.message).to
|
|
29
|
+
expect(response.message).to start_with('401:')
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'should be able to connect to S3' do
|
|
@@ -364,8 +364,10 @@ describe Sdk4me::Client do
|
|
|
364
364
|
stub_request(:post, 'https://api.4me.com/v1/import').with(credentials(authentication)).with(body: @multi_part_body, headers: @multi_part_headers).to_return(body: { token: '68ef5ef0f64c0' }.to_json)
|
|
365
365
|
progress_stub = stub_request(:get, 'https://api.4me.com/v1/import/68ef5ef0f64c0').with(credentials(authentication)).to_return(@import_queued_response, @import_processing_response, @import_failed_response)
|
|
366
366
|
|
|
367
|
-
|
|
368
|
-
expect(
|
|
367
|
+
response = client(authentication).import("#{@fixture_dir}/people.csv", 'people', true)
|
|
368
|
+
expect(response.valid?).to be_falsey
|
|
369
|
+
expect(response[:message]).to eq('Invalid byte sequence in UTF-8 on line 2')
|
|
370
|
+
expect(progress_stub).to have_been_requested.times(3)
|
|
369
371
|
end
|
|
370
372
|
|
|
371
373
|
it 'should not continue when there is an error connecting to 4me' do
|
|
@@ -389,6 +391,16 @@ describe Sdk4me::Client do
|
|
|
389
391
|
stub_request(:post, 'https://api.4me.com/v1/import').with(credentials(authentication)).with(body: @multi_part_body, headers: @multi_part_headers).to_return(body: { message: 'oops!' }.to_json)
|
|
390
392
|
expect { client(authentication).import("#{@fixture_dir}/people.csv", 'people', true) }.to raise_error(Sdk4me::UploadFailed, 'Failed to queue people import. oops!')
|
|
391
393
|
end
|
|
394
|
+
|
|
395
|
+
it 'should return the error response when the import state is set to error' do
|
|
396
|
+
stub_request(:post, 'https://api.4me.com/v1/import').with(credentials(authentication)).with(body: @multi_part_body, headers: @multi_part_headers).to_return(body: { token: '68ef5ef0f64c0' }.to_json)
|
|
397
|
+
stub_request(:get, 'https://api.4me.com/v1/import/68ef5ef0f64c0').with(credentials(authentication)).to_return(body: { state: 'error', message: 'Too many import failures', logfile: 'foo' }.to_json)
|
|
398
|
+
|
|
399
|
+
response = client(authentication).import("#{@fixture_dir}/people.csv", 'people', true)
|
|
400
|
+
expect(response.valid?).to be_falsey
|
|
401
|
+
expect(response[:message]).to eq('Too many import failures')
|
|
402
|
+
expect(response[:logfile]).to eq('foo')
|
|
403
|
+
end
|
|
392
404
|
end
|
|
393
405
|
|
|
394
406
|
context 'export' do
|
|
@@ -480,6 +492,16 @@ describe Sdk4me::Client do
|
|
|
480
492
|
stub_request(:post, 'https://api.4me.com/v1/export').with(credentials(authentication)).with(body: { type: 'people' }).to_return(body: { message: 'oops!' }.to_json)
|
|
481
493
|
expect { client(authentication).export('people', nil, true) }.to raise_error(Sdk4me::UploadFailed, "Failed to queue 'people' export. oops!")
|
|
482
494
|
end
|
|
495
|
+
|
|
496
|
+
it 'should return the error response when the export state is set to error' do
|
|
497
|
+
stub_request(:post, 'https://api.4me.com/v1/export').with(credentials(authentication)).with(body: { type: 'people' }).to_return(body: { token: '68ef5ef0f64c0' }.to_json)
|
|
498
|
+
stub_request(:get, 'https://api.4me.com/v1/export/68ef5ef0f64c0').with(credentials(authentication)).to_return(body: { state: 'error', message: 'Too many export failures', logfile: 'foo' }.to_json)
|
|
499
|
+
|
|
500
|
+
response = client(authentication).export('people', nil, true)
|
|
501
|
+
expect(response.valid?).to be_falsey
|
|
502
|
+
expect(response[:message]).to eq('Too many export failures')
|
|
503
|
+
expect(response[:logfile]).to eq('foo')
|
|
504
|
+
end
|
|
483
505
|
end
|
|
484
506
|
|
|
485
507
|
context 'retry' do
|
|
@@ -214,7 +214,7 @@ describe Sdk4me::Response do
|
|
|
214
214
|
'X-Pagination-Current-Page' => 1,
|
|
215
215
|
'X-Pagination-Total-Pages' => 2,
|
|
216
216
|
'X-Pagination-Total-Entries' => 5,
|
|
217
|
-
'Link' => '<https://api.4me.com/v1/people?page=1&per_page=3>; rel="first",<https://api.4me.com/v1/people?page=2&per_page=3>; rel="next", <https://api.4me.com/v1/people?page=2&per_page=3>; rel="last"'
|
|
217
|
+
'Link' => '<https://api.4me.com/v1/people?page=1&per_page=3&fields=id,name>; rel="first",<https://api.4me.com/v1/people?fields=id%2Cname&page=2&per_page=3>; rel="next", <https://api.4me.com/v1/people?page=2&per_page=3>; rel="last"'
|
|
218
218
|
}
|
|
219
219
|
allow(@response_array.response).to receive('header') { @pagination_header }
|
|
220
220
|
end
|
|
@@ -235,16 +235,16 @@ describe Sdk4me::Response do
|
|
|
235
235
|
expect(@response_array.total_entries).to eq(5)
|
|
236
236
|
end
|
|
237
237
|
|
|
238
|
-
{ first: 'https://api.4me.com/v1/people?page=1&per_page=3',
|
|
239
|
-
next: 'https://api.4me.com/v1/people?page=2&per_page=3',
|
|
238
|
+
{ first: 'https://api.4me.com/v1/people?page=1&per_page=3&fields=id,name',
|
|
239
|
+
next: 'https://api.4me.com/v1/people?fields=id%2Cname&page=2&per_page=3',
|
|
240
240
|
last: 'https://api.4me.com/v1/people?page=2&per_page=3' }.each do |relation, link|
|
|
241
241
|
it "should define pagination link for :#{relation}" do
|
|
242
242
|
expect(@response_array.pagination_link(relation)).to eq(link)
|
|
243
243
|
end
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
-
{ first: '/v1/people?page=1&per_page=3',
|
|
247
|
-
next: '/v1/people?page=2&per_page=3',
|
|
246
|
+
{ first: '/v1/people?page=1&per_page=3&fields=id,name',
|
|
247
|
+
next: '/v1/people?fields=id%2Cname&page=2&per_page=3',
|
|
248
248
|
last: '/v1/people?page=2&per_page=3' }.each do |relation, link|
|
|
249
249
|
it "should define pagination relative link for :#{relation}" do
|
|
250
250
|
expect(@response_array.pagination_relative_link(relation)).to eq(link)
|
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: 2.0.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 4me
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -56,16 +56,30 @@ dependencies:
|
|
|
56
56
|
name: bundler
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: json
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '2.6'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
82
|
+
version: '2.6'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: rake
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -184,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
184
198
|
- !ruby/object:Gem::Version
|
|
185
199
|
version: '0'
|
|
186
200
|
requirements: []
|
|
187
|
-
|
|
188
|
-
rubygems_version: 2.7.9
|
|
201
|
+
rubygems_version: 3.1.6
|
|
189
202
|
signing_key:
|
|
190
203
|
specification_version: 4
|
|
191
204
|
summary: The official 4me SDK for Ruby. Provides easy access to the REST APIs found
|