lhs 19.0.1 → 19.0.2
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/README.md +3 -1
- data/lib/lhs/record.rb +6 -0
- data/lib/lhs/version.rb +1 -1
- data/spec/item/update_spec.rb +5 -1
- data/spec/record/dup_spec.rb +20 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b7b500cba025714dd25acd5768e165e52a9a3a5310c4aee5a76e649edbadf6
|
4
|
+
data.tar.gz: d6460304be65c24f414e71c8a58bcf127cc7a79ad6a6fb3854c50dc177c0f835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6777297192f3a1daefd322c76681a9402bef7893f67c9520e4db7b67357d67065a580f34069b85f13f971738c7a174e9be97f54641fe2254bdec07939f4dd60
|
7
|
+
data.tar.gz: 46d307a8ad2c62f749c30552c2785db48d44dcb87612150eb25b312129320561f782041fc9139ed9ecc4abcfc8336bf91693f207b958a8c76b386d1f3b371f3d
|
data/README.md
CHANGED
@@ -1358,7 +1358,9 @@ The kaminari’s page parameter is in params[:page]. For example, you can use ka
|
|
1358
1358
|
|
1359
1359
|
##### create
|
1360
1360
|
|
1361
|
-
`create` will return
|
1361
|
+
`create` will return the object in memory if persisting fails, providing validation errors in `.errors` (See [record validation](#record-validation)).
|
1362
|
+
|
1363
|
+
`create!` instead will raise an exception.
|
1362
1364
|
|
1363
1365
|
`create` always builds the data of the local object first, before it tries to sync with an endpoint. So even if persisting fails, the local object is build.
|
1364
1366
|
|
data/lib/lhs/record.rb
CHANGED
@@ -83,6 +83,12 @@ class LHS::Record
|
|
83
83
|
new(data)
|
84
84
|
end
|
85
85
|
|
86
|
+
# Override Object#dup because it doesn't support copying any singleton
|
87
|
+
# methods, which leads to missing `_data` method when you execute `dup`.
|
88
|
+
def dup
|
89
|
+
clone
|
90
|
+
end
|
91
|
+
|
86
92
|
protected
|
87
93
|
|
88
94
|
def method_missing(name, *args, &block)
|
data/lib/lhs/version.rb
CHANGED
data/spec/item/update_spec.rb
CHANGED
@@ -88,11 +88,15 @@ describe LHS::Item do
|
|
88
88
|
|
89
89
|
class AppointmentProposal < LHS::Record
|
90
90
|
endpoint 'http://bookings/bookings'
|
91
|
+
has_many :appointments
|
91
92
|
|
92
93
|
def appointments_attributes=(attributes)
|
93
|
-
self.appointments = attributes.map { |attribute|
|
94
|
+
self.appointments = attributes.map { |attribute| Appointment.new('date_time': attribute[:date]) }
|
94
95
|
end
|
95
96
|
end
|
97
|
+
|
98
|
+
class Appointment < LHS::Record
|
99
|
+
end
|
96
100
|
end
|
97
101
|
|
98
102
|
let(:item) do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
describe LHS::Record do
|
6
|
+
describe '#dup' do
|
7
|
+
before do
|
8
|
+
class Appointment < LHS::Record
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a copy of an object' do
|
13
|
+
appointment = Appointment.new
|
14
|
+
copy = appointment.dup
|
15
|
+
expect(copy.inspect).to match(/Appointment/)
|
16
|
+
expect(copy).to be_kind_of(Appointment)
|
17
|
+
expect(copy.object_id).not_to eql(appointment.object_id)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
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: 19.0.
|
4
|
+
version: 19.0.2
|
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: 2019-03
|
11
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -389,6 +389,7 @@ files:
|
|
389
389
|
- spec/record/definitions_spec.rb
|
390
390
|
- spec/record/destroy_spec.rb
|
391
391
|
- spec/record/dig_configuration_spec.rb
|
392
|
+
- spec/record/dup_spec.rb
|
392
393
|
- spec/record/endpoint_inheritance_spec.rb
|
393
394
|
- spec/record/endpoint_misconfiguration_spec.rb
|
394
395
|
- spec/record/endpoint_options_spec.rb
|
@@ -471,8 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
471
472
|
version: '0'
|
472
473
|
requirements:
|
473
474
|
- Ruby >= 2.3.0
|
474
|
-
|
475
|
-
rubygems_version: 2.7.8
|
475
|
+
rubygems_version: 3.0.2
|
476
476
|
signing_key:
|
477
477
|
specification_version: 4
|
478
478
|
summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
|
@@ -589,6 +589,7 @@ test_files:
|
|
589
589
|
- spec/record/definitions_spec.rb
|
590
590
|
- spec/record/destroy_spec.rb
|
591
591
|
- spec/record/dig_configuration_spec.rb
|
592
|
+
- spec/record/dup_spec.rb
|
592
593
|
- spec/record/endpoint_inheritance_spec.rb
|
593
594
|
- spec/record/endpoint_misconfiguration_spec.rb
|
594
595
|
- spec/record/endpoint_options_spec.rb
|