ocean-dynamo 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff368d52609524104e5a4ebc1d1f3ee662aff305
4
- data.tar.gz: b5cee188f14a56e495210b5201c7019137bd8d8a
3
+ metadata.gz: 73851353b9d6b8bee8d39d16f43cf6006026260f
4
+ data.tar.gz: d0d20d6ec619909fad2b35e46294be360c964dbd
5
5
  SHA512:
6
- metadata.gz: 9b10779bbb989318384e5f7bf1d4fca2ee20da72eecdf441175b8473f22d70a71f9185dd458b2ccc58e073118fbdf5787e8c91dcb3353a7325793a62dec84548
7
- data.tar.gz: 10851e376bbcfd6330f7e4414e573e6bc3fe704fdd74afa6a5eff50ff3980c2ca6a49b7dfc962330ff33a4b87862546a275d55e83446acf41c85baac44bf0cd1
6
+ metadata.gz: b41c394e855a63e1afc69968b97a807044ad8cde207607aa77ae63300f121f0b733e463579727d92029d65a5916663f41fe630fc089ad78bd9591214f752d8c7
7
+ data.tar.gz: 9ecb8bb8b155e5a9aa9f92a8a53675b38e2336df9b5381cfd5242ba0354b60b4f0e1616a2ce377e3e6447509cd5ebdbf65056642f7717f0e43b8c520ea112b6b
@@ -11,13 +11,46 @@ module OceanDynamo
11
11
 
12
12
  class DynamoError < StandardError; end
13
13
 
14
- class NoPrimaryKeyDeclared < DynamoError; end
14
+ class UnknownPrimaryKey < DynamoError; end
15
+
15
16
  class UnknownTableStatus < DynamoError; end
17
+
16
18
  class UnsupportedType < DynamoError; end
17
- class RecordInvalid < DynamoError; end
18
- class RecordNotSaved < DynamoError; end
19
+
20
+ class SerializationTypeMismatch < DynamoError; end
21
+
22
+ class ConnectionNotEstablished < DynamoError; end
23
+
19
24
  class RecordNotFound < DynamoError; end
20
- class RecordInConflict < DynamoError; end
25
+
26
+ class RecordNotSaved < DynamoError; end
27
+
28
+ class RecordInvalid < DynamoError; end
29
+
30
+ class RecordNotDestroyed < DynamoError; end
31
+
32
+ class StatementInvalid < DynamoError; end
33
+
34
+ class WrappedDatabaseException < StatementInvalid; end
35
+ class RecordNotUnique < WrappedDatabaseException; end
36
+ class InvalidForeignKey < WrappedDatabaseException; end
37
+
38
+ class StaleObjectError < DynamoError; end
39
+
40
+ class ReadOnlyRecord < DynamoError; end
41
+
42
+ class DangerousAttributeError < DynamoError; end
43
+
44
+ class UnknownAttributeError < NoMethodError; end
45
+
46
+ class AttributeAssignmentError < DynamoError; end
47
+
48
+ class MultiparameterAssignmentErrors < DynamoError; end
49
+
50
+
51
+
52
+
53
+
21
54
 
22
55
 
23
56
  class Base
@@ -273,7 +306,7 @@ module OceanDynamo
273
306
  @dynamo_item = nil
274
307
  @destroyed = false
275
308
  @new_record = true
276
- raise NoPrimaryKeyDeclared unless table_hash_key
309
+ raise UnknownPrimaryKey unless table_hash_key
277
310
  end
278
311
  attrs && attrs.delete_if { |k, v| !fields.has_key?(k) }
279
312
  super(attrs)
@@ -320,6 +353,11 @@ module OceanDynamo
320
353
 
321
354
 
322
355
  def assign_attributes(values)
356
+ # if values.respond_to?(:permitted?)
357
+ # unless values.permitted?
358
+ # raise ActiveModel::ForbiddenAttributesError
359
+ # end
360
+ # end
323
361
  values.each do |k, v|
324
362
  send("#{k}=", v)
325
363
  end
@@ -336,10 +374,8 @@ module OceanDynamo
336
374
  end
337
375
 
338
376
 
339
- def serialize_attribute(attribute, value,
340
- metadata=fields[attribute],
341
- type: metadata[:type],
342
- default: metadata[:default])
377
+ def serialize_attribute(attribute, value, metadata=fields[attribute],
378
+ type: metadata[:type])
343
379
  return nil if value == nil
344
380
  case type
345
381
  when :string
@@ -370,9 +406,7 @@ module OceanDynamo
370
406
  end
371
407
 
372
408
 
373
- def deserialize_attribute(value, metadata,
374
- type: metadata[:type],
375
- default: metadata[:default])
409
+ def deserialize_attribute(value, metadata, type: metadata[:type])
376
410
  case type
377
411
  when :string
378
412
  return "" if value == nil
@@ -429,7 +463,7 @@ module OceanDynamo
429
463
  def save
430
464
  begin
431
465
  create_or_update
432
- rescue RecordInvalid, RecordNotSaved
466
+ rescue RecordInvalid
433
467
  false
434
468
  end
435
469
  end
@@ -543,6 +577,11 @@ module OceanDynamo
543
577
  end
544
578
 
545
579
 
580
+ def perform_validations(options={}) # :nodoc:
581
+ options[:validate] == false || valid?(options[:context])
582
+ end
583
+
584
+
546
585
  def dynamo_persist
547
586
  @dynamo_item = dynamo_items.put(serialized_attributes)
548
587
  @new_record = false
@@ -1,3 +1,3 @@
1
1
  module OceanDynamo
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
@@ -164,5 +164,5 @@ rubyforge_project:
164
164
  rubygems_version: 2.0.7
165
165
  signing_key:
166
166
  specification_version: 4
167
- summary: This gem implements common Ocean behaviour for Ruby and Ruby on Rails.
167
+ summary: This gem implements an ActiveRecord-like DynamoDB ORM class.
168
168
  test_files: []