lhs 14.6.5 → 15.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/README.md +68 -68
  4. data/lhs.gemspec +1 -1
  5. data/lib/lhs/concerns/record/endpoints.rb +1 -1
  6. data/lib/lhs/concerns/record/request.rb +1 -1
  7. data/lib/lhs/version.rb +1 -1
  8. data/spec/autoloading_spec.rb +2 -2
  9. data/spec/collection/collection_items_spec.rb +1 -1
  10. data/spec/collection/configurable_spec.rb +1 -1
  11. data/spec/collection/meta_data_spec.rb +4 -4
  12. data/spec/collection/without_object_items_spec.rb +1 -1
  13. data/spec/data/collection_spec.rb +1 -1
  14. data/spec/data/inspect_spec.rb +1 -1
  15. data/spec/data/item_spec.rb +2 -2
  16. data/spec/data/merge_spec.rb +2 -2
  17. data/spec/data/raw_spec.rb +3 -3
  18. data/spec/data/root_spec.rb +3 -3
  19. data/spec/data/select_spec.rb +1 -1
  20. data/spec/data/to_json_spec.rb +2 -2
  21. data/spec/dummy/app/models/user.rb +1 -1
  22. data/spec/endpoint/for_url_spec.rb +6 -6
  23. data/spec/item/becomes_spec.rb +2 -2
  24. data/spec/item/delegate_spec.rb +2 -2
  25. data/spec/item/destroy_spec.rb +3 -3
  26. data/spec/item/dig_spec.rb +1 -1
  27. data/spec/item/errors_spec.rb +2 -2
  28. data/spec/item/fetch_spec.rb +1 -1
  29. data/spec/item/getter_spec.rb +2 -2
  30. data/spec/item/internal_data_structure_spec.rb +2 -2
  31. data/spec/item/map_spec.rb +1 -1
  32. data/spec/item/partial_update_spec.rb +4 -4
  33. data/spec/item/save_spec.rb +2 -2
  34. data/spec/item/setter_spec.rb +2 -2
  35. data/spec/item/update_spec.rb +2 -2
  36. data/spec/item/validation_spec.rb +2 -2
  37. data/spec/pagination/pages_left_spec.rb +1 -1
  38. data/spec/proxy/create_sub_resource_spec.rb +2 -2
  39. data/spec/proxy/load_spec.rb +2 -2
  40. data/spec/proxy/record_identification_spec.rb +1 -1
  41. data/spec/record/build_spec.rb +2 -2
  42. data/spec/record/cast_nested_data_spec.rb +6 -6
  43. data/spec/record/create_spec.rb +2 -2
  44. data/spec/record/creation_failed_spec.rb +2 -2
  45. data/spec/record/definitions_spec.rb +2 -2
  46. data/spec/record/destroy_spec.rb +1 -1
  47. data/spec/record/endpoint_inheritance_spec.rb +3 -3
  48. data/spec/record/endpoint_misconfiguration_spec.rb +4 -4
  49. data/spec/record/endpoint_options_spec.rb +1 -1
  50. data/spec/record/endpoints_spec.rb +19 -19
  51. data/spec/record/find_by_spec.rb +4 -4
  52. data/spec/record/find_each_spec.rb +2 -2
  53. data/spec/record/find_in_batches_spec.rb +4 -4
  54. data/spec/record/find_in_parallel_spec.rb +1 -1
  55. data/spec/record/find_spec.rb +4 -4
  56. data/spec/record/first_spec.rb +2 -2
  57. data/spec/record/has_many_spec.rb +1 -1
  58. data/spec/record/ignore_errors_spec.rb +1 -1
  59. data/spec/record/includes_all_spec.rb +7 -7
  60. data/spec/record/includes_spec.rb +28 -28
  61. data/spec/record/includes_warning_spec.rb +1 -1
  62. data/spec/record/item_key_spec.rb +1 -1
  63. data/spec/record/loading_twice_spec.rb +2 -2
  64. data/spec/record/mapping_spec.rb +5 -5
  65. data/spec/record/model_name_spec.rb +1 -1
  66. data/spec/record/new_spec.rb +3 -3
  67. data/spec/record/options_spec.rb +2 -2
  68. data/spec/record/paginatable_collection_spec.rb +4 -4
  69. data/spec/record/pagination_chain_spec.rb +3 -3
  70. data/spec/record/pagination_spec.rb +1 -1
  71. data/spec/record/persisted_spec.rb +1 -1
  72. data/spec/record/references_spec.rb +1 -1
  73. data/spec/record/reload_by_id_spec.rb +2 -2
  74. data/spec/record/reload_spec.rb +2 -2
  75. data/spec/record/request_spec.rb +6 -6
  76. data/spec/record/save_spec.rb +1 -1
  77. data/spec/record/scope_chains_spec.rb +1 -1
  78. data/spec/record/to_json_spec.rb +1 -1
  79. data/spec/record/where_chains_spec.rb +1 -1
  80. data/spec/record/where_spec.rb +2 -2
  81. data/spec/record/where_values_hash_spec.rb +1 -1
  82. data/spec/request_cycle_cache/main_spec.rb +1 -1
  83. data/spec/views/form_for_spec.rb +1 -1
  84. metadata +5 -5
@@ -7,7 +7,7 @@ describe LHS::Proxy do
7
7
  end
8
8
 
9
9
  class Feedback < LHS::Record
10
- endpoint 'http://datastore/places/:place_id/feedbacks'
10
+ endpoint 'http://datastore/places/{place_id}/feedbacks'
11
11
  end
12
12
  end
13
13
 
@@ -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 ':datastore/content-ads/:campaign_id/feedbacks'
11
- endpoint ':datastore/feedbacks'
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 ':datastore/customers'
11
- endpoint ':datastore/customers/:id'
10
+ endpoint '{+datastore}/customers'
11
+ endpoint '{+datastore}/customers/{id}'
12
12
  end
13
13
  class Contract < LHS::Record
14
- endpoint ':datastore/contracts'
15
- endpoint ':datastore/contracts/:id'
14
+ endpoint '{+datastore}/contracts'
15
+ endpoint '{+datastore}/contracts/{id}'
16
16
  end
17
17
  class Address < LHS::Record
18
- endpoint ':datastore/addresses'
19
- endpoint ':datastore/addresses/:id'
18
+ endpoint '{+datastore}/addresses'
19
+ endpoint '{+datastore}/addresses/{id}'
20
20
  end
21
21
  end
22
22
 
@@ -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 ':datastore/content-ads/:campaign_id/feedbacks'
11
- endpoint ':datastore/feedbacks'
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 ':datastore/:campaign_id/feedbacks'
11
- endpoint ':datastore/feedbacks'
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 ':datastore/local-entries'
11
- endpoint ':datastore/local-entries/:id'
10
+ endpoint '{+datastore}/local-entries'
11
+ endpoint '{+datastore}/local-entries/{id}'
12
12
  end
13
13
  end
14
14
 
@@ -5,7 +5,7 @@ describe LHS::Record do
5
5
  before(:each) do
6
6
  class Record < LHS::Record
7
7
  endpoint 'http://datastore/history'
8
- endpoint 'http://datastore/history/:id'
8
+ endpoint 'http://datastore/history/{id}'
9
9
  end
10
10
  end
11
11
 
@@ -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/:id'
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/:id'
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/:id'
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 ':datastore/v2/feedbacks'
10
- endpoint ':datastore/v2/reviews'
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 ':datastore/v2/:campaign_id/feedbacks'
19
- endpoint ':datastore/v2/:campaign_id/reviews'
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/:id', cache_expires_in: 1.day, retry: 2, cache: true
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 ':datastore/entries/:entry_id/content-ads/:campaign_id/feedbacks'
11
- endpoint ':datastore/:campaign_id/feedbacks'
12
- endpoint ':datastore/feedbacks'
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[':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
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 ':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'
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 ':datastore/:campaign_id/feedbacks'
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 ':datastore/entries/:entry_id/content-ads/:campaign_id/feedbacks'
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 ':datastore/feedbacks'
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 ':datastore/feedbacks'
48
- endpoint ':datastore/feedbacks/:id'
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 ':datastore/feedbacks'
62
- endpoint ':datastore/:campaign_id/feedbacks'
63
- endpoint ':datastore/entries/:entry_id/content-ads/:campaign_id/feedbacks'
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 ':datastore/contracts/:id'
77
- endpoint ':datastore/entry/:entry_id/contracts'
76
+ endpoint '{+datastore}/contracts/:id'
77
+ endpoint '{+datastore}/entry/{entry_id}/contracts'
78
78
  end
79
79
  end
80
80
 
@@ -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 ':datastore/content-ads/:campaign_id/feedbacks'
10
- endpoint ':datastore/content-ads/:campaign_id/feedbacks/:id'
11
- endpoint ':datastore/feedbacks'
12
- endpoint ':datastore/feedbacks/:id'
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 ':datastore/:campaign_id/feedbacks'
24
- endpoint ':datastore/feedbacks'
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 ':datastore/:campaign_id/feedbacks'
24
- endpoint ':datastore/feedbacks'
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 ':datastore/:campaign_id/feedbacks'
71
- endpoint ':datastore/feedbacks'
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
@@ -3,7 +3,7 @@ require 'rails_helper'
3
3
  describe LHS::Record do
4
4
  before(:each) do
5
5
  class Record < LHS::Record
6
- endpoint 'http://datastore/records/:id'
6
+ endpoint 'http://datastore/records/{id}'
7
7
  end
8
8
  end
9
9
 
@@ -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 ':datastore/content-ads/:campaign_id/feedbacks'
10
- endpoint ':datastore/content-ads/:campaign_id/feedbacks/:id'
11
- endpoint ':datastore/feedbacks'
12
- endpoint ':datastore/feedbacks/:id'
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
 
@@ -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 ':datastore/content-ads/:campaign_id/feedbacks'
10
- endpoint ':datastore/feedbacks'
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
  before(:each) do
5
5
  class Location < LHS::Record
6
6
  endpoint 'http://uberall/locations'
7
- endpoint 'http://uberall/locations/:id'
7
+ endpoint 'http://uberall/locations/{id}'
8
8
  has_many :listings
9
9
  end
10
10
 
@@ -7,7 +7,7 @@ describe LHS::Record do
7
7
  before(:each) do
8
8
  class Record < LHS::Record
9
9
  endpoint 'http://local.ch/v2/records'
10
- endpoint 'http://local.ch/v2/records/:id'
10
+ endpoint 'http://local.ch/v2/records/{id}'
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/:id'
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/:id'
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/:id'
218
+ endpoint 'http://datastore/contracts/{id}'
219
219
  end
220
220
 
221
221
  class Entry < LHS::Record
222
- endpoint ':datastore/entry/v1/:id.json'
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/:id'
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/:id'
369
+ endpoint 'http://datastore/places/{id}'
370
370
  end
371
371
 
372
372
  class Contract < LHS::Record
373
- endpoint 'http://datastore/places/:place_id/contracts'
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 ':datastore/local-entries'
30
- endpoint ':datastore/local-entries/:id'
29
+ endpoint '{+datastore}/local-entries'
30
+ endpoint '{+datastore}/local-entries/{id}'
31
31
  end
32
32
  class User < LHS::Record
33
- endpoint ':datastore/users'
34
- endpoint ':datastore/users/:id'
33
+ endpoint '{+datastore}/users'
34
+ endpoint '{+datastore}/users/{id}'
35
35
  end
36
36
  class Favorite < LHS::Record
37
- endpoint ':datastore/favorites'
38
- endpoint ':datastore/favorites/:id'
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 ':datastore/feedbacks'
78
- endpoint ':datastore/feedbacks/:id'
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 ':datastore/local-entries/:id'
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 ':datastore/local-parents'
173
- endpoint ':datastore/local-parents/:id'
172
+ endpoint '{+datastore}/local-parents'
173
+ endpoint '{+datastore}/local-parents/{id}'
174
174
  end
175
175
 
176
176
  class OptionalChild < LHS::Record
177
- endpoint ':datastore/local-children/:id'
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 ':datastore/feedbacks'
228
- endpoint ':datastore/feedbacks/:id'
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 ':datastore/local-entries'
250
+ endpoint '{+datastore}/local-entries'
251
251
  end
252
252
 
253
253
  class Feedback < LHS::Record
254
- endpoint ':datastore/feedbacks'
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 ':datastore/place'
270
- endpoint ':datastore/place/:id'
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 ':datastore/place'
321
- endpoint ':datastore/place/:id'
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 ':datastore/place'
341
- endpoint ':datastore/place/:id'
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 ':datastore/customer/:id'
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 ':datastore/customers/:id'
434
- endpoint ':datastore/customers'
433
+ endpoint '{+datastore}/customers/{id}'
434
+ endpoint '{+datastore}/customers'
435
435
  end
436
436
 
437
437
  class Place < LHS::Record
438
- endpoint ':datastore/places'
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/:id'
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/:id'
541
+ endpoint 'http://datastore/places/{id}'
542
542
  end
543
543
  stub_request(:get, 'http://datastore/places/1')
544
544
  .to_return(body: {