aws-record 1.0.0.pre.8 → 1.0.0.pre.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-record.rb +11 -11
  3. data/lib/aws-record/record.rb +21 -0
  4. data/lib/aws-record/record/attribute.rb +35 -3
  5. data/lib/aws-record/record/attributes.rb +137 -16
  6. data/lib/aws-record/record/dirty_tracking.rb +48 -8
  7. data/lib/aws-record/record/item_operations.rb +96 -48
  8. data/lib/aws-record/record/marshalers/boolean_marshaler.rb +53 -0
  9. data/lib/aws-record/record/marshalers/date_marshaler.rb +61 -0
  10. data/lib/aws-record/record/marshalers/date_time_marshaler.rb +72 -0
  11. data/lib/aws-record/record/marshalers/float_marshaler.rb +52 -0
  12. data/lib/aws-record/record/marshalers/integer_marshaler.rb +52 -0
  13. data/lib/aws-record/record/marshalers/list_marshaler.rb +56 -0
  14. data/lib/aws-record/record/marshalers/map_marshaler.rb +56 -0
  15. data/lib/aws-record/record/marshalers/numeric_set_marshaler.rb +69 -0
  16. data/lib/aws-record/record/marshalers/string_marshaler.rb +52 -0
  17. data/lib/aws-record/record/marshalers/string_set_marshaler.rb +69 -0
  18. data/lib/aws-record/record/version.rb +1 -1
  19. metadata +12 -13
  20. data/lib/aws-record/record/attributes/boolean_marshaler.rb +0 -54
  21. data/lib/aws-record/record/attributes/date_marshaler.rb +0 -54
  22. data/lib/aws-record/record/attributes/date_time_marshaler.rb +0 -55
  23. data/lib/aws-record/record/attributes/float_marshaler.rb +0 -53
  24. data/lib/aws-record/record/attributes/integer_marshaler.rb +0 -53
  25. data/lib/aws-record/record/attributes/list_marshaler.rb +0 -66
  26. data/lib/aws-record/record/attributes/map_marshaler.rb +0 -66
  27. data/lib/aws-record/record/attributes/numeric_set_marshaler.rb +0 -72
  28. data/lib/aws-record/record/attributes/string_marshaler.rb +0 -60
  29. data/lib/aws-record/record/attributes/string_set_marshaler.rb +0 -70
@@ -1,70 +0,0 @@
1
- # Copyright 2015-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You may not
4
- # use this file except in compliance with the License. A copy of the License is
5
- # located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is distributed on
10
- # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
- # or implied. See the License for the specific language governing permissions
12
- # and limitations under the License.
13
-
14
- module Aws
15
- module Record
16
- module Attributes
17
- module StringSetMarshaler
18
-
19
- class << self
20
-
21
- def type_cast(raw_value, options = {})
22
- case raw_value
23
- when nil
24
- Set.new
25
- when ''
26
- Set.new
27
- when Set
28
- _as_strings(raw_value)
29
- else
30
- if raw_value.respond_to?(:to_set)
31
- _as_strings(raw_value.to_set)
32
- else
33
- msg = "Don't know how to make #{raw_value} of type"\
34
- " #{raw_value.class} into a String Set!"
35
- raise ArgumentError, msg
36
- end
37
- end
38
- end
39
-
40
- def serialize(raw_value, options = {})
41
- set = type_cast(raw_value, options)
42
- if set.is_a?(Set)
43
- if set.empty?
44
- nil
45
- else
46
- set
47
- end
48
- else
49
- msg = "expected a Set value or nil, got #{set.class}"
50
- raise ArgumentError, msg
51
- end
52
- end
53
-
54
- private
55
- def _as_strings(set)
56
- set.collect! do |item|
57
- if item.is_a?(String)
58
- item
59
- else
60
- item.to_s
61
- end
62
- end
63
- end
64
-
65
- end
66
-
67
- end
68
- end
69
- end
70
- end