lws 7.1.0 → 7.1.1
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/lib/lws.rb +1 -1
- data/lib/lws/apps/generic.rb +16 -1
- data/lib/lws/version.rb +1 -1
- data/test/generic_test.rb +14 -0
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a8d517993d1edc2f3ee98d57c5e8d96722e8c30f3022e346eaeee1f548a8b8
|
4
|
+
data.tar.gz: ca21b87824d2470ebfde323df4e979be95ca943d79df42ab454d66626ab50532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc0ba9e36161be2702592791d1c4baad190714b39fe5fe67e2e0b78c61cf80e5a53be2ce3d820497052b87e587f5efdfd0253fd4561f97debabfd961fb8b0d5
|
7
|
+
data.tar.gz: 6db01df5b9610858c985e4d1ab711cf29538a9bed8601437a7f476c3d633417ed910a93ed0b32b3ed9d88a7d993667f2ae8a03689c4afd4e4e959cbc417cdee2
|
data/lib/lws.rb
CHANGED
@@ -60,7 +60,7 @@ module LWS
|
|
60
60
|
# config.api_token_middleware = TokenAuthenticator
|
61
61
|
# config.caching_object = MyRedisCache.new
|
62
62
|
# config.environment = :development
|
63
|
-
# config.
|
63
|
+
# config.endpoints = { maps: "https://maps.leftclick.cloud" }
|
64
64
|
# config.http_debug = true
|
65
65
|
# config.json_debug = true
|
66
66
|
# config.logger = Rails.logger
|
data/lib/lws/apps/generic.rb
CHANGED
@@ -150,8 +150,9 @@ module LWS::Generic
|
|
150
150
|
result
|
151
151
|
end
|
152
152
|
|
153
|
-
# Extracts a nested attribute
|
153
|
+
# Extracts a nested attribute value specified by the sequence of attribute names
|
154
154
|
# by calling dig at each step, returning +nil+ if any intermediate step is +nil+.
|
155
|
+
# @return [Object, nil] the digged up value or +nil+
|
155
156
|
def dig(*attrs)
|
156
157
|
attr = attrs.shift
|
157
158
|
value = send(attr)
|
@@ -161,6 +162,20 @@ module LWS::Generic
|
|
161
162
|
value.dig(*attrs)
|
162
163
|
end
|
163
164
|
|
165
|
+
# Returns a deep copy of the model.
|
166
|
+
# @return [Model] a deep copy of the model
|
167
|
+
def deep_dup
|
168
|
+
dup_obj = super
|
169
|
+
dup_obj.instance_eval do
|
170
|
+
@changed_attributes = @changed_attributes.deep_dup
|
171
|
+
@previously_changed = @previously_changed.deep_dup
|
172
|
+
@scope = @scope.deep_dup
|
173
|
+
@spyke_attributes = @spyke_attributes.deep_dup
|
174
|
+
@uri_template = @uri_template.deep_dup
|
175
|
+
end
|
176
|
+
dup_obj
|
177
|
+
end
|
178
|
+
|
164
179
|
end
|
165
180
|
|
166
181
|
# = The configuration class
|
data/lib/lws/version.rb
CHANGED
data/test/generic_test.rb
CHANGED
@@ -106,6 +106,20 @@ class TestGenericModel < MiniTest::Test
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
def test_deep_dup
|
110
|
+
company = LWS::Auth::Company.find(1)
|
111
|
+
company_dup = company.deep_dup
|
112
|
+
|
113
|
+
# The object itself
|
114
|
+
refute_equal(company.object_id, company_dup.object_id)
|
115
|
+
# An object as attribute value
|
116
|
+
refute_equal(company.address.object_id, company_dup.address.object_id)
|
117
|
+
# A related object
|
118
|
+
refute_equal(company.contact_person.object_id, company_dup.contact_person.object_id)
|
119
|
+
# An item in array of related objects
|
120
|
+
refute_equal(company.accounts.first.object_id, company_dup.accounts.first.object_id)
|
121
|
+
end
|
122
|
+
|
109
123
|
end
|
110
124
|
|
111
125
|
class TestGenericConfiguration < MiniTest::Test
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeftClick B.V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|
@@ -296,27 +296,27 @@ signing_key:
|
|
296
296
|
specification_version: 4
|
297
297
|
summary: LeftClick web services library for Ruby
|
298
298
|
test_files:
|
299
|
-
- test/presence_test.rb
|
300
|
-
- test/fixtures/permissions.yml
|
301
|
-
- test/fixtures/auth.yml
|
302
|
-
- test/corporate_website_test.rb
|
303
|
-
- test/logger_test.rb
|
304
299
|
- test/support/with_env.rb
|
305
|
-
- test/
|
300
|
+
- test/json_parser_test.rb
|
301
|
+
- test/test_helper.rb
|
302
|
+
- test/setup_test.rb
|
306
303
|
- test/ticket_test.rb
|
304
|
+
- test/api_token_middleware_test.rb
|
305
|
+
- test/stubbing_test.rb
|
306
|
+
- test/presence_test.rb
|
307
307
|
- test/digital_signage_test.rb
|
308
|
-
- test/
|
308
|
+
- test/generic_test.rb
|
309
|
+
- test/logger_test.rb
|
309
310
|
- test/auth_test.rb
|
310
|
-
- test/maps_test.rb
|
311
|
-
- test/json_parser_test.rb
|
312
311
|
- test/resource_test.rb
|
312
|
+
- test/maps_test.rb
|
313
|
+
- test/corporate_website_test.rb
|
314
|
+
- test/config/tokens.yml
|
315
|
+
- test/config/empty.yml
|
313
316
|
- test/config/endpoints.yml
|
314
|
-
- test/config/switch_env.yml
|
315
317
|
- test/config/invalid.yml
|
316
|
-
- test/config/
|
317
|
-
- test/config/tokens.yml
|
318
|
+
- test/config/switch_env.yml
|
318
319
|
- test/config/full.yml
|
319
|
-
- test/
|
320
|
-
- test/
|
321
|
-
- test/
|
322
|
-
- test/test_helper.rb
|
320
|
+
- test/caching_test.rb
|
321
|
+
- test/fixtures/auth.yml
|
322
|
+
- test/fixtures/permissions.yml
|