lhs 14.6.5 → 15.0.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +68 -68
- data/lhs.gemspec +1 -1
- data/lib/lhs/concerns/record/endpoints.rb +1 -1
- data/lib/lhs/concerns/record/request.rb +1 -1
- data/lib/lhs/version.rb +1 -1
- data/spec/autoloading_spec.rb +2 -2
- data/spec/collection/collection_items_spec.rb +1 -1
- data/spec/collection/configurable_spec.rb +1 -1
- data/spec/collection/meta_data_spec.rb +4 -4
- data/spec/collection/without_object_items_spec.rb +1 -1
- data/spec/data/collection_spec.rb +1 -1
- data/spec/data/inspect_spec.rb +1 -1
- data/spec/data/item_spec.rb +2 -2
- data/spec/data/merge_spec.rb +2 -2
- data/spec/data/raw_spec.rb +3 -3
- data/spec/data/root_spec.rb +3 -3
- data/spec/data/select_spec.rb +1 -1
- data/spec/data/to_json_spec.rb +2 -2
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/endpoint/for_url_spec.rb +6 -6
- data/spec/item/becomes_spec.rb +2 -2
- data/spec/item/delegate_spec.rb +2 -2
- data/spec/item/destroy_spec.rb +3 -3
- data/spec/item/dig_spec.rb +1 -1
- data/spec/item/errors_spec.rb +2 -2
- data/spec/item/fetch_spec.rb +1 -1
- data/spec/item/getter_spec.rb +2 -2
- data/spec/item/internal_data_structure_spec.rb +2 -2
- data/spec/item/map_spec.rb +1 -1
- data/spec/item/partial_update_spec.rb +4 -4
- data/spec/item/save_spec.rb +2 -2
- data/spec/item/setter_spec.rb +2 -2
- data/spec/item/update_spec.rb +2 -2
- data/spec/item/validation_spec.rb +2 -2
- data/spec/pagination/pages_left_spec.rb +1 -1
- data/spec/proxy/create_sub_resource_spec.rb +2 -2
- data/spec/proxy/load_spec.rb +2 -2
- data/spec/proxy/record_identification_spec.rb +1 -1
- data/spec/record/build_spec.rb +2 -2
- data/spec/record/cast_nested_data_spec.rb +6 -6
- data/spec/record/create_spec.rb +2 -2
- data/spec/record/creation_failed_spec.rb +2 -2
- data/spec/record/definitions_spec.rb +2 -2
- data/spec/record/destroy_spec.rb +1 -1
- data/spec/record/endpoint_inheritance_spec.rb +3 -3
- data/spec/record/endpoint_misconfiguration_spec.rb +4 -4
- data/spec/record/endpoint_options_spec.rb +1 -1
- data/spec/record/endpoints_spec.rb +19 -19
- data/spec/record/find_by_spec.rb +4 -4
- data/spec/record/find_each_spec.rb +2 -2
- data/spec/record/find_in_batches_spec.rb +4 -4
- data/spec/record/find_in_parallel_spec.rb +1 -1
- data/spec/record/find_spec.rb +4 -4
- data/spec/record/first_spec.rb +2 -2
- data/spec/record/has_many_spec.rb +1 -1
- data/spec/record/ignore_errors_spec.rb +1 -1
- data/spec/record/includes_all_spec.rb +7 -7
- data/spec/record/includes_spec.rb +28 -28
- data/spec/record/includes_warning_spec.rb +1 -1
- data/spec/record/item_key_spec.rb +1 -1
- data/spec/record/loading_twice_spec.rb +2 -2
- data/spec/record/mapping_spec.rb +5 -5
- data/spec/record/model_name_spec.rb +1 -1
- data/spec/record/new_spec.rb +3 -3
- data/spec/record/options_spec.rb +2 -2
- data/spec/record/paginatable_collection_spec.rb +4 -4
- data/spec/record/pagination_chain_spec.rb +3 -3
- data/spec/record/pagination_spec.rb +1 -1
- data/spec/record/persisted_spec.rb +1 -1
- data/spec/record/references_spec.rb +1 -1
- data/spec/record/reload_by_id_spec.rb +2 -2
- data/spec/record/reload_spec.rb +2 -2
- data/spec/record/request_spec.rb +6 -6
- data/spec/record/save_spec.rb +1 -1
- data/spec/record/scope_chains_spec.rb +1 -1
- data/spec/record/to_json_spec.rb +1 -1
- data/spec/record/where_chains_spec.rb +1 -1
- data/spec/record/where_spec.rb +2 -2
- data/spec/record/where_values_hash_spec.rb +1 -1
- data/spec/request_cycle_cache/main_spec.rb +1 -1
- data/spec/views/form_for_spec.rb +1 -1
- metadata +5 -5
data/spec/record/build_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder('datastore', datastore)
|
9
9
|
class Feedback < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -7,16 +7,16 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder('datastore', datastore)
|
9
9
|
class Customer < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/customers'
|
11
|
+
endpoint '{+datastore}/customers/{id}'
|
12
12
|
end
|
13
13
|
class Contract < LHS::Record
|
14
|
-
endpoint '
|
15
|
-
endpoint '
|
14
|
+
endpoint '{+datastore}/contracts'
|
15
|
+
endpoint '{+datastore}/contracts/{id}'
|
16
16
|
end
|
17
17
|
class Address < LHS::Record
|
18
|
-
endpoint '
|
19
|
-
endpoint '
|
18
|
+
endpoint '{+datastore}/addresses'
|
19
|
+
endpoint '{+datastore}/addresses/{id}'
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/spec/record/create_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder('datastore', datastore)
|
9
9
|
class Feedback < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -7,8 +7,8 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder(:datastore, datastore)
|
9
9
|
class Record < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -7,8 +7,8 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder('datastore', datastore)
|
9
9
|
class LocalEntry < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/local-entries'
|
11
|
+
endpoint '{+datastore}/local-entries/{id}'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/spec/record/destroy_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe LHS::Record do
|
|
4
4
|
context 'inherit endpoints' do
|
5
5
|
before(:each) do
|
6
6
|
class Base < LHS::Record
|
7
|
-
endpoint 'records
|
7
|
+
endpoint 'records/{id}'
|
8
8
|
end
|
9
9
|
|
10
10
|
class Example < Base
|
@@ -22,7 +22,7 @@ describe LHS::Record do
|
|
22
22
|
context 'define endpoints in subclass' do
|
23
23
|
before(:each) do
|
24
24
|
class Base < LHS::Record
|
25
|
-
endpoint 'records
|
25
|
+
endpoint 'records/{id}'
|
26
26
|
end
|
27
27
|
|
28
28
|
class Example < Base
|
@@ -46,7 +46,7 @@ describe LHS::Record do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
class Example < Base
|
49
|
-
endpoint 'examples
|
49
|
+
endpoint 'examples/{id}'
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -6,8 +6,8 @@ describe LHS::Record do
|
|
6
6
|
expect(
|
7
7
|
lambda {
|
8
8
|
class Record < LHS::Record
|
9
|
-
endpoint '
|
10
|
-
endpoint '
|
9
|
+
endpoint '{+datastore}/v2/feedbacks'
|
10
|
+
endpoint '{+datastore}/v2/reviews'
|
11
11
|
end
|
12
12
|
}
|
13
13
|
).to raise_error(/Clashing endpoints/)
|
@@ -15,8 +15,8 @@ describe LHS::Record do
|
|
15
15
|
expect(
|
16
16
|
lambda {
|
17
17
|
class Record < LHS::Record
|
18
|
-
endpoint '
|
19
|
-
endpoint '
|
18
|
+
endpoint '{+datastore}/v2/{campaign_id}/feedbacks'
|
19
|
+
endpoint '{+datastore}/v2/{campaign_id}/reviews'
|
20
20
|
end
|
21
21
|
}
|
22
22
|
).to raise_error(/Clashing endpoints/)
|
@@ -4,7 +4,7 @@ describe LHS::Record do
|
|
4
4
|
context 'set options for an endpoint' do
|
5
5
|
before(:each) do
|
6
6
|
class Record < LHS::Record
|
7
|
-
endpoint 'backend/v2/feedbacks
|
7
|
+
endpoint 'backend/v2/feedbacks/{id}', cache_expires_in: 1.day, retry: 2, cache: true
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -7,45 +7,45 @@ describe LHS::Record do
|
|
7
7
|
before(:each) do
|
8
8
|
LHC.config.placeholder(:datastore, datastore)
|
9
9
|
class Record < LHS::Record
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
12
|
-
endpoint '
|
10
|
+
endpoint '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
|
11
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
12
|
+
endpoint '{+datastore}/feedbacks'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'stores all the endpoints by url' do
|
17
|
-
expect(LHS::Record::Endpoints.all['
|
18
|
-
expect(LHS::Record::Endpoints.all['
|
19
|
-
expect(LHS::Record::Endpoints.all['
|
17
|
+
expect(LHS::Record::Endpoints.all['{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks']).to be
|
18
|
+
expect(LHS::Record::Endpoints.all['{+datastore}/{campaign_id}/feedbacks']).to be
|
19
|
+
expect(LHS::Record::Endpoints.all['{+datastore}/feedbacks']).to be
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'stores the endpoints of the service' do
|
23
23
|
expect(Record.endpoints.count).to eq 3
|
24
|
-
expect(Record.endpoints[0].url).to eq '
|
25
|
-
expect(Record.endpoints[1].url).to eq '
|
26
|
-
expect(Record.endpoints[2].url).to eq '
|
24
|
+
expect(Record.endpoints[0].url).to eq '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
|
25
|
+
expect(Record.endpoints[1].url).to eq '{+datastore}/{campaign_id}/feedbacks'
|
26
|
+
expect(Record.endpoints[2].url).to eq '{+datastore}/feedbacks'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'finds the endpoint by the one with the most route param hits' do
|
30
30
|
expect(
|
31
31
|
Record.find_endpoint(campaign_id: '12345').url
|
32
|
-
).to eq '
|
32
|
+
).to eq '{+datastore}/{campaign_id}/feedbacks'
|
33
33
|
expect(
|
34
34
|
Record.find_endpoint(campaign_id: '12345', entry_id: '123').url
|
35
|
-
).to eq '
|
35
|
+
).to eq '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'finds the base endpoint (endpoint with least amount of route params)' do
|
39
39
|
expect(
|
40
40
|
Record.find_endpoint.url
|
41
|
-
).to eq '
|
41
|
+
).to eq '{+datastore}/feedbacks'
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'compute url from endpoint' do
|
45
45
|
before(:each) do
|
46
46
|
class Feedback < LHS::Record
|
47
|
-
endpoint '
|
48
|
-
endpoint '
|
47
|
+
endpoint '{+datastore}/feedbacks'
|
48
|
+
endpoint '{+datastore}/feedbacks/{id}'
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -58,9 +58,9 @@ describe LHS::Record do
|
|
58
58
|
context 'unsorted endpoints' do
|
59
59
|
before(:each) do
|
60
60
|
class AnotherRecord < LHS::Record
|
61
|
-
endpoint '
|
62
|
-
endpoint '
|
63
|
-
endpoint '
|
61
|
+
endpoint '{+datastore}/feedbacks'
|
62
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
63
|
+
endpoint '{+datastore}/entries/{entry_id}/content-ads/{campaign_id}/feedbacks'
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -73,8 +73,8 @@ describe LHS::Record do
|
|
73
73
|
context 'includes data without considering base endpoint of parent record if url is present' do
|
74
74
|
before(:each) do
|
75
75
|
class Contract < LHS::Record
|
76
|
-
endpoint '
|
77
|
-
endpoint '
|
76
|
+
endpoint '{+datastore}/contracts/:id'
|
77
|
+
endpoint '{+datastore}/entry/{entry_id}/contracts'
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
data/spec/record/find_by_spec.rb
CHANGED
@@ -6,10 +6,10 @@ describe LHS::Record do
|
|
6
6
|
before(:each) do
|
7
7
|
LHC.config.placeholder(:datastore, datastore)
|
8
8
|
class Record < LHS::Record
|
9
|
-
endpoint '
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
12
|
-
endpoint '
|
9
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
10
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks/{id}'
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
|
+
endpoint '{+datastore}/feedbacks/{id}'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -20,8 +20,8 @@ describe LHS::Collection do
|
|
20
20
|
before(:each) do
|
21
21
|
LHC.config.placeholder('datastore', datastore)
|
22
22
|
class Record < LHS::Record
|
23
|
-
endpoint '
|
24
|
-
endpoint '
|
23
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
24
|
+
endpoint '{+datastore}/feedbacks'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -20,8 +20,8 @@ describe LHS::Collection do
|
|
20
20
|
before(:each) do
|
21
21
|
LHC.config.placeholder('datastore', datastore)
|
22
22
|
class Record < LHS::Record
|
23
|
-
endpoint '
|
24
|
-
endpoint '
|
23
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
24
|
+
endpoint '{+datastore}/feedbacks'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -67,8 +67,8 @@ describe LHS::Collection do
|
|
67
67
|
context 'configured pagination' do
|
68
68
|
before(:each) do
|
69
69
|
class Record < LHS::Record
|
70
|
-
endpoint '
|
71
|
-
endpoint '
|
70
|
+
endpoint '{+datastore}/{campaign_id}/feedbacks'
|
71
|
+
endpoint '{+datastore}/feedbacks'
|
72
72
|
configuration items_key: 'docs', limit_key: 'size', pagination_key: 'start', pagination_strategy: 'start', total_key: 'totalResults'
|
73
73
|
end
|
74
74
|
end
|
data/spec/record/find_spec.rb
CHANGED
@@ -6,10 +6,10 @@ describe LHS::Record do
|
|
6
6
|
before(:each) do
|
7
7
|
LHC.config.placeholder(:datastore, datastore)
|
8
8
|
class Record < LHS::Record
|
9
|
-
endpoint '
|
10
|
-
endpoint '
|
11
|
-
endpoint '
|
12
|
-
endpoint '
|
9
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
10
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks/{id}'
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
|
+
endpoint '{+datastore}/feedbacks/{id}'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/spec/record/first_spec.rb
CHANGED
@@ -6,8 +6,8 @@ describe LHS::Record do
|
|
6
6
|
before(:each) do
|
7
7
|
LHC.config.placeholder(:datastore, datastore)
|
8
8
|
class Record < LHS::Record
|
9
|
-
endpoint '
|
10
|
-
endpoint '
|
9
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
10
|
+
endpoint '{+datastore}/feedbacks'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -4,7 +4,7 @@ describe LHS::Record do
|
|
4
4
|
context 'includes all' do
|
5
5
|
before(:each) do
|
6
6
|
class Customer < LHS::Record
|
7
|
-
endpoint 'http://datastore/customers
|
7
|
+
endpoint 'http://datastore/customers/{id}'
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -172,7 +172,7 @@ describe LHS::Record do
|
|
172
172
|
context 'includes for an empty array' do
|
173
173
|
before(:each) do
|
174
174
|
class Contract < LHS::Record
|
175
|
-
endpoint 'http://datastore/contracts
|
175
|
+
endpoint 'http://datastore/contracts/{id}'
|
176
176
|
end
|
177
177
|
stub_request(:get, %r{http://datastore/contracts/\d})
|
178
178
|
.to_return(body: {
|
@@ -215,11 +215,11 @@ describe LHS::Record do
|
|
215
215
|
context 'include a known/identifiable record' do
|
216
216
|
before(:each) do
|
217
217
|
class Contract < LHS::Record
|
218
|
-
endpoint 'http://datastore/contracts
|
218
|
+
endpoint 'http://datastore/contracts/{id}'
|
219
219
|
end
|
220
220
|
|
221
221
|
class Entry < LHS::Record
|
222
|
-
endpoint '
|
222
|
+
endpoint '{+datastore}/entry/v1/{id}.json'
|
223
223
|
end
|
224
224
|
|
225
225
|
LHC.config.placeholder(:datastore, 'http://datastore')
|
@@ -264,7 +264,7 @@ describe LHS::Record do
|
|
264
264
|
context 'includes all for parallel loaded ids' do
|
265
265
|
before(:each) do
|
266
266
|
class Place < LHS::Record
|
267
|
-
endpoint 'http://datastore/places
|
267
|
+
endpoint 'http://datastore/places/{id}'
|
268
268
|
end
|
269
269
|
end
|
270
270
|
|
@@ -366,11 +366,11 @@ describe LHS::Record do
|
|
366
366
|
)
|
367
367
|
|
368
368
|
class Place < LHS::Record
|
369
|
-
endpoint 'http://datastore/places
|
369
|
+
endpoint 'http://datastore/places/{id}'
|
370
370
|
end
|
371
371
|
|
372
372
|
class Contract < LHS::Record
|
373
|
-
endpoint 'http://datastore/places
|
373
|
+
endpoint 'http://datastore/places/{place_id}/contracts'
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
@@ -26,16 +26,16 @@ describe LHS::Record do
|
|
26
26
|
context 'singlelevel includes' do
|
27
27
|
before(:each) do
|
28
28
|
class LocalEntry < LHS::Record
|
29
|
-
endpoint '
|
30
|
-
endpoint '
|
29
|
+
endpoint '{+datastore}/local-entries'
|
30
|
+
endpoint '{+datastore}/local-entries/{id}'
|
31
31
|
end
|
32
32
|
class User < LHS::Record
|
33
|
-
endpoint '
|
34
|
-
endpoint '
|
33
|
+
endpoint '{+datastore}/users'
|
34
|
+
endpoint '{+datastore}/users/{id}'
|
35
35
|
end
|
36
36
|
class Favorite < LHS::Record
|
37
|
-
endpoint '
|
38
|
-
endpoint '
|
37
|
+
endpoint '{+datastore}/favorites'
|
38
|
+
endpoint '{+datastore}/favorites/{id}'
|
39
39
|
end
|
40
40
|
stub_request(:get, "#{datastore}/local-entries/1")
|
41
41
|
.to_return(body: { company_name: 'local.ch' }.to_json)
|
@@ -74,8 +74,8 @@ describe LHS::Record do
|
|
74
74
|
context 'multilevel includes' do
|
75
75
|
before(:each) do
|
76
76
|
class Feedback < LHS::Record
|
77
|
-
endpoint '
|
78
|
-
endpoint '
|
77
|
+
endpoint '{+datastore}/feedbacks'
|
78
|
+
endpoint '{+datastore}/feedbacks/{id}'
|
79
79
|
end
|
80
80
|
stub_campaign_request
|
81
81
|
stub_entry_request
|
@@ -153,7 +153,7 @@ describe LHS::Record do
|
|
153
153
|
|
154
154
|
before(:each) do
|
155
155
|
class Entry < LHS::Record
|
156
|
-
endpoint '
|
156
|
+
endpoint '{+datastore}/local-entries/{id}'
|
157
157
|
end
|
158
158
|
LHC.config.interceptors = [interceptor]
|
159
159
|
end
|
@@ -169,12 +169,12 @@ describe LHS::Record do
|
|
169
169
|
context 'includes not present in response' do
|
170
170
|
before :each do
|
171
171
|
class Parent < LHS::Record
|
172
|
-
endpoint '
|
173
|
-
endpoint '
|
172
|
+
endpoint '{+datastore}/local-parents'
|
173
|
+
endpoint '{+datastore}/local-parents/{id}'
|
174
174
|
end
|
175
175
|
|
176
176
|
class OptionalChild < LHS::Record
|
177
|
-
endpoint '
|
177
|
+
endpoint '{+datastore}/local-children/{id}'
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
@@ -224,8 +224,8 @@ describe LHS::Record do
|
|
224
224
|
context 'links pointing to nowhere' do
|
225
225
|
it 'sets nil for links that cannot be included' do
|
226
226
|
class Feedback < LHS::Record
|
227
|
-
endpoint '
|
228
|
-
endpoint '
|
227
|
+
endpoint '{+datastore}/feedbacks'
|
228
|
+
endpoint '{+datastore}/feedbacks/{id}'
|
229
229
|
end
|
230
230
|
|
231
231
|
stub_request(:get, "#{datastore}/feedbacks/123")
|
@@ -247,11 +247,11 @@ describe LHS::Record do
|
|
247
247
|
before(:each) do
|
248
248
|
module Services
|
249
249
|
class LocalEntry < LHS::Record
|
250
|
-
endpoint '
|
250
|
+
endpoint '{+datastore}/local-entries'
|
251
251
|
end
|
252
252
|
|
253
253
|
class Feedback < LHS::Record
|
254
|
-
endpoint '
|
254
|
+
endpoint '{+datastore}/feedbacks'
|
255
255
|
end
|
256
256
|
end
|
257
257
|
stub_request(:get, "http://local.ch/v2/feedbacks?id=123")
|
@@ -266,8 +266,8 @@ describe LHS::Record do
|
|
266
266
|
context 'arrays' do
|
267
267
|
before(:each) do
|
268
268
|
class Place < LHS::Record
|
269
|
-
endpoint '
|
270
|
-
endpoint '
|
269
|
+
endpoint '{+datastore}/place'
|
270
|
+
endpoint '{+datastore}/place/{id}'
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
@@ -317,8 +317,8 @@ describe LHS::Record do
|
|
317
317
|
context 'empty collections' do
|
318
318
|
it 'skips including empty collections' do
|
319
319
|
class Place < LHS::Record
|
320
|
-
endpoint '
|
321
|
-
endpoint '
|
320
|
+
endpoint '{+datastore}/place'
|
321
|
+
endpoint '{+datastore}/place/{id}'
|
322
322
|
end
|
323
323
|
|
324
324
|
stub_request(:get, "#{datastore}/place/1")
|
@@ -337,8 +337,8 @@ describe LHS::Record do
|
|
337
337
|
context 'extend items with arrays' do
|
338
338
|
it 'extends base items with arrays' do
|
339
339
|
class Place < LHS::Record
|
340
|
-
endpoint '
|
341
|
-
endpoint '
|
340
|
+
endpoint '{+datastore}/place'
|
341
|
+
endpoint '{+datastore}/place/{id}'
|
342
342
|
end
|
343
343
|
|
344
344
|
stub_request(:get, "#{datastore}/place/1")
|
@@ -361,7 +361,7 @@ describe LHS::Record do
|
|
361
361
|
context 'unexpanded response when requesting the included collection' do
|
362
362
|
before(:each) do
|
363
363
|
class Customer < LHS::Record
|
364
|
-
endpoint '
|
364
|
+
endpoint '{+datastore}/customer/{id}'
|
365
365
|
end
|
366
366
|
end
|
367
367
|
|
@@ -430,12 +430,12 @@ describe LHS::Record do
|
|
430
430
|
context 'includes with options' do
|
431
431
|
before(:each) do
|
432
432
|
class Customer < LHS::Record
|
433
|
-
endpoint '
|
434
|
-
endpoint '
|
433
|
+
endpoint '{+datastore}/customers/{id}'
|
434
|
+
endpoint '{+datastore}/customers'
|
435
435
|
end
|
436
436
|
|
437
437
|
class Place < LHS::Record
|
438
|
-
endpoint '
|
438
|
+
endpoint '{+datastore}/places'
|
439
439
|
end
|
440
440
|
|
441
441
|
stub_request(:get, "#{datastore}/places?forwarded_params=123")
|
@@ -476,7 +476,7 @@ describe LHS::Record do
|
|
476
476
|
context 'more complex examples' do
|
477
477
|
before(:each) do
|
478
478
|
class Place < LHS::Record
|
479
|
-
endpoint 'http://datastore/places
|
479
|
+
endpoint 'http://datastore/places/{id}'
|
480
480
|
end
|
481
481
|
end
|
482
482
|
|
@@ -538,7 +538,7 @@ describe LHS::Record do
|
|
538
538
|
context 'include and merge arrays when calling find in parallel' do
|
539
539
|
before(:each) do
|
540
540
|
class Place < LHS::Record
|
541
|
-
endpoint 'http://datastore/places
|
541
|
+
endpoint 'http://datastore/places/{id}'
|
542
542
|
end
|
543
543
|
stub_request(:get, 'http://datastore/places/1')
|
544
544
|
.to_return(body: {
|