aws-sdk 1.2.6 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws.rb +2 -0
- data/lib/aws/api_config/DynamoDB-2011-12-05.yml +721 -0
- data/lib/aws/core.rb +10 -1
- data/lib/aws/core/client.rb +17 -12
- data/lib/aws/core/configuration.rb +13 -3
- data/lib/aws/core/configured_json_client_methods.rb +71 -0
- data/lib/aws/core/lazy_error_classes.rb +7 -2
- data/lib/aws/core/option_grammar.rb +67 -13
- data/lib/aws/core/resource.rb +9 -1
- data/lib/aws/core/session_signer.rb +95 -0
- data/lib/aws/dynamo_db.rb +169 -0
- data/lib/aws/dynamo_db/attribute_collection.rb +460 -0
- data/lib/aws/dynamo_db/batch_get.rb +206 -0
- data/lib/aws/dynamo_db/client.rb +119 -0
- data/lib/aws/dynamo_db/config.rb +20 -0
- data/lib/aws/dynamo_db/errors.rb +57 -0
- data/lib/aws/dynamo_db/expectations.rb +40 -0
- data/lib/aws/dynamo_db/item.rb +130 -0
- data/lib/aws/dynamo_db/item_collection.rb +837 -0
- data/lib/aws/{record/optimistic_locking.rb → dynamo_db/item_data.rb} +9 -12
- data/lib/aws/{record/attributes/boolean.rb → dynamo_db/keys.rb} +15 -23
- data/lib/aws/dynamo_db/primary_key_element.rb +47 -0
- data/lib/aws/dynamo_db/request.rb +78 -0
- data/lib/aws/{record/attributes/float.rb → dynamo_db/resource.rb} +10 -25
- data/lib/aws/dynamo_db/table.rb +418 -0
- data/lib/aws/dynamo_db/table_collection.rb +165 -0
- data/lib/aws/dynamo_db/types.rb +86 -0
- data/lib/aws/ec2/resource_tag_collection.rb +3 -1
- data/lib/aws/record.rb +36 -8
- data/lib/aws/record/abstract_base.rb +642 -0
- data/lib/aws/record/attributes.rb +384 -0
- data/lib/aws/record/dirty_tracking.rb +0 -1
- data/lib/aws/record/errors.rb +0 -8
- data/lib/aws/record/hash_model.rb +163 -0
- data/lib/aws/record/hash_model/attributes.rb +182 -0
- data/lib/aws/record/hash_model/finder_methods.rb +178 -0
- data/lib/aws/record/hash_model/scope.rb +108 -0
- data/lib/aws/record/model.rb +429 -0
- data/lib/aws/record/model/attributes.rb +377 -0
- data/lib/aws/record/model/finder_methods.rb +232 -0
- data/lib/aws/record/model/scope.rb +213 -0
- data/lib/aws/record/scope.rb +43 -169
- data/lib/aws/record/validations.rb +11 -11
- data/lib/aws/s3/client.rb +9 -6
- data/lib/aws/s3/object_collection.rb +1 -1
- data/lib/aws/simple_db/expect_condition_option.rb +1 -1
- data/lib/aws/simple_db/item_collection.rb +5 -3
- data/lib/aws/sts/client.rb +9 -0
- metadata +73 -30
- data/lib/aws/record/attribute.rb +0 -94
- data/lib/aws/record/attribute_macros.rb +0 -312
- data/lib/aws/record/attributes/date.rb +0 -89
- data/lib/aws/record/attributes/datetime.rb +0 -86
- data/lib/aws/record/attributes/integer.rb +0 -68
- data/lib/aws/record/attributes/sortable_float.rb +0 -60
- data/lib/aws/record/attributes/sortable_integer.rb +0 -95
- data/lib/aws/record/attributes/string.rb +0 -69
- data/lib/aws/record/base.rb +0 -828
- data/lib/aws/record/finder_methods.rb +0 -230
- data/lib/aws/record/scopes.rb +0 -55
@@ -26,7 +26,7 @@ require 'aws/record/validators/method'
|
|
26
26
|
module AWS
|
27
27
|
module Record
|
28
28
|
|
29
|
-
# Validation methods to be used with subclasses of AWS::Record::
|
29
|
+
# Validation methods to be used with subclasses of AWS::Record::Model.
|
30
30
|
#
|
31
31
|
# = General Usage
|
32
32
|
#
|
@@ -34,7 +34,7 @@ module AWS
|
|
34
34
|
# Call the validation method followed by one more attribute names
|
35
35
|
# and then an optional hash of modifiers.
|
36
36
|
#
|
37
|
-
# class Book < AWS::Record::
|
37
|
+
# class Book < AWS::Record::Model
|
38
38
|
#
|
39
39
|
# # ...
|
40
40
|
#
|
@@ -89,7 +89,7 @@ module AWS
|
|
89
89
|
# All of the validators can be used with configured attributes, but they
|
90
90
|
# can also be used with any attribute that has a setter and a getter.
|
91
91
|
#
|
92
|
-
# Class Book < AWS::Record::
|
92
|
+
# Class Book < AWS::Record::Model
|
93
93
|
#
|
94
94
|
# attr_accessor :title
|
95
95
|
#
|
@@ -156,7 +156,7 @@ module AWS
|
|
156
156
|
# checkbox (like an EULA agreement or terms of service acknowledgement)
|
157
157
|
# is checked.
|
158
158
|
#
|
159
|
-
# class User < AWS::Record::
|
159
|
+
# class User < AWS::Record::Model
|
160
160
|
# boolean_attr :terms_of_service
|
161
161
|
# validates_acceptance_of :terms_of_service
|
162
162
|
# end
|
@@ -166,7 +166,7 @@ module AWS
|
|
166
166
|
# If you choose to validate the acceptance of a non-existant attribute
|
167
167
|
# then a setter and a getter will be added automtically for you.
|
168
168
|
#
|
169
|
-
# class User < AWS::Record::
|
169
|
+
# class User < AWS::Record::Model
|
170
170
|
# validates_acceptance_of :terms_of_service
|
171
171
|
# end
|
172
172
|
#
|
@@ -183,7 +183,7 @@ module AWS
|
|
183
183
|
# * +nil+ implies the field was omitted from the form and therefore
|
184
184
|
# should not be validated
|
185
185
|
#
|
186
|
-
# class User < AWS::Record::
|
186
|
+
# class User < AWS::Record::Model
|
187
187
|
# validates_acceptance_of :terms_of_service
|
188
188
|
# end
|
189
189
|
#
|
@@ -237,7 +237,7 @@ module AWS
|
|
237
237
|
# by requiring it twice:
|
238
238
|
#
|
239
239
|
# Model:
|
240
|
-
# class User < AWS::Record::
|
240
|
+
# class User < AWS::Record::Model
|
241
241
|
# validates_confirmation_of :password, :if => :password_changed?
|
242
242
|
# end
|
243
243
|
#
|
@@ -376,7 +376,7 @@ module AWS
|
|
376
376
|
|
377
377
|
# Adds a block validator that is called during record validation.
|
378
378
|
#
|
379
|
-
# class ExampleClass < AWS::Record::
|
379
|
+
# class ExampleClass < AWS::Record::Model
|
380
380
|
#
|
381
381
|
# string_attr :name
|
382
382
|
#
|
@@ -422,7 +422,7 @@ module AWS
|
|
422
422
|
# You may use this with multi-valued attributes the same way you use it
|
423
423
|
# with single-valued attributes:
|
424
424
|
#
|
425
|
-
# class Product < AWS::Record::
|
425
|
+
# class Product < AWS::Record::Model
|
426
426
|
#
|
427
427
|
# string_attr :tags, :set => true
|
428
428
|
#
|
@@ -468,7 +468,7 @@ module AWS
|
|
468
468
|
# You may use this with multi-valued attributes the same way you use it
|
469
469
|
# with single-valued attributes:
|
470
470
|
#
|
471
|
-
# class Product < AWS::Record::
|
471
|
+
# class Product < AWS::Record::Model
|
472
472
|
#
|
473
473
|
# string_attr :tags, :set => true
|
474
474
|
#
|
@@ -507,7 +507,7 @@ module AWS
|
|
507
507
|
# Validates that the attribute value is included in the given enumerable
|
508
508
|
# object.
|
509
509
|
#
|
510
|
-
# class MultipleChoiceAnswer < AWS::Record::
|
510
|
+
# class MultipleChoiceAnswer < AWS::Record::Model
|
511
511
|
# validates_inclusion_of :letter, :in => %w(a b c d e)
|
512
512
|
# end
|
513
513
|
#
|
data/lib/aws/s3/client.rb
CHANGED
@@ -877,11 +877,14 @@ module AWS
|
|
877
877
|
end
|
878
878
|
|
879
879
|
protected
|
880
|
-
def
|
881
|
-
(response.http_response.status >= 300 ||
|
882
|
-
|
883
|
-
|
884
|
-
|
880
|
+
def extract_error_code response
|
881
|
+
if (response.http_response.status >= 300 ||
|
882
|
+
response.request_type == :complete_multipart_upload) and
|
883
|
+
body = response.http_response.body and
|
884
|
+
parse = Core::XmlGrammar.parse(body) and
|
885
|
+
parse.respond_to?(:code)
|
886
|
+
parse.code
|
887
|
+
end
|
885
888
|
end
|
886
889
|
|
887
890
|
protected
|
@@ -901,7 +904,7 @@ module AWS
|
|
901
904
|
def should_retry? response
|
902
905
|
super or
|
903
906
|
response.request_type == :complete_multipart_upload &&
|
904
|
-
|
907
|
+
extract_error_code(response)
|
905
908
|
end
|
906
909
|
|
907
910
|
protected
|
@@ -51,7 +51,7 @@ module AWS
|
|
51
51
|
# photos/2011/summer/vacation.jpg
|
52
52
|
# photos/2011/summer/family.jpg
|
53
53
|
#
|
54
|
-
# tree = bucket.objects.with_prefix
|
54
|
+
# tree = bucket.objects.with_prefix('photos').as_tree
|
55
55
|
#
|
56
56
|
# directories = tree.children.select(&:branch?).collect(&:prefix)
|
57
57
|
# #=> ['photos/2010', 'photos/2011']
|
@@ -165,13 +165,15 @@ module AWS
|
|
165
165
|
# nil is returned.
|
166
166
|
#
|
167
167
|
def each options = {}, &block
|
168
|
+
super
|
169
|
+
end
|
168
170
|
|
171
|
+
# @private
|
172
|
+
def each_batch options = {}, &block
|
169
173
|
handle_query_options(options) do |collection, opts|
|
170
|
-
return collection.
|
174
|
+
return collection.each_batch(opts, &block)
|
171
175
|
end
|
172
|
-
|
173
176
|
super
|
174
|
-
|
175
177
|
end
|
176
178
|
|
177
179
|
# Counts the items in the collection.
|
data/lib/aws/sts/client.rb
CHANGED
@@ -31,6 +31,15 @@ module AWS
|
|
31
31
|
|
32
32
|
configure_client
|
33
33
|
|
34
|
+
def initialize *args
|
35
|
+
super
|
36
|
+
unless config.use_ssl?
|
37
|
+
msg = 'AWS Security Token Service (STS) requires ssl but the ' +
|
38
|
+
':use_ssl option is set to false. Try passing :use_ssl => true'
|
39
|
+
raise ArgumentError, msg
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
end
|
35
44
|
end
|
36
45
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Amazon Web Services
|
@@ -10,52 +15,70 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-17 00:00:00 -08:00
|
19
|
+
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: uuidtools
|
17
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
25
|
none: false
|
19
26
|
requirements:
|
20
27
|
- - ~>
|
21
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 1
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 1
|
22
33
|
version: "2.1"
|
23
34
|
type: :runtime
|
24
|
-
|
25
|
-
version_requirements: *id001
|
35
|
+
requirement: *id001
|
26
36
|
- !ruby/object:Gem::Dependency
|
27
37
|
name: httparty
|
28
|
-
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
40
|
none: false
|
30
41
|
requirements:
|
31
42
|
- - ~>
|
32
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 5
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 7
|
33
48
|
version: "0.7"
|
34
49
|
type: :runtime
|
35
|
-
|
36
|
-
version_requirements: *id002
|
50
|
+
requirement: *id002
|
37
51
|
- !ruby/object:Gem::Dependency
|
38
52
|
name: nokogiri
|
39
|
-
|
53
|
+
prerelease: false
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
56
|
requirements:
|
42
57
|
- - ">="
|
43
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 15
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 4
|
63
|
+
- 4
|
44
64
|
version: 1.4.4
|
45
65
|
type: :runtime
|
46
|
-
|
47
|
-
version_requirements: *id003
|
66
|
+
requirement: *id003
|
48
67
|
- !ruby/object:Gem::Dependency
|
49
68
|
name: json
|
50
|
-
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
51
71
|
none: false
|
52
72
|
requirements:
|
53
73
|
- - ~>
|
54
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 7
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 4
|
55
79
|
version: "1.4"
|
56
80
|
type: :runtime
|
57
|
-
|
58
|
-
version_requirements: *id004
|
81
|
+
requirement: *id004
|
59
82
|
description: AWS SDK for Ruby
|
60
83
|
email:
|
61
84
|
executables: []
|
@@ -83,6 +106,7 @@ files:
|
|
83
106
|
- lib/aws/core/configuration.rb
|
84
107
|
- lib/aws/core/configured_client_methods.rb
|
85
108
|
- lib/aws/core/configured_grammars.rb
|
109
|
+
- lib/aws/core/configured_json_client_methods.rb
|
86
110
|
- lib/aws/core/configured_option_grammars.rb
|
87
111
|
- lib/aws/core/configured_xml_grammars.rb
|
88
112
|
- lib/aws/core/default_signer.rb
|
@@ -107,9 +131,27 @@ files:
|
|
107
131
|
- lib/aws/core/response.rb
|
108
132
|
- lib/aws/core/response_cache.rb
|
109
133
|
- lib/aws/core/service_interface.rb
|
134
|
+
- lib/aws/core/session_signer.rb
|
110
135
|
- lib/aws/core/uri_escape.rb
|
111
136
|
- lib/aws/core/xml_grammar.rb
|
112
137
|
- lib/aws/core.rb
|
138
|
+
- lib/aws/dynamo_db/attribute_collection.rb
|
139
|
+
- lib/aws/dynamo_db/batch_get.rb
|
140
|
+
- lib/aws/dynamo_db/client.rb
|
141
|
+
- lib/aws/dynamo_db/config.rb
|
142
|
+
- lib/aws/dynamo_db/errors.rb
|
143
|
+
- lib/aws/dynamo_db/expectations.rb
|
144
|
+
- lib/aws/dynamo_db/item.rb
|
145
|
+
- lib/aws/dynamo_db/item_collection.rb
|
146
|
+
- lib/aws/dynamo_db/item_data.rb
|
147
|
+
- lib/aws/dynamo_db/keys.rb
|
148
|
+
- lib/aws/dynamo_db/primary_key_element.rb
|
149
|
+
- lib/aws/dynamo_db/request.rb
|
150
|
+
- lib/aws/dynamo_db/resource.rb
|
151
|
+
- lib/aws/dynamo_db/table.rb
|
152
|
+
- lib/aws/dynamo_db/table_collection.rb
|
153
|
+
- lib/aws/dynamo_db/types.rb
|
154
|
+
- lib/aws/dynamo_db.rb
|
113
155
|
- lib/aws/ec2/attachment.rb
|
114
156
|
- lib/aws/ec2/attachment_collection.rb
|
115
157
|
- lib/aws/ec2/availability_zone.rb
|
@@ -203,26 +245,22 @@ files:
|
|
203
245
|
- lib/aws/iam/user_policy_collection.rb
|
204
246
|
- lib/aws/iam.rb
|
205
247
|
- lib/aws/rails.rb
|
206
|
-
- lib/aws/record/
|
207
|
-
- lib/aws/record/
|
208
|
-
- lib/aws/record/attributes/boolean.rb
|
209
|
-
- lib/aws/record/attributes/date.rb
|
210
|
-
- lib/aws/record/attributes/datetime.rb
|
211
|
-
- lib/aws/record/attributes/float.rb
|
212
|
-
- lib/aws/record/attributes/integer.rb
|
213
|
-
- lib/aws/record/attributes/sortable_float.rb
|
214
|
-
- lib/aws/record/attributes/sortable_integer.rb
|
215
|
-
- lib/aws/record/attributes/string.rb
|
216
|
-
- lib/aws/record/base.rb
|
248
|
+
- lib/aws/record/abstract_base.rb
|
249
|
+
- lib/aws/record/attributes.rb
|
217
250
|
- lib/aws/record/conversion.rb
|
218
251
|
- lib/aws/record/dirty_tracking.rb
|
219
252
|
- lib/aws/record/errors.rb
|
220
253
|
- lib/aws/record/exceptions.rb
|
221
|
-
- lib/aws/record/
|
254
|
+
- lib/aws/record/hash_model/attributes.rb
|
255
|
+
- lib/aws/record/hash_model/finder_methods.rb
|
256
|
+
- lib/aws/record/hash_model/scope.rb
|
257
|
+
- lib/aws/record/hash_model.rb
|
258
|
+
- lib/aws/record/model/attributes.rb
|
259
|
+
- lib/aws/record/model/finder_methods.rb
|
260
|
+
- lib/aws/record/model/scope.rb
|
261
|
+
- lib/aws/record/model.rb
|
222
262
|
- lib/aws/record/naming.rb
|
223
|
-
- lib/aws/record/optimistic_locking.rb
|
224
263
|
- lib/aws/record/scope.rb
|
225
|
-
- lib/aws/record/scopes.rb
|
226
264
|
- lib/aws/record/validations.rb
|
227
265
|
- lib/aws/record/validator.rb
|
228
266
|
- lib/aws/record/validators/acceptance.rb
|
@@ -334,6 +372,7 @@ files:
|
|
334
372
|
- lib/net/http/connection_pool/connection.rb
|
335
373
|
- lib/net/http/connection_pool/session.rb
|
336
374
|
- lib/net/http/connection_pool.rb
|
375
|
+
- lib/aws/api_config/DynamoDB-2011-12-05.yml
|
337
376
|
- lib/aws/api_config/EC2-2011-02-28.yml
|
338
377
|
- lib/aws/api_config/ELB-2011-08-15.yml
|
339
378
|
- lib/aws/api_config/IAM-2010-07-15.yml
|
@@ -347,6 +386,7 @@ files:
|
|
347
386
|
- README.rdoc
|
348
387
|
- NOTICE.txt
|
349
388
|
- LICENSE.txt
|
389
|
+
has_rdoc: true
|
350
390
|
homepage: http://aws.amazon.com/sdkforruby
|
351
391
|
licenses:
|
352
392
|
- Apache 2.0
|
@@ -360,7 +400,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
360
400
|
requirements:
|
361
401
|
- - ">="
|
362
402
|
- !ruby/object:Gem::Version
|
363
|
-
hash:
|
403
|
+
hash: 3
|
364
404
|
segments:
|
365
405
|
- 0
|
366
406
|
version: "0"
|
@@ -369,11 +409,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
409
|
requirements:
|
370
410
|
- - ">="
|
371
411
|
- !ruby/object:Gem::Version
|
412
|
+
hash: 3
|
413
|
+
segments:
|
414
|
+
- 0
|
372
415
|
version: "0"
|
373
416
|
requirements: []
|
374
417
|
|
375
418
|
rubyforge_project:
|
376
|
-
rubygems_version: 1.
|
419
|
+
rubygems_version: 1.4.1
|
377
420
|
signing_key:
|
378
421
|
specification_version: 3
|
379
422
|
summary: AWS SDK for Ruby
|
data/lib/aws/record/attribute.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
-
# may not use this file except in compliance with the License. A copy of
|
5
|
-
# the License is located at
|
6
|
-
#
|
7
|
-
# http://aws.amazon.com/apache2.0/
|
8
|
-
#
|
9
|
-
# or in the "license" file accompanying this file. This file is
|
10
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
-
# ANY KIND, either express or implied. See the License for the specific
|
12
|
-
# language governing permissions and limitations under the License.
|
13
|
-
|
14
|
-
module AWS
|
15
|
-
module Record
|
16
|
-
|
17
|
-
# Base class for all of the AWS::Record attributes.
|
18
|
-
# @private
|
19
|
-
class Attribute
|
20
|
-
|
21
|
-
# @param [Symbol] Name of this attribute. It should be a name that
|
22
|
-
# is safe to use as a method.
|
23
|
-
# @param [Hash] options
|
24
|
-
# @option options [Boolean] :set (false) When true this attribute can
|
25
|
-
# accept multiple unique values.
|
26
|
-
def initialize name, options = {}
|
27
|
-
@name = name.to_s
|
28
|
-
@options = options.dup
|
29
|
-
if options[:set] and !self.class.allow_set?
|
30
|
-
raise ArgumentError, "invalid option :set for #{self.class}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [String] The name of this attribute
|
35
|
-
attr_reader :name
|
36
|
-
|
37
|
-
# @return [Hash] The hash of options this attribute was constructed with
|
38
|
-
attr_reader :options
|
39
|
-
|
40
|
-
# @return [Boolean] Returns true if this attribute can have
|
41
|
-
# multiple values.
|
42
|
-
def set?
|
43
|
-
options[:set] ? true : false
|
44
|
-
end
|
45
|
-
|
46
|
-
# @return Returns the default value for this attribute. Defaults to nil.
|
47
|
-
def default_value
|
48
|
-
options[:default_value]
|
49
|
-
end
|
50
|
-
|
51
|
-
# @param [Mixed] A single value to type cast.
|
52
|
-
# @return [Mixed] Returns the type casted value.
|
53
|
-
def type_cast raw_value
|
54
|
-
self.class.type_cast(raw_value, options)
|
55
|
-
end
|
56
|
-
|
57
|
-
# @param [String] The serialized string value.
|
58
|
-
# @return [Mixed] Returns a deserialized type-casted value.
|
59
|
-
def deserialize serialized_value
|
60
|
-
self.class.deserialize(serialized_value, options)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Takes the type casted value and serializes it
|
64
|
-
# @param [Mixed] A single value to serialize.
|
65
|
-
# @return [Mixed] Returns the serialized value.
|
66
|
-
def serialize type_casted_value
|
67
|
-
self.class.serialize(type_casted_value, options)
|
68
|
-
end
|
69
|
-
|
70
|
-
# @param [String] serialized_value The string value as returned from AWS.
|
71
|
-
# @return [Mixed] Returns the type-casted deserialized value.
|
72
|
-
def self.deserialize serialized_value, options = {}
|
73
|
-
self.type_cast(serialized_value, options)
|
74
|
-
end
|
75
|
-
|
76
|
-
# @return [Boolean] Returns true if this attribute type can be used
|
77
|
-
# with the +:set => true+ option. Certain attirbutes can not
|
78
|
-
# be represented with multiple values (like BooleanAttribute).
|
79
|
-
def self.allow_set?
|
80
|
-
raise 'allow_set? must be defined in subclasses'
|
81
|
-
end
|
82
|
-
|
83
|
-
# @private
|
84
|
-
protected
|
85
|
-
def self.expect klass, value, &block
|
86
|
-
unless value.is_a?(klass)
|
87
|
-
raise ArgumentError, "expected a #{klass} value, got #{value.class}"
|
88
|
-
end
|
89
|
-
yield
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|