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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a26eb2a3e2ec57d277c5f5ddc2fb09876d1167ba
4
- data.tar.gz: 0cc5a075a9c467df3ff02fdf6aa61b3e6b8fbac9
3
+ metadata.gz: eb98b5987d32cba7baf0a3b5fddc3d1e34b7f832
4
+ data.tar.gz: 0152a873b38d9b1e6e5ae68688d9b9bf468a0d38
5
5
  SHA512:
6
- metadata.gz: b7e691004975f3e78de8cc6797458246d6374a8f90d962ebfd8aee1a6b95174e35f66780d277dea0c25586bbb901281cba0ca662d79af8785ee787fbbffc3220
7
- data.tar.gz: b573b5f628cb8193e263d7ed4659e1d5cfede72b304d0d8f81165142327a13383c23dda89bd97db6100a0e303e263c3db880d9b7ba13fbd7d44099336d9b4e6f
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
- "markmapper-application-test",
80
+ env['app_name'],
81
81
  connection: MarkLogic::Connection.new(env['host'], env['port'])
82
82
  )
83
83
  MarkMapper.application.stale?
@@ -34,7 +34,7 @@ module MarkMapper
34
34
  run_callbacks(:create) { super }
35
35
  end
36
36
 
37
- def update(*)
37
+ def _update(*)
38
38
  run_callbacks(:update) { super }
39
39
  end
40
40
  end
@@ -320,21 +320,20 @@ module MarkMapper
320
320
  to_marklogic(false).with_indifferent_access
321
321
  end
322
322
 
323
- def assign(attrs={})
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
- def update_attributes!(attrs={})
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)
@@ -44,7 +44,7 @@ module MarkMapper
44
44
  true
45
45
  end
46
46
 
47
- def update(options={})
47
+ def _update(options={})
48
48
  if partial_updates
49
49
  updates = fields_for_partial_update
50
50
 
@@ -74,4 +74,4 @@ module MarkMapper
74
74
  end
75
75
  end
76
76
  end
77
- end
77
+ end
@@ -117,7 +117,7 @@ module MarkMapper
117
117
 
118
118
  private
119
119
  def create_or_update(options={})
120
- result = persisted? ? update(options) : create(options)
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 update(options={})
128
+ def _update(options={})
129
129
  save_to_collection(options.reverse_merge(:persistence_method => :save))
130
130
  end
131
131
 
@@ -181,10 +181,10 @@ module MarkMapper
181
181
  end
182
182
  include DSL
183
183
 
184
- # def update(document, driver_opts={})
185
- # query = clone
186
- # query.collection.update(query.criteria_hash, document, driver_opts)
187
- # end
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 }
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module MarkMapper
3
- Version = '0.0.4'
3
+ Version = '0.0.5'
4
4
  end
@@ -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 {
@@ -327,24 +327,24 @@ describe MarkMapper::Query do
327
327
  end
328
328
  end
329
329
 
330
- # context "#update" do
331
- # before do
332
- # @query = described_class.new(@collection).where('_id' => 'john')
333
- # end
330
+ context "#update" do
331
+ before do
332
+ @query = described_class.new(@collection).where('_id' => 'john')
333
+ end
334
334
 
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
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
- # 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
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
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-27 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel