aws-sdk 1.8.5 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (386) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -0
  3. data/README.rdoc +8 -0
  4. data/lib/aws-sdk.rb +39 -35
  5. data/lib/aws/api_config/CloudFront-2012-07-01.yml +2398 -0
  6. data/lib/aws/api_config/DirectConnect-2012-10-25.yml +475 -0
  7. data/lib/aws/api_config/DynamoDB-2011-12-05.yml +8 -0
  8. data/lib/aws/api_config/DynamoDB-2012-08-10.yml +1516 -0
  9. data/lib/aws/api_config/OpsWorks-2013-02-18.yml +2 -2
  10. data/lib/aws/auto_scaling.rb +44 -44
  11. data/lib/aws/auto_scaling/activity.rb +1 -1
  12. data/lib/aws/auto_scaling/activity_collection.rb +14 -15
  13. data/lib/aws/auto_scaling/client.rb +277 -277
  14. data/lib/aws/auto_scaling/config.rb +1 -1
  15. data/lib/aws/auto_scaling/group.rb +35 -36
  16. data/lib/aws/auto_scaling/group_collection.rb +10 -10
  17. data/lib/aws/auto_scaling/group_options.rb +19 -19
  18. data/lib/aws/auto_scaling/instance.rb +27 -27
  19. data/lib/aws/auto_scaling/instance_collection.rb +10 -10
  20. data/lib/aws/auto_scaling/launch_configuration.rb +3 -3
  21. data/lib/aws/auto_scaling/launch_configuration_collection.rb +1 -1
  22. data/lib/aws/auto_scaling/notification_configuration.rb +2 -2
  23. data/lib/aws/auto_scaling/notification_configuration_collection.rb +37 -38
  24. data/lib/aws/auto_scaling/scaling_policy.rb +3 -3
  25. data/lib/aws/auto_scaling/scaling_policy_collection.rb +6 -6
  26. data/lib/aws/auto_scaling/scaling_policy_options.rb +8 -7
  27. data/lib/aws/auto_scaling/scheduled_action.rb +3 -3
  28. data/lib/aws/auto_scaling/scheduled_action_collection.rb +28 -28
  29. data/lib/aws/auto_scaling/tag_collection.rb +30 -28
  30. data/lib/aws/cloud_formation.rb +95 -94
  31. data/lib/aws/cloud_formation/client.rb +136 -133
  32. data/lib/aws/cloud_formation/config.rb +1 -1
  33. data/lib/aws/cloud_formation/stack.rb +37 -37
  34. data/lib/aws/cloud_formation/stack_collection.rb +28 -27
  35. data/lib/aws/cloud_formation/stack_event.rb +9 -11
  36. data/lib/aws/cloud_formation/stack_output.rb +1 -1
  37. data/lib/aws/cloud_formation/stack_resource.rb +6 -6
  38. data/lib/aws/cloud_formation/stack_resource_collection.rb +11 -12
  39. data/lib/aws/cloud_formation/stack_resource_summary_collection.rb +11 -11
  40. data/lib/aws/cloud_formation/stack_summary_collection.rb +39 -39
  41. data/lib/aws/cloud_front.rb +21 -21
  42. data/lib/aws/cloud_front/client.rb +853 -652
  43. data/lib/aws/cloud_front/request.rb +3 -0
  44. data/lib/aws/cloud_search.rb +22 -22
  45. data/lib/aws/cloud_search/client.rb +322 -315
  46. data/lib/aws/cloud_search/config.rb +1 -1
  47. data/lib/aws/cloud_watch.rb +39 -39
  48. data/lib/aws/cloud_watch/alarm.rb +55 -37
  49. data/lib/aws/cloud_watch/alarm_collection.rb +18 -18
  50. data/lib/aws/cloud_watch/alarm_history_item_collection.rb +2 -2
  51. data/lib/aws/cloud_watch/client.rb +360 -146
  52. data/lib/aws/cloud_watch/config.rb +1 -1
  53. data/lib/aws/cloud_watch/metric.rb +15 -15
  54. data/lib/aws/cloud_watch/metric_alarm_collection.rb +17 -17
  55. data/lib/aws/cloud_watch/metric_collection.rb +16 -16
  56. data/lib/aws/cloud_watch/metric_statistics.rb +11 -11
  57. data/lib/aws/core.rb +243 -225
  58. data/lib/aws/core/async_handle.rb +13 -13
  59. data/lib/aws/core/cacheable.rb +14 -15
  60. data/lib/aws/core/client.rb +40 -15
  61. data/lib/aws/core/collection.rb +42 -46
  62. data/lib/aws/core/collection/with_limit_and_next_token.rb +1 -1
  63. data/lib/aws/core/collection/with_next_token.rb +1 -1
  64. data/lib/aws/core/configuration.rb +97 -133
  65. data/lib/aws/core/credential_providers.rb +16 -16
  66. data/lib/aws/core/data.rb +23 -23
  67. data/lib/aws/core/http/connection_pool.rb +348 -0
  68. data/lib/aws/core/http/net_http_handler.rb +17 -26
  69. data/lib/aws/core/http/patch.rb +102 -0
  70. data/lib/aws/core/http/request.rb +13 -19
  71. data/lib/aws/core/http/response.rb +2 -2
  72. data/lib/aws/core/lazy_error_classes.rb +17 -17
  73. data/lib/aws/core/log_formatter.rb +70 -104
  74. data/lib/aws/core/options/json_serializer.rb +1 -1
  75. data/lib/aws/core/options/validator.rb +4 -4
  76. data/lib/aws/core/page_result.rb +8 -8
  77. data/lib/aws/core/policy.rb +49 -49
  78. data/lib/aws/core/region.rb +72 -0
  79. data/lib/aws/core/region_collection.rb +106 -0
  80. data/lib/aws/core/resource.rb +5 -5
  81. data/lib/aws/core/response.rb +20 -17
  82. data/lib/aws/core/rest_request_builder.rb +4 -4
  83. data/lib/aws/core/service_interface.rb +24 -2
  84. data/lib/aws/core/signature/version_3.rb +2 -2
  85. data/lib/aws/core/uri_escape.rb +1 -1
  86. data/lib/aws/core/xml/frame_stack.rb +1 -1
  87. data/lib/aws/core/xml/grammar.rb +3 -4
  88. data/lib/aws/core/xml/sax_handlers/libxml.rb +2 -2
  89. data/lib/aws/core/xml/sax_handlers/nokogiri.rb +3 -3
  90. data/lib/aws/core/xml/sax_handlers/rexml.rb +5 -5
  91. data/lib/aws/core/xml/stub.rb +9 -9
  92. data/lib/aws/data_pipeline.rb +21 -21
  93. data/lib/aws/data_pipeline/client.rb +189 -133
  94. data/lib/aws/data_pipeline/config.rb +1 -1
  95. data/lib/aws/direct_connect.rb +74 -0
  96. data/lib/aws/direct_connect/client.rb +253 -0
  97. data/lib/aws/direct_connect/config.rb +18 -0
  98. data/lib/aws/direct_connect/errors.rb +22 -0
  99. data/lib/aws/direct_connect/request.rb +27 -0
  100. data/lib/aws/dynamo_db.rb +71 -69
  101. data/lib/aws/dynamo_db/attribute_collection.rb +53 -58
  102. data/lib/aws/dynamo_db/batch_get.rb +23 -23
  103. data/lib/aws/dynamo_db/batch_write.rb +43 -43
  104. data/lib/aws/dynamo_db/binary.rb +9 -9
  105. data/lib/aws/dynamo_db/client.rb +494 -509
  106. data/lib/aws/dynamo_db/client_base.rb +91 -0
  107. data/lib/aws/dynamo_db/client_v2.rb +825 -0
  108. data/lib/aws/dynamo_db/config.rb +1 -1
  109. data/lib/aws/dynamo_db/item.rb +10 -10
  110. data/lib/aws/dynamo_db/item_collection.rb +75 -75
  111. data/lib/aws/dynamo_db/table.rb +85 -85
  112. data/lib/aws/dynamo_db/table_collection.rb +13 -13
  113. data/lib/aws/ec2.rb +132 -142
  114. data/lib/aws/ec2/attachment.rb +31 -36
  115. data/lib/aws/ec2/attachment_collection.rb +1 -1
  116. data/lib/aws/ec2/availability_zone.rb +4 -4
  117. data/lib/aws/ec2/client.rb +2272 -2125
  118. data/lib/aws/ec2/config.rb +1 -1
  119. data/lib/aws/ec2/customer_gateway.rb +6 -6
  120. data/lib/aws/ec2/customer_gateway_collection.rb +6 -6
  121. data/lib/aws/ec2/dhcp_options.rb +3 -3
  122. data/lib/aws/ec2/dhcp_options_collection.rb +10 -10
  123. data/lib/aws/ec2/elastic_ip.rb +15 -15
  124. data/lib/aws/ec2/elastic_ip_collection.rb +11 -15
  125. data/lib/aws/ec2/export_task.rb +4 -4
  126. data/lib/aws/ec2/export_task_collection.rb +11 -11
  127. data/lib/aws/ec2/filtered_collection.rb +6 -8
  128. data/lib/aws/ec2/image.rb +46 -40
  129. data/lib/aws/ec2/image_collection.rb +44 -52
  130. data/lib/aws/ec2/instance.rb +64 -62
  131. data/lib/aws/ec2/instance_collection.rb +47 -50
  132. data/lib/aws/ec2/internet_gateway.rb +6 -6
  133. data/lib/aws/ec2/internet_gateway/attachment.rb +13 -13
  134. data/lib/aws/ec2/internet_gateway_collection.rb +3 -3
  135. data/lib/aws/ec2/key_pair.rb +3 -3
  136. data/lib/aws/ec2/key_pair_collection.rb +12 -12
  137. data/lib/aws/ec2/network_acl.rb +39 -39
  138. data/lib/aws/ec2/network_acl/association.rb +2 -2
  139. data/lib/aws/ec2/network_acl/entry.rb +22 -22
  140. data/lib/aws/ec2/network_acl_collection.rb +2 -2
  141. data/lib/aws/ec2/network_interface.rb +13 -4
  142. data/lib/aws/ec2/network_interface/attachment.rb +3 -3
  143. data/lib/aws/ec2/network_interface_collection.rb +5 -5
  144. data/lib/aws/ec2/permission_collection.rb +1 -1
  145. data/lib/aws/ec2/region.rb +6 -6
  146. data/lib/aws/ec2/region_collection.rb +1 -1
  147. data/lib/aws/ec2/reserved_instances_collection.rb +2 -2
  148. data/lib/aws/ec2/reserved_instances_offering_collection.rb +2 -2
  149. data/lib/aws/ec2/resource_tag_collection.rb +5 -5
  150. data/lib/aws/ec2/route_table.rb +14 -14
  151. data/lib/aws/ec2/route_table/association.rb +22 -22
  152. data/lib/aws/ec2/route_table/route.rb +8 -8
  153. data/lib/aws/ec2/route_table_collection.rb +3 -3
  154. data/lib/aws/ec2/security_group.rb +39 -41
  155. data/lib/aws/ec2/security_group_collection.rb +19 -21
  156. data/lib/aws/ec2/snapshot.rb +3 -3
  157. data/lib/aws/ec2/snapshot_collection.rb +11 -12
  158. data/lib/aws/ec2/subnet.rb +2 -2
  159. data/lib/aws/ec2/subnet_collection.rb +17 -17
  160. data/lib/aws/ec2/tag_collection.rb +1 -1
  161. data/lib/aws/ec2/tagged_collection.rb +7 -7
  162. data/lib/aws/ec2/tagged_item.rb +10 -10
  163. data/lib/aws/ec2/volume.rb +16 -16
  164. data/lib/aws/ec2/volume_collection.rb +9 -12
  165. data/lib/aws/ec2/vpc.rb +6 -6
  166. data/lib/aws/ec2/vpc_collection.rb +10 -10
  167. data/lib/aws/ec2/vpn_connection.rb +4 -4
  168. data/lib/aws/ec2/vpn_connection/telemetry.rb +1 -1
  169. data/lib/aws/ec2/vpn_connection_collection.rb +6 -6
  170. data/lib/aws/ec2/vpn_gateway.rb +2 -2
  171. data/lib/aws/ec2/vpn_gateway_collection.rb +5 -5
  172. data/lib/aws/elastic_beanstalk.rb +12 -12
  173. data/lib/aws/elastic_beanstalk/client.rb +376 -368
  174. data/lib/aws/elastic_beanstalk/config.rb +1 -1
  175. data/lib/aws/elastic_transcoder.rb +5 -5
  176. data/lib/aws/elastic_transcoder/client.rb +283 -283
  177. data/lib/aws/elastic_transcoder/config.rb +1 -1
  178. data/lib/aws/elasticache.rb +12 -12
  179. data/lib/aws/elasticache/client.rb +484 -479
  180. data/lib/aws/elasticache/config.rb +1 -1
  181. data/lib/aws/elb.rb +23 -23
  182. data/lib/aws/elb/availability_zone_collection.rb +34 -34
  183. data/lib/aws/elb/backend_server_policy_collection.rb +24 -24
  184. data/lib/aws/elb/client.rb +153 -153
  185. data/lib/aws/elb/config.rb +1 -1
  186. data/lib/aws/elb/errors.rb +1 -1
  187. data/lib/aws/elb/instance_collection.rb +20 -25
  188. data/lib/aws/elb/listener.rb +3 -3
  189. data/lib/aws/elb/listener_collection.rb +8 -8
  190. data/lib/aws/elb/load_balancer.rb +15 -16
  191. data/lib/aws/elb/load_balancer_collection.rb +36 -24
  192. data/lib/aws/elb/load_balancer_policy.rb +1 -1
  193. data/lib/aws/elb/load_balancer_policy_collection.rb +5 -5
  194. data/lib/aws/emr.rb +28 -26
  195. data/lib/aws/emr/client.rb +165 -149
  196. data/lib/aws/emr/config.rb +1 -1
  197. data/lib/aws/emr/instance_group.rb +1 -1
  198. data/lib/aws/emr/instance_group_collection.rb +1 -1
  199. data/lib/aws/emr/job_flow.rb +27 -26
  200. data/lib/aws/emr/job_flow_collection.rb +34 -34
  201. data/lib/aws/errors.rb +7 -7
  202. data/lib/aws/glacier.rb +21 -21
  203. data/lib/aws/glacier/archive_collection.rb +2 -2
  204. data/lib/aws/glacier/client.rb +139 -140
  205. data/lib/aws/glacier/config.rb +1 -1
  206. data/lib/aws/glacier/vault.rb +2 -2
  207. data/lib/aws/glacier/vault_collection.rb +1 -1
  208. data/lib/aws/iam.rb +133 -144
  209. data/lib/aws/iam/access_key.rb +17 -17
  210. data/lib/aws/iam/access_key_collection.rb +22 -22
  211. data/lib/aws/iam/account_alias_collection.rb +2 -2
  212. data/lib/aws/iam/client.rb +429 -420
  213. data/lib/aws/iam/collection.rb +1 -1
  214. data/lib/aws/iam/config.rb +2 -2
  215. data/lib/aws/iam/group.rb +8 -8
  216. data/lib/aws/iam/group_collection.rb +16 -16
  217. data/lib/aws/iam/group_policy_collection.rb +6 -6
  218. data/lib/aws/iam/group_user_collection.rb +3 -3
  219. data/lib/aws/iam/mfa_device.rb +1 -1
  220. data/lib/aws/iam/mfa_device_collection.rb +9 -9
  221. data/lib/aws/iam/policy_collection.rb +4 -4
  222. data/lib/aws/iam/resource.rb +2 -2
  223. data/lib/aws/iam/server_certificate.rb +1 -1
  224. data/lib/aws/iam/server_certificate_collection.rb +15 -15
  225. data/lib/aws/iam/signing_certificate.rb +29 -29
  226. data/lib/aws/iam/signing_certificate_collection.rb +23 -23
  227. data/lib/aws/iam/user.rb +33 -38
  228. data/lib/aws/iam/user_collection.rb +27 -27
  229. data/lib/aws/iam/user_group_collection.rb +3 -3
  230. data/lib/aws/iam/user_policy_collection.rb +6 -6
  231. data/lib/aws/iam/virtual_mfa_device.rb +12 -12
  232. data/lib/aws/iam/virtual_mfa_device_collection.rb +4 -4
  233. data/lib/aws/import_export.rb +22 -21
  234. data/lib/aws/import_export/client.rb +47 -43
  235. data/lib/aws/ops_works.rb +5 -5
  236. data/lib/aws/ops_works/client.rb +484 -438
  237. data/lib/aws/ops_works/config.rb +1 -1
  238. data/lib/aws/rails.rb +34 -34
  239. data/lib/aws/rds.rb +18 -18
  240. data/lib/aws/rds/client.rb +1286 -1277
  241. data/lib/aws/rds/config.rb +1 -1
  242. data/lib/aws/rds/db_instance.rb +15 -4
  243. data/lib/aws/rds/db_snapshot.rb +1 -1
  244. data/lib/aws/record.rb +50 -24
  245. data/lib/aws/record/abstract_base.rb +52 -60
  246. data/lib/aws/record/attributes.rb +79 -79
  247. data/lib/aws/record/conversion.rb +1 -1
  248. data/lib/aws/record/dirty_tracking.rb +69 -67
  249. data/lib/aws/record/errors.rb +21 -21
  250. data/lib/aws/record/exceptions.rb +2 -2
  251. data/lib/aws/record/hash_model.rb +20 -21
  252. data/lib/aws/record/hash_model/attributes.rb +13 -15
  253. data/lib/aws/record/hash_model/finder_methods.rb +46 -46
  254. data/lib/aws/record/hash_model/scope.rb +31 -31
  255. data/lib/aws/record/model.rb +136 -136
  256. data/lib/aws/record/model/attributes.rb +57 -59
  257. data/lib/aws/record/model/finder_methods.rb +67 -67
  258. data/lib/aws/record/model/scope.rb +48 -49
  259. data/lib/aws/record/naming.rb +1 -1
  260. data/lib/aws/record/scope.rb +23 -19
  261. data/lib/aws/record/validations.rb +253 -271
  262. data/lib/aws/record/validator.rb +3 -3
  263. data/lib/aws/record/validators/acceptance.rb +1 -3
  264. data/lib/aws/record/validators/block.rb +1 -3
  265. data/lib/aws/record/validators/confirmation.rb +1 -3
  266. data/lib/aws/record/validators/count.rb +2 -4
  267. data/lib/aws/record/validators/exclusion.rb +2 -4
  268. data/lib/aws/record/validators/format.rb +2 -4
  269. data/lib/aws/record/validators/inclusion.rb +1 -3
  270. data/lib/aws/record/validators/length.rb +5 -7
  271. data/lib/aws/record/validators/method.rb +1 -3
  272. data/lib/aws/record/validators/numericality.rb +6 -8
  273. data/lib/aws/record/validators/presence.rb +1 -3
  274. data/lib/aws/redshift.rb +14 -14
  275. data/lib/aws/redshift/client.rb +596 -592
  276. data/lib/aws/redshift/config.rb +1 -1
  277. data/lib/aws/route_53.rb +30 -30
  278. data/lib/aws/route_53/change_batch.rb +7 -7
  279. data/lib/aws/route_53/client.rb +188 -152
  280. data/lib/aws/route_53/hosted_zone.rb +4 -4
  281. data/lib/aws/route_53/hosted_zone_collection.rb +7 -7
  282. data/lib/aws/route_53/resource_record_set.rb +10 -10
  283. data/lib/aws/route_53/resource_record_set_collection.rb +6 -6
  284. data/lib/aws/s3.rb +79 -79
  285. data/lib/aws/s3/access_control_list.rb +44 -36
  286. data/lib/aws/s3/acl_options.rb +51 -51
  287. data/lib/aws/s3/bucket.rb +146 -146
  288. data/lib/aws/s3/bucket_collection.rb +21 -21
  289. data/lib/aws/s3/bucket_lifecycle_configuration.rb +81 -82
  290. data/lib/aws/s3/bucket_tag_collection.rb +4 -2
  291. data/lib/aws/s3/cipher_io.rb +5 -4
  292. data/lib/aws/s3/client.rb +89 -84
  293. data/lib/aws/s3/client/xml.rb +1 -1
  294. data/lib/aws/s3/config.rb +7 -1
  295. data/lib/aws/s3/cors_rule.rb +2 -0
  296. data/lib/aws/s3/cors_rule_collection.rb +42 -40
  297. data/lib/aws/s3/data_options.rb +16 -11
  298. data/lib/aws/s3/encryption_utils.rb +2 -2
  299. data/lib/aws/s3/errors.rb +7 -7
  300. data/lib/aws/s3/multipart_upload.rb +30 -33
  301. data/lib/aws/s3/multipart_upload_collection.rb +8 -6
  302. data/lib/aws/s3/object_collection.rb +35 -35
  303. data/lib/aws/s3/object_metadata.rb +6 -6
  304. data/lib/aws/s3/object_version.rb +4 -4
  305. data/lib/aws/s3/object_version_collection.rb +15 -15
  306. data/lib/aws/s3/policy.rb +2 -2
  307. data/lib/aws/s3/prefixed_collection.rb +9 -5
  308. data/lib/aws/s3/presigned_post.rb +39 -37
  309. data/lib/aws/s3/request.rb +11 -11
  310. data/lib/aws/s3/s3_object.rb +210 -200
  311. data/lib/aws/s3/tree.rb +25 -27
  312. data/lib/aws/s3/tree/child_collection.rb +3 -3
  313. data/lib/aws/s3/tree/leaf_node.rb +2 -2
  314. data/lib/aws/s3/tree/parent.rb +1 -1
  315. data/lib/aws/s3/website_configuration.rb +13 -13
  316. data/lib/aws/simple_db.rb +83 -83
  317. data/lib/aws/simple_db/attribute.rb +9 -7
  318. data/lib/aws/simple_db/attribute_collection.rb +22 -13
  319. data/lib/aws/simple_db/client.rb +107 -107
  320. data/lib/aws/simple_db/config.rb +7 -1
  321. data/lib/aws/simple_db/consistent_read_option.rb +5 -5
  322. data/lib/aws/simple_db/domain.rb +4 -2
  323. data/lib/aws/simple_db/domain_collection.rb +4 -4
  324. data/lib/aws/simple_db/domain_metadata.rb +5 -5
  325. data/lib/aws/simple_db/errors.rb +9 -9
  326. data/lib/aws/simple_db/item.rb +5 -5
  327. data/lib/aws/simple_db/item_collection.rb +83 -81
  328. data/lib/aws/simple_db/item_data.rb +4 -4
  329. data/lib/aws/simple_db/put_attributes.rb +3 -3
  330. data/lib/aws/simple_email_service.rb +140 -140
  331. data/lib/aws/simple_email_service/client.rb +82 -76
  332. data/lib/aws/simple_email_service/config.rb +1 -2
  333. data/lib/aws/simple_email_service/email_address_collection.rb +3 -3
  334. data/lib/aws/simple_email_service/identity.rb +8 -8
  335. data/lib/aws/simple_email_service/quotas.rb +8 -6
  336. data/lib/aws/simple_workflow.rb +106 -106
  337. data/lib/aws/simple_workflow/activity_task.rb +15 -22
  338. data/lib/aws/simple_workflow/activity_task_collection.rb +15 -15
  339. data/lib/aws/simple_workflow/activity_type.rb +23 -23
  340. data/lib/aws/simple_workflow/activity_type_collection.rb +23 -23
  341. data/lib/aws/simple_workflow/client.rb +1004 -956
  342. data/lib/aws/simple_workflow/config.rb +1 -1
  343. data/lib/aws/simple_workflow/count.rb +5 -5
  344. data/lib/aws/simple_workflow/decision_task.rb +129 -129
  345. data/lib/aws/simple_workflow/decision_task_collection.rb +59 -59
  346. data/lib/aws/simple_workflow/domain.rb +11 -11
  347. data/lib/aws/simple_workflow/domain_collection.rb +26 -26
  348. data/lib/aws/simple_workflow/history_event.rb +32 -32
  349. data/lib/aws/simple_workflow/history_event_collection.rb +3 -3
  350. data/lib/aws/simple_workflow/option_formatters.rb +5 -5
  351. data/lib/aws/simple_workflow/request.rb +1 -1
  352. data/lib/aws/simple_workflow/resource.rb +1 -1
  353. data/lib/aws/simple_workflow/type.rb +8 -8
  354. data/lib/aws/simple_workflow/type_collection.rb +15 -15
  355. data/lib/aws/simple_workflow/workflow_execution.rb +70 -72
  356. data/lib/aws/simple_workflow/workflow_execution_collection.rb +130 -130
  357. data/lib/aws/simple_workflow/workflow_type.rb +27 -25
  358. data/lib/aws/simple_workflow/workflow_type_collection.rb +20 -20
  359. data/lib/aws/sns.rb +25 -25
  360. data/lib/aws/sns/client.rb +55 -55
  361. data/lib/aws/sns/config.rb +1 -1
  362. data/lib/aws/sns/policy.rb +1 -1
  363. data/lib/aws/sns/subscription.rb +7 -7
  364. data/lib/aws/sns/subscription_collection.rb +5 -5
  365. data/lib/aws/sns/topic.rb +49 -49
  366. data/lib/aws/sns/topic_collection.rb +2 -2
  367. data/lib/aws/sns/topic_subscription_collection.rb +5 -5
  368. data/lib/aws/sqs.rb +20 -20
  369. data/lib/aws/sqs/client.rb +78 -78
  370. data/lib/aws/sqs/config.rb +1 -1
  371. data/lib/aws/sqs/errors.rb +12 -12
  372. data/lib/aws/sqs/queue.rb +66 -67
  373. data/lib/aws/sqs/queue_collection.rb +16 -8
  374. data/lib/aws/sqs/received_message.rb +7 -6
  375. data/lib/aws/storage_gateway.rb +21 -21
  376. data/lib/aws/storage_gateway/client.rb +269 -202
  377. data/lib/aws/storage_gateway/config.rb +1 -1
  378. data/lib/aws/sts.rb +10 -8
  379. data/lib/aws/sts/client.rb +35 -35
  380. data/lib/aws/sts/session.rb +3 -3
  381. data/lib/aws/version.rb +1 -2
  382. metadata +23 -21
  383. data/lib/aws/core/autoloader.rb +0 -64
  384. data/lib/net/http/connection_pool.rb +0 -226
  385. data/lib/net/http/connection_pool/connection.rb +0 -189
  386. data/lib/net/http/connection_pool/session.rb +0 -126
@@ -10,36 +10,36 @@
10
10
  # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
-
13
+
14
14
  module AWS
15
15
  module Record
16
16
  class Model
17
17
 
18
18
  # The primary interface for finding records with {AWS::Record::Model}.
19
19
  #
20
- # == Getting a Scope Object
20
+ # ## Getting a Scope Object
21
21
  #
22
22
  # You should normally never need to construct a Scope object directly.
23
23
  # Scope objects are returned from the AWS::Record::Model finder methods
24
- # (e.g. +shard+, +where+, +order+, +limit+, etc).
24
+ # (e.g. `shard`, `where`, `order`, `limit`, etc).
25
25
  #
26
- # books = Book.where(:author => 'John Doe')
27
- # books.class #=> AWS::Record::Scope, not Array
26
+ # books = Book.where(:author => 'John Doe')
27
+ # books.class #=> AWS::Record::Scope, not Array
28
28
  #
29
- # Scopes are also returned from methods defined with the +scope+ method.
29
+ # Scopes are also returned from methods defined with the `scope` method.
30
30
  #
31
- # == Chaining Scopes
31
+ # ## Chaining Scopes
32
32
  #
33
33
  # Scope objects represent a request, but do not actualy make a request
34
34
  # until required. This allows you to chain requests
35
35
  #
36
- # # no request made by the following 2 statements
37
- # books = Book.where(:author => 'John Doe')
38
- # books = books.limit(10)
36
+ # # no request made by the following 2 statements
37
+ # books = Book.where(:author => 'John Doe')
38
+ # books = books.limit(10)
39
39
  #
40
- # books.each do |book|
41
- # # yields up to 10 books
42
- # end
40
+ # books.each do |book|
41
+ # # yields up to 10 books
42
+ # end
43
43
  #
44
44
  # Each of the following methods returns a scope that can be chained.
45
45
  #
@@ -48,24 +48,24 @@ module AWS
48
48
  # * {#order}
49
49
  # * {#limit}
50
50
  #
51
- # == Terminating Scopes
51
+ # ## Terminating Scopes
52
52
  #
53
53
  # To terminate a scope you can enumerate it or call #first.
54
54
  #
55
- # # terminate a scope by enumerating
56
- # Book.limit(10).each {|book| ... }
55
+ # # terminate a scope by enumerating
56
+ # Book.limit(10).each {|book| ... }
57
57
  #
58
- # # terminate a scope by getting the first value
59
- # Book.where('author' => 'John Doe').first
58
+ # # terminate a scope by getting the first value
59
+ # Book.where('author' => 'John Doe').first
60
60
  #
61
61
  class Scope < Record::Scope
62
-
62
+
63
63
  # @private
64
64
  def initialize base_class, options = {}
65
65
  super
66
66
  @options[:where] ||= []
67
67
  end
68
-
68
+
69
69
  def new attributes = {}
70
70
 
71
71
  attributes = attributes.dup
@@ -75,11 +75,11 @@ module AWS
75
75
  attributes.merge!(conditions.first)
76
76
  end
77
77
  end
78
-
78
+
79
79
  super(attributes)
80
-
80
+
81
81
  end
82
-
82
+
83
83
  # Applies conditions to the scope that limit which records are returned.
84
84
  # Only those matching all given conditions will be returned.
85
85
  #
@@ -87,8 +87,8 @@ module AWS
87
87
  # Specify a hash of conditions to query with. Multiple conditions
88
88
  # are joined together with AND.
89
89
  #
90
- # Book.where(:author => 'John Doe', :softcover => true)
91
- # # where `author` = `John Doe` AND `softcover` = `1`
90
+ # Book.where(:author => 'John Doe', :softcover => true)
91
+ # # where `author` = `John Doe` AND `softcover` = `1`
92
92
  #
93
93
  # @param [Hash] conditions
94
94
  #
@@ -96,7 +96,7 @@ module AWS
96
96
  # A sql-like query fragment with optional placeholders and values.
97
97
  # Placeholders are replaced with properly quoted values.
98
98
  #
99
- # Book.where('author = ?', 'John Doe')
99
+ # Book.where('author = ?', 'John Doe')
100
100
  #
101
101
  # @param [String] conditions_string A sql-like where string with
102
102
  # question mark placeholders. For each placeholder there should
@@ -111,46 +111,45 @@ module AWS
111
111
  end
112
112
  _with(:where => @options[:where] + [conditions])
113
113
  end
114
-
115
- # Specifies how to sort records returned.
114
+
115
+ # Specifies how to sort records returned.
116
116
  #
117
- # # enumerate books, starting with the most recently published ones
118
- # Book.order(:published_at, :desc).each do |book|
119
- # # ...
120
- # end
117
+ # # enumerate books, starting with the most recently published ones
118
+ # Book.order(:published_at, :desc).each do |book|
119
+ # # ...
120
+ # end
121
121
  #
122
122
  # Only one order may be applied. If order is specified more than
123
123
  # once the last one in the chain takes precedence:
124
124
  #
125
- #
126
- # # books returned by this scope will be ordered by :published_at
127
- # # and not :author.
128
- # Book.where(:read => false).order(:author).order(:published_at)
125
+ # # books returned by this scope will be ordered by :published_at
126
+ # # and not :author.
127
+ # Book.where(:read => false).order(:author).order(:published_at)
129
128
  #
130
129
  # @param [String,Symbol] attribute_name The attribute to sort by.
131
130
  # @param [:asc, :desc] order (:asc) The direct to sort.
132
131
  def order attribute_name, order = :asc
133
132
  _with(:order => [attribute_name, order])
134
133
  end
135
-
134
+
136
135
  # @private
137
136
  private
138
137
  def _each_object &block
139
-
138
+
140
139
  items = _item_collection
141
-
140
+
142
141
  items.select.each do |item_data|
143
142
  obj = base_class.new(:shard => _shard)
144
143
  obj.send(:hydrate, item_data.name, item_data.attributes)
145
144
  yield(obj)
146
145
  end
147
-
146
+
148
147
  end
149
-
148
+
150
149
  # Merges another scope with this scope. Conditions are added together
151
150
  # and the limit and order parts replace those in this scope (if set).
152
151
  # @param [Scope] scope A scope to merge with this one.
153
- # @return [Scope] Returns a new scope with merged conditions and
152
+ # @return [Scope] Returns a new scope with merged conditions and
154
153
  # overriden order and limit.
155
154
  # @private
156
155
  private
@@ -159,8 +158,8 @@ module AWS
159
158
  scope.instance_variable_get('@options').each_pair do |opt_name,opt_value|
160
159
  unless [nil, []].include?(opt_value)
161
160
  if opt_name == :where
162
- opt_value.each do |condition|
163
- merged = merged.where(*condition)
161
+ opt_value.each do |condition|
162
+ merged = merged.where(*condition)
164
163
  end
165
164
  else
166
165
  merged = merged.send(opt_name, *opt_value)
@@ -169,14 +168,14 @@ module AWS
169
168
  end
170
169
  merged
171
170
  end
172
-
173
- # Consumes a hash of options (e.g. +:where+, +:order+ and +:limit+) and
171
+
172
+ # Consumes a hash of options (e.g. `:where`, `:order` and `:limit`) and
174
173
  # builds them onto the current scope, returning a new one.
175
174
  # @param [Hash] options
176
175
  # @option options :where
177
176
  # @option options :order
178
177
  # @option options [Integer] :limit
179
- # @return [Scope] Returns a new scope with the hash of scope
178
+ # @return [Scope] Returns a new scope with the hash of scope
180
179
  # options applied.
181
180
  # @private
182
181
  private
@@ -192,7 +191,7 @@ module AWS
192
191
  end
193
192
  scope
194
193
  end
195
-
194
+
196
195
  # Converts this scope object into an AWS::SimpleDB::ItemCollection
197
196
  # @return [SimpleDB::ItemCollection]
198
197
  # @private
@@ -206,7 +205,7 @@ module AWS
206
205
  end
207
206
  items
208
207
  end
209
-
208
+
210
209
  end
211
210
  end
212
211
  end
@@ -16,7 +16,7 @@ module AWS
16
16
 
17
17
  # @private
18
18
  module Naming
19
-
19
+
20
20
  # This method should only ever get called in a Rails 3+ context
21
21
  # where active model and active support have been loaded. Rails 2
22
22
  # does not call model name on object.
@@ -10,16 +10,16 @@
10
10
  # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
-
13
+
14
14
  module AWS
15
15
  module Record
16
16
 
17
17
  # Base class for {AWS::Record::Model::Scope} and
18
18
  # {AWS::Record::HashModel::Scope}.
19
19
  class Scope
20
-
20
+
21
21
  include Enumerable
22
-
22
+
23
23
  # @param base_class A class that extends {AWS::Record::AbstractBase}.
24
24
  # @param [Hash] options
25
25
  # @option options :
@@ -34,7 +34,7 @@ module AWS
34
34
  @options[:shard] = @options.delete(:domain) if @options[:domain]
35
35
 
36
36
  end
37
-
37
+
38
38
  # @return [Class] Returns the AWS::Record::Model extending class that
39
39
  # this scope will find records for.
40
40
  attr_reader :base_class
@@ -61,13 +61,13 @@ module AWS
61
61
  _with(:shard => shard_name)
62
62
  end
63
63
  alias_method :domain, :shard
64
-
64
+
65
65
  # @overload find(id)
66
66
  # Finds and returns a single record by id. If no record is found
67
- # with the given +id+, then a RecordNotFound error will be raised.
67
+ # with the given `id`, then a RecordNotFound error will be raised.
68
68
  # @param [String] id ID of the record to find.
69
69
  # @return Returns the record.
70
- #
70
+ #
71
71
  # @overload find(:first, options = {})
72
72
  # Returns the first record found. If no records were matched then
73
73
  # nil will be returned (raises no exceptions).
@@ -79,9 +79,9 @@ module AWS
79
79
  # Returns an enumerable Scope object that represents all matching
80
80
  # records. No request is made to AWS until the scope is enumerated.
81
81
  #
82
- # Book.find(:all, :limit => 100).each do |book|
83
- # # ...
84
- # end
82
+ # Book.find(:all, :limit => 100).each do |book|
83
+ # # ...
84
+ # end
85
85
  #
86
86
  # @param [Symbol] mode (:all)
87
87
  # @return [Scope] Returns an enumerable scope object.
@@ -96,7 +96,7 @@ module AWS
96
96
  else
97
97
  base_class.find_by_id(id_or_mode, :shard => scope._shard)
98
98
  end
99
-
99
+
100
100
  end
101
101
 
102
102
  # @return [Integer] Returns the number of records that match the
@@ -115,10 +115,12 @@ module AWS
115
115
  def first options = {}
116
116
  _handle_options(options).find(:first)
117
117
  end
118
-
118
+
119
119
  # Limits the maximum number of total records to return when finding
120
120
  # or counting. Returns a scope, does not make a request.
121
121
  #
122
+ # @example
123
+ #
122
124
  # books = Book.limit(100)
123
125
  #
124
126
  # @param [Integer] limit The maximum number of records to return.
@@ -126,16 +128,18 @@ module AWS
126
128
  def limit limit
127
129
  _with(:limit => limit)
128
130
  end
129
-
131
+
130
132
  # Yields once for each record matching the request made by this scope.
131
133
  #
134
+ # @example
135
+ #
132
136
  # books = Book.where(:author => 'me').order(:price, :asc).limit(10)
133
137
  #
134
138
  # books.each do |book|
135
139
  # puts book.attributes.to_yaml
136
140
  # end
137
141
  #
138
- # @yieldparam [Object] record
142
+ # @yieldparam [Object] record
139
143
  def each &block
140
144
  if block_given?
141
145
  _each_object(&block)
@@ -149,26 +153,26 @@ module AWS
149
153
  @options[:shard] || base_class.shard_name
150
154
  end
151
155
  alias_method :domain, :shard
152
-
156
+
153
157
  # @private
154
158
  private
155
159
  def _each_object &block
156
160
  raise NotImplementedError
157
161
  end
158
-
162
+
159
163
  # @private
160
164
  private
161
165
  def _with options
162
166
  self.class.new(base_class, @options.merge(options))
163
167
  end
164
-
168
+
165
169
  # @private
166
170
  private
167
171
  def method_missing scope_name, *args
168
172
  # @todo only proxy named scope methods
169
173
  _merge_scope(base_class.send(scope_name, *args))
170
174
  end
171
-
175
+
172
176
  # Merges the one scope with the current scope, returning a 3rd.
173
177
  # @param [Scope] scope
174
178
  # @return [Scope]
@@ -178,7 +182,7 @@ module AWS
178
182
  raise NotImplementedError
179
183
  end
180
184
 
181
- # Consumes a hash of options (e.g. +:shard+, +:limit) and returns
185
+ # Consumes a hash of options (e.g. `:shard`, +:limit) and returns
182
186
  # a new scope with those applied.
183
187
  # @return [Scope]
184
188
  # @private
@@ -11,93 +11,78 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/record/validators/acceptance'
15
- require 'aws/record/validators/block'
16
- require 'aws/record/validators/confirmation'
17
- require 'aws/record/validators/count'
18
- require 'aws/record/validators/exclusion'
19
- require 'aws/record/validators/format'
20
- require 'aws/record/validators/inclusion'
21
- require 'aws/record/validators/length'
22
- require 'aws/record/validators/numericality'
23
- require 'aws/record/validators/presence'
24
- require 'aws/record/validators/method'
25
-
26
14
  module AWS
27
15
  module Record
28
16
 
29
17
  # Validation methods to be used with subclasses of AWS::Record::Model.
30
18
  #
31
- # = General Usage
19
+ # # General Usage
32
20
  #
33
21
  # All standard validation methods follow the same basic usage.
34
22
  # Call the validation method followed by one more attribute names
35
23
  # and then an optional hash of modifiers.
36
24
  #
37
- # class Book < AWS::Record::Model
25
+ # class Book < AWS::Record::Model
38
26
  #
39
- # # ...
27
+ # # ...
40
28
  #
41
- # validates_presence_of :title, :author
29
+ # validates_presence_of :title, :author
42
30
  #
43
- # validates_length_of :summary,
44
- # :max => 500,
45
- # :allow_nil => true,
46
- # :allow_blank => true
31
+ # validates_length_of :summary,
32
+ # :max => 500,
33
+ # :allow_nil => true,
34
+ # :allow_blank => true
47
35
  #
48
- # end
36
+ # end
49
37
  #
50
- # = Conditional Validations
38
+ # # Conditional Validations
51
39
  #
52
- # Sometimes you only want to validate an attribute under certain
40
+ # Sometimes you only want to validate an attribute under certain
53
41
  # conditions. To make this simple, all validation methods accept the
54
42
  # following 3 options:
55
43
  #
56
- # * +:on+
57
- # * +:if+
58
- # * +:unless+
44
+ # * `:on`
45
+ # * `:if`
46
+ # * `:unless`
59
47
  #
60
48
  # You may mix and match all 3 of the above options.
61
49
  #
62
- # === Validate on :create or :update
50
+ # ### Validate on :create or :update
63
51
  #
64
52
  # By default validations are run on create and update, but you can
65
53
  # specify them to run for only create (initial save) or updates.
66
54
  #
67
- # validates_presence_of :created_at, :on => :create
55
+ # validates_presence_of :created_at, :on => :create
56
+ #
57
+ # validates_presence_of :updated_at, :on => :update
68
58
  #
69
- # validates_presence_of :updated_at, :on => :update
70
- #
71
- # === Validate :if or :unless
59
+ # ### Validate :if or :unless
72
60
  #
73
61
  # Sometimes you have more complex requirements to determine if/when a
74
- # validation should run. +:if+ and +:unless+: both accept either
62
+ # validation should run. `:if` and `:unless`: both accept either
75
63
  # a method name or proc.
76
64
  #
77
- # class Person
65
+ # class Person
78
66
  #
79
- # # ...
67
+ # # ...
80
68
  #
81
- # validates_presence_of :job_title, :if => :employee?
69
+ # validates_presence_of :job_title, :if => :employee?
82
70
  #
83
- # validates_presence_of :nickname, :if => lambda {|person|
84
- # person.is_family? or person.is_friend? }
71
+ # validates_presence_of :nickname, :if => lambda {|person|
72
+ # person.is_family? or person.is_friend? }
85
73
  #
86
- # end
74
+ # end
87
75
  #
88
- # = Validating Virtual (Non-persisted) Attributes
76
+ # # Validating Virtual (Non-persisted) Attributes
89
77
  #
90
78
  # All of the validators can be used with configured attributes, but they
91
79
  # can also be used with any attribute that has a setter and a getter.
92
80
  #
93
- # Class Book < AWS::Record::Model
94
- #
95
- # attr_accessor :title
81
+ # Class Book < AWS::Record::Model
82
+ # attr_accessor :title
83
+ # validates_presence_of :title
84
+ # end
96
85
  #
97
- # validates_presence_of :title
98
- #
99
- # end
100
- #
101
86
  module Validations
102
87
 
103
88
  def self.extended base
@@ -115,38 +100,39 @@ module AWS
115
100
 
116
101
  # Registers a validation method.
117
102
  #
118
- # validate :ensure_age_is_greater_than_shoe_size
103
+ # validate :ensure_age_is_greater_than_shoe_size
119
104
  #
120
- # def ensure_age_is_greater_than_shoe_size
121
- # unless age > shoe_size
122
- # errors.add(:age, 'should be greater than your shoe size')
105
+ # def ensure_age_is_greater_than_shoe_size
106
+ # unless age > shoe_size
107
+ # errors.add(:age, 'should be greater than your shoe size')
108
+ # end
123
109
  # end
124
- # end
125
110
  #
126
111
  # You can also pass a list of method names that should be called during
127
112
  # validation.
128
113
  #
129
- # validate :some_complex_validation, :some_other_validation
114
+ # validate :some_complex_validation, :some_other_validation
130
115
  #
131
116
  # As with most other validation methods you can also pass a hash of
132
117
  # options that affect when the named validation methods get called.
133
118
  #
134
- # validate :my_custom_validation, :unless => :new_record?
119
+ # validate :my_custom_validation, :unless => :new_record?
135
120
  #
136
121
  # @overload validate(*method_names, options = {})
137
122
  # @param [Array<Symbol>] method_names A list of methods to call
138
- # during validation.
123
+ # during validation.
139
124
  # @param [Hash] options
140
125
  # @option options [Symbol] :on (:save) When this validation is run.
141
126
  # Valid values include:
142
- # * +:save+
143
- # * +:create+
144
- # * +:update+
127
+ #
128
+ # * `:save`
129
+ # * `:create`
130
+ # * `:update`
145
131
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
146
132
  # to call. The validation will only be run if the return value is
147
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
148
- # +:if => lambda{|book| book.in_stock? }+).
149
- # @option options [Symbol,String,Proc] :unless Specifies a method or
133
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
134
+ # `:if => lambda{|book| book.in_stock? }`).
135
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
150
136
  # proc to call. The validation will *not* be run if the return value
151
137
  # is of the method/proc is false.
152
138
  def validate *args
@@ -157,48 +143,48 @@ module AWS
157
143
  # checkbox (like an EULA agreement or terms of service acknowledgement)
158
144
  # is checked.
159
145
  #
160
- # class User < AWS::Record::Model
161
- # boolean_attr :terms_of_service
162
- # validates_acceptance_of :terms_of_service
163
- # end
146
+ # class User < AWS::Record::Model
147
+ # boolean_attr :terms_of_service
148
+ # validates_acceptance_of :terms_of_service
149
+ # end
164
150
  #
165
- # === Virtual Attributes
151
+ # ### Virtual Attributes
166
152
  #
167
153
  # If you choose to validate the acceptance of a non-existant attribute
168
154
  # then a setter and a getter will be added automtically for you.
169
155
  #
170
- # class User < AWS::Record::Model
171
- # validates_acceptance_of :terms_of_service
172
- # end
156
+ # class User < AWS::Record::Model
157
+ # validates_acceptance_of :terms_of_service
158
+ # end
173
159
  #
174
- # user = User.new
175
- # user.respond_to?(:terms_of_service) #=> true
176
- # user.respond_to?(:terms_of_service=) #=> true
160
+ # user = User.new
161
+ # user.respond_to?(:terms_of_service) #=> true
162
+ # user.respond_to?(:terms_of_service=) #=> true
177
163
  #
178
- # === Accepted Values
164
+ # ### Accepted Values
179
165
  #
180
- # The default behavior for +validates_acceptance_of+ is to add
181
- # an error when the value is '1' or +true+. Also note, this validation
182
- # method defaults +:allow_nil+ to true.
166
+ # The default behavior for `validates_acceptance_of` is to add
167
+ # an error when the value is '1' or `true`. Also note, this validation
168
+ # method defaults `:allow_nil` to true.
183
169
  #
184
- # * +nil+ implies the field was omitted from the form and therefore
170
+ # * `nil` implies the field was omitted from the form and therefore
185
171
  # should not be validated
186
172
  #
187
- # class User < AWS::Record::Model
188
- # validates_acceptance_of :terms_of_service
189
- # end
173
+ # class User < AWS::Record::Model
174
+ # validates_acceptance_of :terms_of_service
175
+ # end
190
176
  #
191
- # u = User.new
192
- # u.terms_of_service #=> nil
193
- # u.valid? #=> true
177
+ # u = User.new
178
+ # u.terms_of_service #=> nil
179
+ # u.valid? #=> true
194
180
  #
195
181
  # * '1' is the default value for most checkbox form helpers, and #
196
182
  # therefore indicates an accepted value.
197
183
  #
198
- # * +true+ is how boolean attributes typecast '1'. This is helpful
199
- # when you have your checkbox post its value to a +:boolean_attr+.
184
+ # * `true` is how boolean attributes typecast '1'. This is helpful
185
+ # when you have your checkbox post its value to a `:boolean_attr`.
200
186
  #
201
- # === Multi-Valued Attributes
187
+ # ### Multi-Valued Attributes
202
188
  #
203
189
  # This validator works only with single-valued attributes. If you need
204
190
  # to validate that all of the values in a set are true, then use
@@ -212,24 +198,25 @@ module AWS
212
198
  # @param [Hash] options
213
199
  # @option options [mixed] :accpet Specify an additional accepted value.
214
200
  #
215
- # validates_acceptance_of :agree, :accept => 'yes'
201
+ # validates_acceptance_of :agree, :accept => 'yes'
216
202
  #
217
203
  # @option options [String] :message A custom error message. The default
218
- # +:message+ is "must be accepted".
204
+ # `:message` is "must be accepted".
219
205
  # @option options [Boolean] :allow_nil (true) Skip validation if the
220
- # attribute value is +nil+.
206
+ # attribute value is `nil`.
221
207
  # @option options [Boolean] :allow_blank (true) Skip validation if the
222
- # attribute value is +blank+.
208
+ # attribute value is `blank`.
223
209
  # @option options [Symbol] :on (:save) When this validation is run.
224
210
  # Valid values include:
225
- # * +:save+
226
- # * +:create+
227
- # * +:update+
211
+ #
212
+ # * `:save`
213
+ # * `:create`
214
+ # * `:update`
228
215
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
229
216
  # to call. The validation will only be run if the return value is
230
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
231
- # +:if => lambda{|book| book.in_stock? }+).
232
- # @option options [Symbol,String,Proc] :unless Specifies a method or
217
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
218
+ # `:if => lambda{|book| book.in_stock? }`).
219
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
233
220
  # proc to call. The validation will *not* be run if the return value
234
221
  # is of the method/proc is false.
235
222
  def validates_acceptance_of *args
@@ -239,53 +226,54 @@ module AWS
239
226
  # Intended primarily for validating a form field was entered correctly
240
227
  # by requiring it twice:
241
228
  #
242
- # Model:
243
- # class User < AWS::Record::Model
244
- # validates_confirmation_of :password, :if => :password_changed?
245
- # end
229
+ # Model:
230
+ # class User < AWS::Record::Model
231
+ # validates_confirmation_of :password, :if => :password_changed?
232
+ # end
246
233
  #
247
- # View:
248
- # <%= password_field "user", "password" %>
249
- # <%= password_field "user", "password_confirmation" %>
234
+ # View:
235
+ # <%= password_field "user", "password" %>
236
+ # <%= password_field "user", "password_confirmation" %>
250
237
  #
251
- # === Confirmation Value Accessors
238
+ # ### Confirmation Value Accessors
252
239
  #
253
- # If your model does not have accessors for the confirmation value
240
+ # If your model does not have accessors for the confirmation value
254
241
  # then they will be automatically added. In the example above
255
- # the user class would have an +attr_accessor+ for
256
- # +:password_confirmation+.
242
+ # the user class would have an `attr_accessor` for
243
+ # `:password_confirmation`.
257
244
  #
258
- # === Conditional Validation
245
+ # ### Conditional Validation
259
246
  #
260
247
  # Mostly commonly you only need to validate confirmation of an
261
- # attribute when it has changed. It is therefore suggested to
262
- # pass an +:if+ condition reflecting this:
263
- #
264
- # validates_confirmation_of :password, :if => :password_changed?
248
+ # attribute when it has changed. It is therefore suggested to
249
+ # pass an `:if` condition reflecting this:
250
+ #
251
+ # validates_confirmation_of :password, :if => :password_changed?
265
252
  #
266
- # === Multi-Valued Attributes
253
+ # ### Multi-Valued Attributes
267
254
  #
268
255
  # This validator works only with single-valued attributes.
269
256
  # It should not be used on attributes that have array or set values.
270
257
  #
271
- # @note This validation method does not accept the +:allow_nil+ or the
272
- # +:allow_blank+ options.
258
+ # @note This validation method does not accept the `:allow_nil` or the
259
+ # `:allow_blank` options.
273
260
  #
274
261
  # @overload validates_confirmation_of(*attributes, options = {}, &block)
275
262
  # @param attributes A list of attribute names to validate.
276
263
  # @param [Hash] options
277
264
  # @option options [String] :message A custom error message. The default
278
- # +:message+ is "doesn't match confirmation".
265
+ # `:message` is "doesn't match confirmation".
279
266
  # @option options [Symbol] :on (:save) When this validation is run.
280
267
  # Valid values include:
281
- # * +:save+
282
- # * +:create+
283
- # * +:update+
268
+ #
269
+ # * `:save`
270
+ # * `:create`
271
+ # * `:update`
284
272
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
285
273
  # to call. The validation will only be run if the return value is
286
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
287
- # +:if => lambda{|book| book.in_stock? }+).
288
- # @option options [Symbol,String,Proc] :unless Specifies a method or
274
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
275
+ # `:if => lambda{|book| book.in_stock? }`).
276
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
289
277
  # proc to call. The validation will *not* be run if the return value
290
278
  # is of the method/proc is false.
291
279
  def validates_confirmation_of *args
@@ -294,63 +282,63 @@ module AWS
294
282
 
295
283
  # Validates the number of values for a given attribute.
296
284
  #
297
- # === Length vs Count
298
- #
299
- # +validates_count_of+ validates the number of attribute values,
300
- # whereas +validates_length_of: validates the length of each
285
+ # ### Length vs Count
286
+ #
287
+ # `validates_count_of` validates the number of attribute values,
288
+ # whereas +validates_length_of: validates the length of each
301
289
  # attribute value instead.
302
290
  #
303
291
  # If you need to ensure each attribute value is a given length see
304
292
  # {#validates_length_of} instead.
305
293
  #
306
- # === Examples
294
+ # ### Examples
307
295
  #
308
296
  # You can validate there are a certain number of values:
309
297
  #
310
- # validates_count_of :parents, :exactly => 2
311
- #
298
+ # validates_count_of :parents, :exactly => 2
299
+ #
312
300
  # You can also specify a range:
313
301
  #
314
- # validates_count_of :tags, :within => (2..10)
302
+ # validates_count_of :tags, :within => (2..10)
315
303
  #
316
304
  # You can also specify min and max value seperately:
317
305
  #
318
- # validates_count_of :tags, :minimum => 2, :maximum => 10
306
+ # validates_count_of :tags, :minimum => 2, :maximum => 10
319
307
  #
320
- # === +nil+ Values
308
+ # ### `nil` Values
321
309
  #
322
- # If you are validating an array or set that contains +nil+ values,
323
- # the +nil+ values are counted normally as 1 each.
310
+ # If you are validating an array or set that contains `nil` values,
311
+ # the `nil` values are counted normally as 1 each.
324
312
  #
325
313
  # If you are validating a non-enuemrable attribute that only
326
314
  # contains a single nil or other scalar value, then nil is
327
315
  # counted as 0.
328
316
  #
329
- # === Singular Attributes
317
+ # ### Singular Attributes
330
318
  #
331
319
  # This validator is intended to for validating attributes that have
332
320
  # an array or set of values. If used on an attribute that
333
- # returns a scalar value (like +nil+ or a string), the count will
334
- # always be 0 (for +nil+) or 1 (for everything else).
321
+ # returns a scalar value (like `nil` or a string), the count will
322
+ # always be 0 (for `nil`) or 1 (for everything else).
335
323
  #
336
- # It is therefore recomended to use +:validates_presence_of+ in
337
- # place of +:validates_count_of+ when working with single-valued
324
+ # It is therefore recomended to use `:validates_presence_of` in
325
+ # place of `:validates_count_of` when working with single-valued
338
326
  # attributes.
339
327
  #
340
328
  # @overload validates_count_of(*attributes, options = {}, &block)
341
329
  # @param attributes A list of attribute names to validate.
342
330
  # @param [Hash] options
343
- # @option options [Integer] :exactly The exact number of values the
344
- # attribute should have. If this validation option fails the
345
- # error message specified by +:wrong_number+ will be added.
346
- # @option options [Range] :within An range of number of values to
331
+ # @option options [Integer] :exactly The exact number of values the
332
+ # attribute should have. If this validation option fails the
333
+ # error message specified by `:wrong_number` will be added.
334
+ # @option options [Range] :within An range of number of values to
347
335
  # accept. If the attribute has a number of values outside this range
348
- # then the +:too_many+ or +:too_few+ error message will be added.
336
+ # then the `:too_many` or `:too_few` error message will be added.
349
337
  # @option options [Integer] :minimum The minimum number of values
350
- # the attribute should have. If it has fewer, the +:too_few+ error
338
+ # the attribute should have. If it has fewer, the `:too_few` error
351
339
  # message will be added.
352
340
  # @option options [Integer] :maximum The maximum number of values
353
- # the attribute should have. If it has more, the +:too_many+ error
341
+ # the attribute should have. If it has more, the `:too_many` error
354
342
  # message will be added.
355
343
  # @option options [String] :too_many An error message added
356
344
  # when the attribute has too many values. Defaults to
@@ -360,18 +348,18 @@ module AWS
360
348
  # <code>"has too few values (minimum is %{minimum})"</code>
361
349
  # @option options [String] :wrong_number An error message
362
350
  # added when the number of attribute values does not match
363
- # the +:exactly+ option. Defaults to <code>"has the wrong
351
+ # the `:exactly` option. Defaults to <code>"has the wrong
364
352
  # number of values (should have exactly %{exactly}"</code>
365
353
  # @option options [Symbol] :on (:save) When this validation is run.
366
354
  # Valid values include:
367
- # * +:save+
368
- # * +:create+
369
- # * +:update+
355
+ # * `:save`
356
+ # * `:create`
357
+ # * `:update`
370
358
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
371
359
  # to call. The validation will only be run if the return value is
372
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
373
- # +:if => lambda{|book| book.in_stock? }+).
374
- # @option options [Symbol,String,Proc] :unless Specifies a method or
360
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
361
+ # `:if => lambda{|book| book.in_stock? }`).
362
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
375
363
  # proc to call. The validation will *not* be run if the return value
376
364
  # is of the method/proc is false.
377
365
  def validates_count_of *args
@@ -380,35 +368,35 @@ module AWS
380
368
 
381
369
  # Adds a block validator that is called during record validation.
382
370
  #
383
- # class ExampleClass < AWS::Record::Model
371
+ # class ExampleClass < AWS::Record::Model
384
372
  #
385
- # string_attr :name
373
+ # string_attr :name
386
374
  #
387
- # validates_each(:name) do |record, attribute_name, value|
388
- # if value == 'John Doe'
389
- # record.errors.add(attr_name, 'may not be an alias')
375
+ # validates_each(:name) do |record, attribute_name, value|
376
+ # if value == 'John Doe'
377
+ # record.errors.add(attr_name, 'may not be an alias')
378
+ # end
390
379
  # end
391
- # end
392
380
  #
393
- # end
381
+ # end
394
382
  #
395
383
  # @overload validates_each(*attributes, options = {}, &block)
396
384
  # @param attributes A list of attribute names to validate.
397
385
  # @param [Hash] options
398
386
  # @option options [Boolean] :allow_nil (false) Skip validation if the
399
- # attribute value is +nil+.
387
+ # attribute value is `nil`.
400
388
  # @option options [Boolean] :allow_blank (false) Skip validation if the
401
- # attribute value is +blank+.
389
+ # attribute value is `blank`.
402
390
  # @option options [Symbol] :on (:save) When this validation is run.
403
391
  # Valid values include:
404
- # * +:save+
405
- # * +:create+
406
- # * +:update+
392
+ # * `:save`
393
+ # * `:create`
394
+ # * `:update`
407
395
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
408
396
  # to call. The validation will only be run if the return value is
409
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
410
- # +:if => lambda{|book| book.in_stock? }+).
411
- # @option options [Symbol,String,Proc] :unless Specifies a method or
397
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
398
+ # `:if => lambda{|book| book.in_stock? }`).
399
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
412
400
  # proc to call. The validation will *not* be run if the return value
413
401
  # is of the method/proc is false.
414
402
  def validates_each *attributes, &block
@@ -418,45 +406,42 @@ module AWS
418
406
  validators << BlockValidator.new(self, *attributes, &block)
419
407
  end
420
408
 
421
- # Validates that the attribute value is not included in the given
409
+ # Validates that the attribute value is not included in the given
422
410
  # enumerable.
423
411
  #
424
- # validates_exlusion_of :username, :in => %w(admin administrator)
412
+ # validates_exlusion_of :username, :in => %w(admin administrator)
425
413
  #
426
- # === Multi-Valued Attributes
414
+ # ### Multi-Valued Attributes
427
415
  #
428
416
  # You may use this with multi-valued attributes the same way you use it
429
417
  # with single-valued attributes:
430
418
  #
431
- # class Product < AWS::Record::Model
432
- #
433
- # string_attr :tags, :set => true
434
- #
435
- # validates_exlusion_of :tags, :in => four_letter_words
419
+ # class Product < AWS::Record::Model
420
+ # string_attr :tags, :set => true
421
+ # validates_exlusion_of :tags, :in => four_letter_words
422
+ # end
436
423
  #
437
- # end
438
- #
439
424
  # @overload validates_exclusion_of(*attributes, options = {}, &block)
440
425
  # @param attributes A list of attribute names to validate.
441
426
  # @param [Hash] options
442
427
  # @option options [required, Enumerable] :in An enumerable object to
443
428
  # ensure the value is not in.
444
429
  # @option options [String] :message A custom error message. The default
445
- # +:message+ is "is reserved".
430
+ # `:message` is "is reserved".
446
431
  # @option options [Boolean] :allow_nil (false) Skip validation if the
447
- # attribute value is +nil+.
432
+ # attribute value is `nil`.
448
433
  # @option options [Boolean] :allow_blank (false) Skip validation if the
449
- # attribute value is +blank+.
434
+ # attribute value is `blank`.
450
435
  # @option options [Symbol] :on (:save) When this validation is run.
451
436
  # Valid values include:
452
- # * +:save+
453
- # * +:create+
454
- # * +:update+
437
+ # * `:save`
438
+ # * `:create`
439
+ # * `:update`
455
440
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
456
441
  # to call. The validation will only be run if the return value is
457
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
458
- # +:if => lambda{|book| book.in_stock? }+).
459
- # @option options [Symbol,String,Proc] :unless Specifies a method or
442
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
443
+ # `:if => lambda{|book| book.in_stock? }`).
444
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
460
445
  # proc to call. The validation will *not* be run if the return value
461
446
  # is of the method/proc is false.
462
447
  def validates_exclusion_of *args
@@ -464,50 +449,47 @@ module AWS
464
449
  end
465
450
 
466
451
  # Validates the attribute's value matches the given regular exression.
467
- #
468
- # validates_format_of :year, :with => /^\d{4}$/
469
452
  #
470
- # You can also perform a not-match using +:without+ instead of +:with+.
453
+ # validates_format_of :year, :with => /^\d{4}$/
454
+ #
455
+ # You can also perform a not-match using `:without` instead of `:with`.
471
456
  #
472
- # validates_format_of :username, :without => /\d/
457
+ # validates_format_of :username, :without => /\d/
473
458
  #
474
- # === Multi-Valued Attributes
459
+ # ### Multi-Valued Attributes
475
460
  #
476
461
  # You may use this with multi-valued attributes the same way you use it
477
462
  # with single-valued attributes:
478
463
  #
479
- # class Product < AWS::Record::Model
480
- #
481
- # string_attr :tags, :set => true
482
- #
483
- # validates_format_of :tags, :with => /^\w{2,10}$/
464
+ # class Product < AWS::Record::Model
465
+ # string_attr :tags, :set => true
466
+ # validates_format_of :tags, :with => /^\w{2,10}$/
467
+ # end
484
468
  #
485
- # end
486
- #
487
469
  # @overload validates_format_of(*attributes, options = {}, &block)
488
470
  # @param attributes A list of attribute names to validate.
489
471
  # @param [Hash] options
490
- # @option options [Regexp] :with If the value matches the given
472
+ # @option options [Regexp] :with If the value matches the given
491
473
  # regex, an error will not be added.
492
- # @option options [Regexp] :without If the value matches the given
474
+ # @option options [Regexp] :without If the value matches the given
493
475
  # regex, an error will be added.
494
476
  # must match, or an error is added.
495
477
  # @option options [String] :message A custom error message. The default
496
- # +:message+ is "is reserved".
478
+ # `:message` is "is reserved".
497
479
  # @option options [Boolean] :allow_nil (false) Skip validation if the
498
- # attribute value is +nil+.
480
+ # attribute value is `nil`.
499
481
  # @option options [Boolean] :allow_blank (false) Skip validation if the
500
- # attribute value is +blank+.
482
+ # attribute value is `blank`.
501
483
  # @option options [Symbol] :on (:save) When this validation is run.
502
484
  # Valid values include:
503
- # * +:save+
504
- # * +:create+
505
- # * +:update+
485
+ # * `:save`
486
+ # * `:create`
487
+ # * `:update`
506
488
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
507
489
  # to call. The validation will only be run if the return value is
508
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
509
- # +:if => lambda{|book| book.in_stock? }+).
510
- # @option options [Symbol,String,Proc] :unless Specifies a method or
490
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
491
+ # `:if => lambda{|book| book.in_stock? }`).
492
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
511
493
  # proc to call. The validation will *not* be run if the return value
512
494
  # is of the method/proc is false.
513
495
  def validates_format_of *args
@@ -517,36 +499,36 @@ module AWS
517
499
  # Validates that the attribute value is included in the given enumerable
518
500
  # object.
519
501
  #
520
- # class MultipleChoiceAnswer < AWS::Record::Model
521
- # validates_inclusion_of :letter, :in => %w(a b c d e)
522
- # end
502
+ # class MultipleChoiceAnswer < AWS::Record::Model
503
+ # validates_inclusion_of :letter, :in => %w(a b c d e)
504
+ # end
523
505
  #
524
- # === Multi-Valued Attributes
506
+ # ### Multi-Valued Attributes
525
507
  #
526
508
  # You may use this with multi-valued attributes the same way you use it
527
509
  # with single-valued attributes.
528
- #
510
+ #
529
511
  # @overload validates_inclusion_of(*attributes, options = {}, &block)
530
512
  # @param attributes A list of attribute names to validate.
531
513
  # @param [Hash] options
532
514
  # @option options [required, Enumerable] :in An enumerable object to
533
515
  # check for the value in.
534
516
  # @option options [String] :message A custom error message. The default
535
- # +:message+ is "is not included in the list".
517
+ # `:message` is "is not included in the list".
536
518
  # @option options [Boolean] :allow_nil (false) Skip validation if the
537
- # attribute value is +nil+.
519
+ # attribute value is `nil`.
538
520
  # @option options [Boolean] :allow_blank (false) Skip validation if the
539
- # attribute value is +blank+.
521
+ # attribute value is `blank`.
540
522
  # @option options [Symbol] :on (:save) When this validation is run.
541
523
  # Valid values include:
542
- # * +:save+
543
- # * +:create+
544
- # * +:update+
524
+ # * `:save`
525
+ # * `:create`
526
+ # * `:update`
545
527
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
546
528
  # to call. The validation will only be run if the return value is
547
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
548
- # +:if => lambda{|book| book.in_stock? }+).
549
- # @option options [Symbol,String,Proc] :unless Specifies a method or
529
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
530
+ # `:if => lambda{|book| book.in_stock? }`).
531
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
550
532
  # proc to call. The validation will *not* be run if the return value
551
533
  # is of the method/proc is false.
552
534
  def validates_inclusion_of *attributes
@@ -555,13 +537,13 @@ module AWS
555
537
 
556
538
  # Validates the attribute values are of a specified length.
557
539
  #
558
- # validates_lenth_of :username, :within => 3..25
540
+ # validates_lenth_of :username, :within => 3..25
559
541
  #
560
- # === Length vs Count
561
- #
562
- # +validates_length_of+ validates the length of individual attribute
542
+ # ### Length vs Count
543
+ #
544
+ # `validates_length_of` validates the length of individual attribute
563
545
  # values, whereas +validates_count_of: validates the number of
564
- # attribute values.
546
+ # attribute values.
565
547
  #
566
548
  # If you need to ensure there are certain number of values see
567
549
  # {#validates_count_of} instead.
@@ -572,17 +554,17 @@ module AWS
572
554
  # @option options [Enumerable] :within An enumerable object to
573
555
  # ensure the length of the value falls within.
574
556
  # @option options [Integer] :exactly The exact length a value must be.
575
- # If this validation fails the error message specified by
576
- # +:wrong_length+ will be added.
557
+ # If this validation fails the error message specified by
558
+ # `:wrong_length` will be added.
577
559
  # @option options [Range] :within An enumerable object which must
578
560
  # include the length of the attribute, or an error will be added.
579
- # If the attribute has a length outside the range then the
580
- # +:too_long+ or +:too_short+ error message will be added.
561
+ # If the attribute has a length outside the range then the
562
+ # `:too_long` or `:too_short` error message will be added.
581
563
  # @option options [Integer] :minimum The minimum length an attribute
582
- # value should be. If it is shorter, the +:too_short+ error
564
+ # value should be. If it is shorter, the `:too_short` error
583
565
  # message will be added.
584
566
  # @option options [Integer] :maximum The maximum length an attribute
585
- # value should be. If it is longer, the +:too_long+ error
567
+ # value should be. If it is longer, the `:too_long` error
586
568
  # message will be added.
587
569
  # @option options [String] :too_long An error message added
588
570
  # when the attribute value is too long. Defaults to
@@ -594,22 +576,22 @@ module AWS
594
576
  # characters)"</code>
595
577
  # @option options [String] :wrong_length An error message
596
578
  # added when the attribute has the incorrect length (as
597
- # specified by +:exactly+). Defaults to <code>"is the wrong
579
+ # specified by `:exactly`). Defaults to <code>"is the wrong
598
580
  # length (should be %{exactly} characters"</code>
599
581
  # @option options [Boolean] :allow_nil (false) Skip validation if the
600
- # attribute value is +nil+.
582
+ # attribute value is `nil`.
601
583
  # @option options [Boolean] :allow_blank (false) Skip validation if the
602
- # attribute value is +blank+.
584
+ # attribute value is `blank`.
603
585
  # @option options [Symbol] :on (:save) When this validation is run.
604
586
  # Valid values include:
605
- # * +:save+
606
- # * +:create+
607
- # * +:update+
587
+ # * `:save`
588
+ # * `:create`
589
+ # * `:update`
608
590
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
609
591
  # to call. The validation will only be run if the return value is
610
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
611
- # +:if => lambda{|book| book.in_stock? }+).
612
- # @option options [Symbol,String,Proc] :unless Specifies a method or
592
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
593
+ # `:if => lambda{|book| book.in_stock? }`).
594
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
613
595
  # proc to call. The validation will *not* be run if the return value
614
596
  # is of the method/proc is false.
615
597
  def validates_length_of *args
@@ -618,83 +600,83 @@ module AWS
618
600
 
619
601
  # Validates the attribute has a numeric value.
620
602
  #
621
- # validates_numericality_of :age, :only_integer => true
603
+ # validates_numericality_of :age, :only_integer => true
622
604
  #
623
- # === Multi-Valued Attributes
605
+ # ### Multi-Valued Attributes
624
606
  #
625
607
  # You can validate multi-valued attributes using this the same way you
626
- # validate single-valued attributes. Each value will be validated
608
+ # validate single-valued attributes. Each value will be validated
627
609
  # individually.
628
610
  #
629
611
  # @overload validates_numericality_of(*attributes, options = {}, &block)
630
612
  # @param attributes A list of attribute names to validate.
631
613
  # @param [Hash] options
632
- # @option options [Boolean] :only_integer (false) Adds an error
614
+ # @option options [Boolean] :only_integer (false) Adds an error
633
615
  # when valiating and the value is numeric, but it not a whole number.
634
616
  # @option options [Integer] :equal_to When set the value must equal
635
617
  # the given value exactly. May not be used with the greater/less
636
618
  # options.
637
619
  # @option options [Numeric] :greater_than Ensures the attribute
638
620
  # is greater than the given number.
639
- # @option options [Integer] :greater_than_or_equal_to Ensures the
621
+ # @option options [Integer] :greater_than_or_equal_to Ensures the
640
622
  # attribute is greater than or equal to the given number.
641
623
  # @option options [Numeric] :less_than Ensures the attribute is less
642
624
  # than the given value.
643
625
  # @option options [Integer] :less_than_or_equal_to Ensures the value is
644
626
  # less than or equal to the given number.
645
627
  # @option options [Numeric] :even If true, the value may only be
646
- # an even integer. This forces the +:only_integer+ to +true+.
628
+ # an even integer. This forces the `:only_integer` to `true`.
647
629
  # @option options [Numeric] :odd If true, the value may only be
648
- # an odd integer. This forces the +:only_integer+ to +true+.
630
+ # an odd integer. This forces the `:only_integer` to `true`.
649
631
  # @option options [String] :message A custom error message. The default
650
- # +:message+ is "is not a number".
632
+ # `:message` is "is not a number".
651
633
  # @option options [Boolean] :allow_nil (false) Skip validation if the
652
- # attribute value is +nil+.
634
+ # attribute value is `nil`.
653
635
  # @option options [Boolean] :allow_blank (false) Skip validation if the
654
- # attribute value is +blank+.
636
+ # attribute value is `blank`.
655
637
  # @option options [Symbol] :on (:save) When this validation is run.
656
638
  # Valid values include:
657
- # * +:save+
658
- # * +:create+
659
- # * +:update+
639
+ # * `:save`
640
+ # * `:create`
641
+ # * `:update`
660
642
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
661
643
  # to call. The validation will only be run if the return value is
662
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
663
- # +:if => lambda{|book| book.in_stock? }+).
664
- # @option options [Symbol,String,Proc] :unless Specifies a method or
644
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
645
+ # `:if => lambda{|book| book.in_stock? }`).
646
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
665
647
  # proc to call. The validation will *not* be run if the return value
666
648
  # is of the method/proc is false.
667
649
  def validates_numericality_of *args
668
650
  validators << NumericalityValidator.new(self, *args)
669
651
  end
670
652
 
671
- # Validates the named attributes are not blank. For validation
653
+ # Validates the named attributes are not blank. For validation
672
654
  # purposes, blank values include:
673
655
  #
674
- # * +nil+
656
+ # * `nil`
675
657
  # * empty string
676
658
  # * anything that responds to #empty? with true
677
659
  # * anything that responds to #blank? with true
678
- #
660
+ #
679
661
  # @overload validates_presence_of(*attributes, options = {}, &block)
680
662
  # @param attributes A list of attribute names to validate.
681
663
  # @param [Hash] options
682
664
  # @option options [String] :message A custom error message. The default
683
- # +:message+ is "may not be blank".
665
+ # `:message` is "may not be blank".
684
666
  # @option options [Symbol] :on (:save) When this validation is run.
685
667
  # Valid values include:
686
- # * +:save+
687
- # * +:create+
688
- # * +:update+
668
+ # * `:save`
669
+ # * `:create`
670
+ # * `:update`
689
671
  # @option options [Boolean] :allow_nil (false) Skip validation if the
690
- # attribute value is +nil+.
672
+ # attribute value is `nil`.
691
673
  # @option options [Boolean] :allow_blank (false) Skip validation if the
692
- # attribute value is +blank+.
674
+ # attribute value is `blank`.
693
675
  # @option options [Symbol,String,Proc] :if Specifies a method or proc
694
676
  # to call. The validation will only be run if the return value is
695
- # of the method/proc is true (e.g. +:if => :name_changed?+ or
696
- # +:if => lambda{|book| book.in_stock? }+).
697
- # @option options [Symbol,String,Proc] :unless Specifies a method or
677
+ # of the method/proc is true (e.g. `:if => :name_changed?` or
678
+ # `:if => lambda{|book| book.in_stock? }`).
679
+ # @option options [Symbol,String,Proc] :unless Specifies a method or
698
680
  # proc to call. The validation will *not* be run if the return value
699
681
  # is of the method/proc is false.
700
682
  def validates_presence_of *args