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
@@ -6,11 +6,11 @@ describe LHS::Record do
|
|
6
6
|
|
7
7
|
it 'is possible to load records twice' do
|
8
8
|
class Feedback < LHS::Record
|
9
|
-
endpoint '
|
9
|
+
endpoint '{+datastore}/feedbacks'
|
10
10
|
end
|
11
11
|
|
12
12
|
class Feedback < LHS::Record
|
13
|
-
endpoint '
|
13
|
+
endpoint '{+datastore}/feedbacks'
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/spec/record/mapping_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 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
|
|
@@ -50,7 +50,7 @@ describe LHS::Record do
|
|
50
50
|
|
51
51
|
it 'clones mappings when using include' do
|
52
52
|
class Agb < LHS::Record
|
53
|
-
endpoint "
|
53
|
+
endpoint "{+datastore}/agbs/active?agb_type=CC_TOU"
|
54
54
|
def pdf_url
|
55
55
|
self['binary_url_pdf_de']
|
56
56
|
end
|
@@ -84,8 +84,8 @@ describe LHS::Record do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
class Favorite < LHS::Record
|
87
|
-
endpoint '
|
88
|
-
endpoint '
|
87
|
+
endpoint '{+datastore}/favorites'
|
88
|
+
endpoint '{+datastore}/favorites/{id}'
|
89
89
|
end
|
90
90
|
stub_request(:get, "#{datastore}/local-entries/1")
|
91
91
|
.to_return(body: { company_name: 'local.ch' }.to_json)
|
data/spec/record/new_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 Rating < 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
|
|
@@ -29,7 +29,7 @@ describe LHS::Record do
|
|
29
29
|
context 'initialise records with raw data' do
|
30
30
|
before(:each) do
|
31
31
|
class User < LHS::Record
|
32
|
-
endpoint '
|
32
|
+
endpoint '{+datastore}/users'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/spec/record/options_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe LHS::Record do
|
|
8
8
|
before(:each) do
|
9
9
|
LHC.config.placeholder('datastore', datastore)
|
10
10
|
class Record < LHS::Record
|
11
|
-
endpoint '
|
11
|
+
endpoint '{+datastore}/records', validates: { persist: false }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -143,7 +143,7 @@ describe LHS::Record do
|
|
143
143
|
before(:each) do
|
144
144
|
stub_request(:post, 'http://datastore/v2/records?persist=false').to_return(body: {}.to_json)
|
145
145
|
expect(LHC).to receive(:request)
|
146
|
-
.with(options.merge(url: '
|
146
|
+
.with(options.merge(url: '{+datastore}/records', method: :post, params: { persist: false }, body: "{\"href\":\"http://datastore/v2/records/123\"}", headers: { "Content-Type" => "application/json" }))
|
147
147
|
.and_call_original
|
148
148
|
end
|
149
149
|
|
@@ -8,7 +8,7 @@ describe LHS::Record do
|
|
8
8
|
context 'default pagination behaviour' do
|
9
9
|
before(:each) do
|
10
10
|
class Record < LHS::Record
|
11
|
-
endpoint '
|
11
|
+
endpoint '{+datastore}/feedbacks'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -52,7 +52,7 @@ describe LHS::Record do
|
|
52
52
|
before(:each) do
|
53
53
|
class Record < LHS::Record
|
54
54
|
configuration pagination_strategy: 'offset', pagination_key: 'offset'
|
55
|
-
endpoint '
|
55
|
+
endpoint '{+datastore}/feedbacks'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -132,7 +132,7 @@ describe LHS::Record do
|
|
132
132
|
before(:each) do
|
133
133
|
class Record < LHS::Record
|
134
134
|
configuration pagination_strategy: 'page', pagination_key: 'page'
|
135
|
-
endpoint '
|
135
|
+
endpoint '{+datastore}/feedbacks'
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -210,7 +210,7 @@ describe LHS::Record do
|
|
210
210
|
before(:each) do
|
211
211
|
class Record < LHS::Record
|
212
212
|
configuration pagination_strategy: 'start', pagination_key: 'start'
|
213
|
-
endpoint '
|
213
|
+
endpoint '{+datastore}/feedbacks'
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -6,7 +6,7 @@ describe LHS::Record do
|
|
6
6
|
before(:each) do
|
7
7
|
class Record < LHS::Record
|
8
8
|
endpoint 'http://local.ch/records'
|
9
|
-
endpoint 'http://local.ch/records
|
9
|
+
endpoint 'http://local.ch/records/{id}'
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -59,7 +59,7 @@ describe LHS::Record do
|
|
59
59
|
class Record < LHS::Record
|
60
60
|
configuration pagination_strategy: 'start', pagination_key: 'start'
|
61
61
|
endpoint 'http://local.ch/records'
|
62
|
-
endpoint 'http://local.ch/records
|
62
|
+
endpoint 'http://local.ch/records/{id}'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -80,7 +80,7 @@ describe LHS::Record do
|
|
80
80
|
class Record < LHS::Record
|
81
81
|
configuration pagination_strategy: 'page', pagination_key: 'page'
|
82
82
|
endpoint 'http://local.ch/records'
|
83
|
-
endpoint 'http://local.ch/records
|
83
|
+
endpoint 'http://local.ch/records/{id}'
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -23,7 +23,7 @@ describe LHS::Record do
|
|
23
23
|
before(:each) do
|
24
24
|
LHC.config.placeholder('datastore', datastore)
|
25
25
|
class Feedback < LHS::Record
|
26
|
-
endpoint '
|
26
|
+
endpoint '{+datastore}/feedbacks'
|
27
27
|
end
|
28
28
|
stub_request(:get, 'http://local.ch/v2/feedbacks?entry_id=1')
|
29
29
|
.to_return(body: body_json)
|
@@ -4,12 +4,12 @@ describe LHS::Record do
|
|
4
4
|
before(:each) do
|
5
5
|
class Record < LHS::Record
|
6
6
|
endpoint 'http://datastore/records'
|
7
|
-
endpoint 'http://datastore/records
|
7
|
+
endpoint 'http://datastore/records/{id}'
|
8
8
|
end
|
9
9
|
|
10
10
|
class AnotherRecord < LHS::Record
|
11
11
|
endpoint 'http://datastore/otherrecords'
|
12
|
-
endpoint 'http://datastore/otherrecords
|
12
|
+
endpoint 'http://datastore/otherrecords/{id}'
|
13
13
|
|
14
14
|
def id
|
15
15
|
another_id
|
data/spec/record/reload_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe LHS::Record do
|
|
4
4
|
before(:each) do
|
5
5
|
class Record < LHS::Record
|
6
6
|
endpoint 'http://datastore/records'
|
7
|
-
endpoint 'http://datastore/records
|
7
|
+
endpoint 'http://datastore/records/{id}'
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -27,7 +27,7 @@ describe LHS::Record do
|
|
27
27
|
before(:each) do
|
28
28
|
class Location < LHS::Record
|
29
29
|
endpoint 'http://uberall/locations'
|
30
|
-
endpoint 'http://uberall/locations
|
30
|
+
endpoint 'http://uberall/locations/{id}'
|
31
31
|
|
32
32
|
configuration item_key: [:response, :location], items_key: [:response, :locations]
|
33
33
|
end
|
data/spec/record/request_spec.rb
CHANGED
@@ -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/feedbacks
|
6
|
+
endpoint 'http://datastore/feedbacks/{id}'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -13,8 +13,8 @@ describe LHS::Record do
|
|
13
13
|
before(:each) do
|
14
14
|
LHC.config.placeholder(:datastore, datastore)
|
15
15
|
class Record < LHS::Record
|
16
|
-
endpoint '
|
17
|
-
endpoint '
|
16
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
17
|
+
endpoint '{+datastore}/feedbacks'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -28,20 +28,20 @@ describe LHS::Record do
|
|
28
28
|
context '#convert_options_to_endpoint' do
|
29
29
|
before(:each) do
|
30
30
|
class Record < LHS::Record
|
31
|
-
endpoint 'http://datastore/feedbacks
|
31
|
+
endpoint 'http://datastore/feedbacks/{id}', params: { tracking: 123 }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'identifies endpoint by given url and merges back endpoint template parameters' do
|
36
36
|
options = LHS::Record.send(:convert_options_to_endpoints, url: 'http://datastore/feedbacks/1')
|
37
37
|
expect(options[:params][:id]).to eq '1'
|
38
|
-
expect(options[:url]).to eq 'http://datastore/feedbacks
|
38
|
+
expect(options[:url]).to eq 'http://datastore/feedbacks/{id}'
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'identifies endpoint by given url and merges back endpoint template parameters into an array, if array was given' do
|
42
42
|
options = LHS::Record.send(:convert_options_to_endpoints, [{ url: 'http://datastore/feedbacks/1' }])
|
43
43
|
expect(options[0][:params][:id]).to eq '1'
|
44
|
-
expect(options[0][:url]).to eq 'http://datastore/feedbacks
|
44
|
+
expect(options[0][:url]).to eq 'http://datastore/feedbacks/{id}'
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'returnes nil if endpoint was not found for the given url' do
|
data/spec/record/save_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe LHS::Record do
|
|
12
12
|
before(:each) do
|
13
13
|
LHC.config.placeholder('datastore', datastore)
|
14
14
|
class Record < LHS::Record
|
15
|
-
endpoint '
|
15
|
+
endpoint '{+datastore}/records/'
|
16
16
|
scope :blue, -> { where(color: 'blue') }
|
17
17
|
scope :available, -> { where(availalbe: 'true') }
|
18
18
|
scope :limited_to, ->(limit) { where(limit: limit) }
|
data/spec/record/to_json_spec.rb
CHANGED
data/spec/record/where_spec.rb
CHANGED
@@ -8,8 +8,8 @@ describe LHS::Record do
|
|
8
8
|
before(:each) do
|
9
9
|
LHC.config.placeholder('datastore', datastore)
|
10
10
|
class Record < LHS::Record
|
11
|
-
endpoint '
|
12
|
-
endpoint '
|
11
|
+
endpoint '{+datastore}/content-ads/{campaign_id}/feedbacks'
|
12
|
+
endpoint '{+datastore}/feedbacks'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -13,7 +13,7 @@ describe 'Request Cycle Cache', type: :request do
|
|
13
13
|
before(:each) do
|
14
14
|
class User < LHS::Record
|
15
15
|
endpoint 'http://datastore/v2/users'
|
16
|
-
endpoint 'http://datastore/v2/users
|
16
|
+
endpoint 'http://datastore/v2/users/{id}'
|
17
17
|
end
|
18
18
|
LHC.configure do |config|
|
19
19
|
config.interceptors = [LHC::Caching]
|
data/spec/views/form_for_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 15.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -436,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
436
436
|
requirements:
|
437
437
|
- Ruby >= 2.3.0
|
438
438
|
rubyforge_project:
|
439
|
-
rubygems_version: 2.6.
|
439
|
+
rubygems_version: 2.6.14
|
440
440
|
signing_key:
|
441
441
|
specification_version: 4
|
442
442
|
summary: Rails gem providing an easy, active-record-like interface for http json services
|