mark_mapper 0.0.4 → 0.0.5
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/mark_mapper/connection.rb +1 -1
- data/lib/mark_mapper/plugins/callbacks.rb +1 -1
- data/lib/mark_mapper/plugins/keys.rb +6 -7
- data/lib/mark_mapper/plugins/partial_updates.rb +2 -2
- data/lib/mark_mapper/plugins/querying.rb +2 -2
- data/lib/mark_mapper/query.rb +4 -4
- data/lib/mark_mapper/version.rb +1 -1
- data/spec/unit/keys_spec.rb +0 -11
- data/spec/unit/query_spec.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb98b5987d32cba7baf0a3b5fddc3d1e34b7f832
|
4
|
+
data.tar.gz: 0152a873b38d9b1e6e5ae68688d9b9bf468a0d38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a3d34ade846bc80bc081aa9b86e5cd24374b41f33a5f7897bdc2269e5857160e9b5f94c82d50e5bca09109104a9360a66ef923a259077402bb2317c1d237cd
|
7
|
+
data.tar.gz: 4ab6433cbd8f0c6636eec740dc58fc32b5367d68a2c93fc8abd29adb703e10650ca4864f79bc9d2a8dbbe3d28dc18441b5323fedca499701350455c7246267f8
|
@@ -77,7 +77,7 @@ module MarkMapper
|
|
77
77
|
MarkLogic::Connection.configure(app_services_port: env['app_services_port']) if env['app_services_port']
|
78
78
|
|
79
79
|
MarkMapper.application = MarkLogic::Application.new(
|
80
|
-
|
80
|
+
env['app_name'],
|
81
81
|
connection: MarkLogic::Connection.new(env['host'], env['port'])
|
82
82
|
)
|
83
83
|
MarkMapper.application.stale?
|
@@ -320,21 +320,20 @@ module MarkMapper
|
|
320
320
|
to_marklogic(false).with_indifferent_access
|
321
321
|
end
|
322
322
|
|
323
|
-
def
|
324
|
-
warn "[DEPRECATION] #assign is deprecated, use #attributes="
|
325
|
-
self.attributes = attrs
|
326
|
-
end
|
327
|
-
|
328
|
-
def update_attributes(attrs={})
|
323
|
+
def update(attrs={})
|
329
324
|
self.attributes = attrs
|
330
325
|
save
|
331
326
|
end
|
332
327
|
|
333
|
-
|
328
|
+
alias update_attributes update
|
329
|
+
|
330
|
+
def update!(attrs={})
|
334
331
|
self.attributes = attrs
|
335
332
|
save!
|
336
333
|
end
|
337
334
|
|
335
|
+
alias update_attributes! update!
|
336
|
+
|
338
337
|
def update_attribute(name, value)
|
339
338
|
self.send(:"#{name}=", value)
|
340
339
|
save(:validate => false)
|
@@ -117,7 +117,7 @@ module MarkMapper
|
|
117
117
|
|
118
118
|
private
|
119
119
|
def create_or_update(options={})
|
120
|
-
result = persisted? ?
|
120
|
+
result = persisted? ? _update(options) : create(options)
|
121
121
|
result != false
|
122
122
|
end
|
123
123
|
|
@@ -125,7 +125,7 @@ module MarkMapper
|
|
125
125
|
save_to_collection(options.merge(:persistence_method => :insert))
|
126
126
|
end
|
127
127
|
|
128
|
-
def
|
128
|
+
def _update(options={})
|
129
129
|
save_to_collection(options.reverse_merge(:persistence_method => :save))
|
130
130
|
end
|
131
131
|
|
data/lib/mark_mapper/query.rb
CHANGED
@@ -181,10 +181,10 @@ module MarkMapper
|
|
181
181
|
end
|
182
182
|
include DSL
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
184
|
+
def update(document, driver_opts={})
|
185
|
+
query = clone
|
186
|
+
query.collection.update(query.criteria_hash, document, driver_opts)
|
187
|
+
end
|
188
188
|
|
189
189
|
def amend(opts={})
|
190
190
|
opts.each { |key, value| self[key] = value }
|
data/lib/mark_mapper/version.rb
CHANGED
data/spec/unit/keys_spec.rb
CHANGED
@@ -24,17 +24,6 @@ describe "Key" do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context "#assign" do
|
28
|
-
it "should raise a deprecation warning" do
|
29
|
-
klass = Doc() do
|
30
|
-
key :_id, Integer
|
31
|
-
end
|
32
|
-
doc = klass.new
|
33
|
-
expect(doc).to receive(:warn).once
|
34
|
-
doc.assign({:x => :y})
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
27
|
# TODO: Are these methods deprecated?
|
39
28
|
context "#embedded and #non_embedded_keys" do
|
40
29
|
EmbeddableThingie = EDoc {
|
data/spec/unit/query_spec.rb
CHANGED
@@ -327,24 +327,24 @@ describe MarkMapper::Query do
|
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
330
|
+
context "#update" do
|
331
|
+
before do
|
332
|
+
@query = described_class.new(@collection).where('_id' => 'john')
|
333
|
+
end
|
334
334
|
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
335
|
+
it "works with document" do
|
336
|
+
@query.update('$set' => {'age' => 29})
|
337
|
+
doc = @query.first('_id' => 'john')
|
338
|
+
doc['age'].should be(29)
|
339
|
+
end
|
340
340
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
341
|
+
it "works with document and driver options" do
|
342
|
+
@query.update({'$set' => {'age' => 30}}, :multi => true)
|
343
|
+
@query.each do |doc|
|
344
|
+
doc['age'].should be(30)
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
348
|
|
349
349
|
context "#[]" do
|
350
350
|
it "returns value if key in criteria (symbol)" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mark_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paxton Hare
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|