s33r 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/bin/s3cli.rb +1 -1
  2. data/html/classes/MIME/Type.html +137 -137
  3. data/html/classes/MIME/Types.html +56 -56
  4. data/html/classes/Net/HTTPGenericRequest.html +32 -32
  5. data/html/classes/Net/HTTPResponse.html +63 -38
  6. data/html/classes/S33r.html +78 -78
  7. data/html/classes/S33r/BucketListing.html +30 -30
  8. data/html/classes/S33r/Client.html +340 -286
  9. data/html/classes/S33r/NamedBucket.html +209 -179
  10. data/html/classes/S33r/S33rException.html +2 -0
  11. data/html/classes/S33r/S33rException/MissingBucketName.html +111 -0
  12. data/html/classes/S33r/S33rException/S3FallenOver.html +111 -0
  13. data/html/classes/S33r/S3Object.html +24 -24
  14. data/html/classes/S33r/S3User.html +6 -6
  15. data/html/classes/S33r/Sync.html +8 -7
  16. data/html/created.rid +1 -1
  17. data/html/files/README_txt.html +1 -1
  18. data/html/files/lib/s33r/bucket_listing_rb.html +1 -1
  19. data/html/files/lib/s33r/client_rb.html +1 -1
  20. data/html/files/lib/s33r/named_bucket_rb.html +1 -1
  21. data/html/files/lib/s33r/s33r_exception_rb.html +1 -1
  22. data/html/files/lib/s33r/s33r_http_rb.html +1 -1
  23. data/html/files/lib/s33r/sync_rb.html +1 -1
  24. data/html/fr_class_index.html +2 -0
  25. data/html/fr_method_index.html +100 -96
  26. data/lib/s33r/client.rb +15 -6
  27. data/lib/s33r/named_bucket.rb +30 -18
  28. data/lib/s33r/s33r_exception.rb +6 -0
  29. data/lib/s33r/s33r_http.rb +6 -0
  30. data/lib/s33r/sync.rb +1 -1
  31. data/test/cases/spec_bucket_listing.rb +1 -1
  32. data/test/cases/spec_client.rb +13 -4
  33. data/test/cases/spec_core.rb +3 -1
  34. data/test/cases/spec_namedbucket.rb +16 -2
  35. data/test/cases/spec_sync.rb +4 -0
  36. data/test/files/namedbucket_config2.yml +12 -0
  37. data/test/files/s3_object.xml +1 -0
  38. metadata +5 -2
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Sep 26 11:10:08 BST 2006</td>
59
+ <td>Wed Sep 27 00:30:42 BST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Sep 18 10:17:39 BST 2006</td>
59
+ <td>Tue Sep 26 11:48:28 BST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Sep 18 10:16:18 BST 2006</td>
59
+ <td>Tue Sep 26 12:02:26 BST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Sep 18 09:45:20 BST 2006</td>
59
+ <td>Tue Sep 26 11:41:33 BST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -36,8 +36,10 @@
36
36
  <a href="classes/S33r/S33rException/InvalidBucketListing.html">S33r::S33rException::InvalidBucketListing</a><br />
37
37
  <a href="classes/S33r/S33rException/MalformedBucketName.html">S33r::S33rException::MalformedBucketName</a><br />
38
38
  <a href="classes/S33r/S33rException/MethodNotAvailable.html">S33r::S33rException::MethodNotAvailable</a><br />
39
+ <a href="classes/S33r/S33rException/MissingBucketName.html">S33r::S33rException::MissingBucketName</a><br />
39
40
  <a href="classes/S33r/S33rException/MissingRequiredHeaders.html">S33r::S33rException::MissingRequiredHeaders</a><br />
40
41
  <a href="classes/S33r/S33rException/MissingResource.html">S33r::S33rException::MissingResource</a><br />
42
+ <a href="classes/S33r/S33rException/S3FallenOver.html">S33r::S33rException::S3FallenOver</a><br />
41
43
  <a href="classes/S33r/S33rException/UnsupportedCannedACL.html">S33r::S33rException::UnsupportedCannedACL</a><br />
42
44
  <a href="classes/S33r/S33rException/UnsupportedHTTPMethod.html">S33r::S33rException::UnsupportedHTTPMethod</a><br />
43
45
  <a href="classes/S33r/S3Object.html">S33r::S3Object</a><br />
@@ -20,105 +20,109 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Methods</h1>
22
22
  <div id="index-entries">
23
- <a href="classes/S33r/BucketListing.html#M000077">[] (S33r::BucketListing)</a><br />
24
- <a href="classes/S33r/NamedBucket.html#M000063">[] (S33r::NamedBucket)</a><br />
25
- <a href="classes/MIME/Types.html#M000014">[] (MIME::Types)</a><br />
26
- <a href="classes/MIME/Types.html#M000010">[] (MIME::Types)</a><br />
27
- <a href="classes/MIME/Types.html#M000013">add (MIME::Types)</a><br />
28
- <a href="classes/MIME/Types.html#M000017">add (MIME::Types)</a><br />
29
- <a href="classes/S33r/Client.html#M000095">add_client_headers (S33r::Client)</a><br />
30
- <a href="classes/S33r.html#M000043">add_default_headers (S33r)</a><br />
31
- <a href="classes/MIME/Type.html#M000031">ascii? (MIME::Type)</a><br />
32
- <a href="classes/MIME/Type.html#M000030">binary? (MIME::Type)</a><br />
33
- <a href="classes/S33r/Client.html#M000089">bucket_exists? (S33r::Client)</a><br />
34
- <a href="classes/S33r.html#M000047">bucket_name_valid? (S33r)</a><br />
35
- <a href="classes/S33r.html#M000045">canned_acl_header (S33r)</a><br />
36
- <a href="classes/MIME/Type.html#M000035">complete? (MIME::Type)</a><br />
37
- <a href="classes/S33r/Client.html#M000087">create_bucket (S33r::Client)</a><br />
38
- <a href="classes/MIME/Type.html#M000019">default_encoding (MIME::Type)</a><br />
39
- <a href="classes/S33r/NamedBucket.html#M000071">delete (S33r::NamedBucket)</a><br />
40
- <a href="classes/S33r/S3Object.html#M000056">delete (S33r::S3Object)</a><br />
41
- <a href="classes/S33r/Client.html#M000088">delete_bucket (S33r::Client)</a><br />
42
- <a href="classes/S33r/NamedBucket.html#M000072">delete_key (S33r::NamedBucket)</a><br />
43
- <a href="classes/S33r/Client.html#M000094">delete_resource (S33r::Client)</a><br />
44
- <a href="classes/S33r/Client.html#M000100">do_delete (S33r::Client)</a><br />
45
- <a href="classes/S33r/Client.html#M000096">do_get (S33r::Client)</a><br />
46
- <a href="classes/S33r/Client.html#M000097">do_head (S33r::Client)</a><br />
47
- <a href="classes/S33r/Client.html#M000098">do_post (S33r::Client)</a><br />
48
- <a href="classes/S33r/Client.html#M000099">do_put (S33r::Client)</a><br />
49
- <a href="classes/S33r/Client.html#M000083">do_request (S33r::Client)</a><br />
50
- <a href="classes/MIME/Type.html#M000022">docs= (MIME::Type)</a><br />
51
- <a href="classes/S33r/NamedBucket.html#M000066">each_item (S33r::NamedBucket)</a><br />
52
- <a href="classes/S33r/NamedBucket.html#M000067">exists? (S33r::NamedBucket)</a><br />
53
- <a href="classes/MIME/Type.html#M000025">from_array (MIME::Type)</a><br />
54
- <a href="classes/MIME/Type.html#M000026">from_hash (MIME::Type)</a><br />
55
- <a href="classes/MIME/Type.html#M000027">from_mime_type (MIME::Type)</a><br />
56
- <a href="classes/S33r.html#M000041">generate_auth_header_value (S33r)</a><br />
57
- <a href="classes/S33r.html#M000040">generate_canonical_string (S33r)</a><br />
58
- <a href="classes/S33r.html#M000048">generate_querystring (S33r)</a><br />
59
- <a href="classes/S33r.html#M000042">generate_signature (S33r)</a><br />
60
- <a href="classes/S33r/Client.html#M000084">get_requester (S33r::Client)</a><br />
61
- <a href="classes/S33r/Client.html#M000090">get_resource (S33r::Client)</a><br />
23
+ <a href="classes/MIME/Types.html#M000011">[] (MIME::Types)</a><br />
24
+ <a href="classes/MIME/Types.html#M000015">[] (MIME::Types)</a><br />
25
+ <a href="classes/S33r/NamedBucket.html#M000064">[] (S33r::NamedBucket)</a><br />
26
+ <a href="classes/S33r/BucketListing.html#M000079">[] (S33r::BucketListing)</a><br />
27
+ <a href="classes/MIME/Types.html#M000014">add (MIME::Types)</a><br />
28
+ <a href="classes/MIME/Types.html#M000018">add (MIME::Types)</a><br />
29
+ <a href="classes/S33r/Client.html#M000099">add_client_headers (S33r::Client)</a><br />
30
+ <a href="classes/S33r.html#M000044">add_default_headers (S33r)</a><br />
31
+ <a href="classes/MIME/Type.html#M000032">ascii? (MIME::Type)</a><br />
32
+ <a href="classes/MIME/Type.html#M000031">binary? (MIME::Type)</a><br />
33
+ <a href="classes/S33r/Client.html#M000091">bucket_exists? (S33r::Client)</a><br />
34
+ <a href="classes/S33r.html#M000048">bucket_name_valid? (S33r)</a><br />
35
+ <a href="classes/S33r.html#M000046">canned_acl_header (S33r)</a><br />
36
+ <a href="classes/Net/HTTPResponse.html#M000005">check_s3_availability (Net::HTTPResponse)</a><br />
37
+ <a href="classes/MIME/Type.html#M000036">complete? (MIME::Type)</a><br />
38
+ <a href="classes/S33r/Client.html#M000089">create_bucket (S33r::Client)</a><br />
39
+ <a href="classes/MIME/Type.html#M000020">default_encoding (MIME::Type)</a><br />
40
+ <a href="classes/S33r/S3Object.html#M000057">delete (S33r::S3Object)</a><br />
41
+ <a href="classes/S33r/Client.html#M000090">delete_bucket (S33r::Client)</a><br />
42
+ <a href="classes/S33r/Client.html#M000098">delete_resource (S33r::Client)</a><br />
43
+ <a href="classes/S33r/NamedBucket.html#M000074">delete_resource (S33r::NamedBucket)</a><br />
44
+ <a href="classes/S33r/NamedBucket.html#M000067">destroy (S33r::NamedBucket)</a><br />
45
+ <a href="classes/S33r/Client.html#M000104">do_delete (S33r::Client)</a><br />
46
+ <a href="classes/S33r/Client.html#M000100">do_get (S33r::Client)</a><br />
47
+ <a href="classes/S33r/Client.html#M000101">do_head (S33r::Client)</a><br />
48
+ <a href="classes/S33r/Client.html#M000102">do_post (S33r::Client)</a><br />
49
+ <a href="classes/S33r/Client.html#M000103">do_put (S33r::Client)</a><br />
50
+ <a href="classes/S33r/Client.html#M000085">do_request (S33r::Client)</a><br />
51
+ <a href="classes/MIME/Type.html#M000023">docs= (MIME::Type)</a><br />
52
+ <a href="classes/S33r/NamedBucket.html#M000069">each_item (S33r::NamedBucket)</a><br />
53
+ <a href="classes/S33r/NamedBucket.html#M000066">exists? (S33r::NamedBucket)</a><br />
54
+ <a href="classes/MIME/Type.html#M000026">from_array (MIME::Type)</a><br />
55
+ <a href="classes/MIME/Type.html#M000027">from_hash (MIME::Type)</a><br />
56
+ <a href="classes/MIME/Type.html#M000028">from_mime_type (MIME::Type)</a><br />
57
+ <a href="classes/S33r.html#M000042">generate_auth_header_value (S33r)</a><br />
58
+ <a href="classes/S33r.html#M000041">generate_canonical_string (S33r)</a><br />
59
+ <a href="classes/S33r.html#M000049">generate_querystring (S33r)</a><br />
60
+ <a href="classes/S33r.html#M000043">generate_signature (S33r)</a><br />
61
+ <a href="classes/S33r/Client.html#M000094">get_object (S33r::Client)</a><br />
62
+ <a href="classes/S33r/Client.html#M000086">get_requester (S33r::Client)</a><br />
63
+ <a href="classes/S33r/Client.html#M000093">get_resource (S33r::Client)</a><br />
62
64
  <a href="classes/XML.html#M000002">get_xml_doc (XML)</a><br />
63
- <a href="classes/S33r.html#M000046">guess_mime_type (S33r)</a><br />
64
- <a href="classes/S33r/Client.html#M000080">init (S33r::Client)</a><br />
65
- <a href="classes/S33r/NamedBucket.html#M000059">init (S33r::NamedBucket)</a><br />
66
- <a href="classes/S33r/NamedBucket.html#M000065">keys (S33r::NamedBucket)</a><br />
67
- <a href="classes/S33r.html#M000052">keys_to_symbols (S33r)</a><br />
68
- <a href="classes/MIME/Type.html#M000018">like? (MIME::Type)</a><br />
69
- <a href="classes/S33r/Client.html#M000086">list_bucket (S33r::Client)</a><br />
70
- <a href="classes/S33r/Client.html#M000085">list_buckets (S33r::Client)</a><br />
71
- <a href="classes/S33r/NamedBucket.html#M000064">listing (S33r::NamedBucket)</a><br />
72
- <a href="classes/S33r/Client.html#M000081">load_config (S33r::Client)</a><br />
73
- <a href="classes/S33r/Sync.html#M000053">md5sum (S33r::Sync)</a><br />
74
- <a href="classes/S33r.html#M000044">metadata_headers (S33r)</a><br />
75
- <a href="classes/S33r/BucketListing.html#M000074">new (S33r::BucketListing)</a><br />
76
- <a href="classes/S33r/S3User.html#M000054">new (S33r::S3User)</a><br />
77
- <a href="classes/S33r/S3Object.html#M000055">new (S33r::S3Object)</a><br />
78
- <a href="classes/MIME/Type.html#M000028">new (MIME::Type)</a><br />
79
- <a href="classes/S33r/NamedBucket.html#M000060">new (S33r::NamedBucket)</a><br />
80
- <a href="classes/MIME/Types.html#M000009">new (MIME::Types)</a><br />
81
- <a href="classes/S33r/Client.html#M000079">new (S33r::Client)</a><br />
82
- <a href="classes/Net/HTTPResponse.html#M000007">not_found (Net::HTTPResponse)</a><br />
83
- <a href="classes/MIME/Type.html#M000021">obsolete? (MIME::Type)</a><br />
84
- <a href="classes/MIME/Types.html#M000012">of (MIME::Types)</a><br />
85
- <a href="classes/MIME/Types.html#M000016">of (MIME::Types)</a><br />
86
- <a href="classes/Net/HTTPResponse.html#M000005">ok? (Net::HTTPResponse)</a><br />
87
- <a href="classes/S33r/BucketListing.html#M000076">parse_listing (S33r::BucketListing)</a><br />
88
- <a href="classes/MIME/Type.html#M000034">platform? (MIME::Type)</a><br />
89
- <a href="classes/S33r/BucketListing.html#M000078">pretty (S33r::BucketListing)</a><br />
90
- <a href="classes/S33r/NamedBucket.html#M000061">public_contents? (S33r::NamedBucket)</a><br />
91
- <a href="classes/S33r/NamedBucket.html#M000069">put_file (S33r::NamedBucket)</a><br />
92
- <a href="classes/S33r/Client.html#M000093">put_file (S33r::Client)</a><br />
93
- <a href="classes/S33r/Client.html#M000091">put_resource (S33r::Client)</a><br />
94
- <a href="classes/S33r/NamedBucket.html#M000070">put_stream (S33r::NamedBucket)</a><br />
95
- <a href="classes/S33r/Client.html#M000092">put_text (S33r::Client)</a><br />
96
- <a href="classes/S33r/NamedBucket.html#M000068">put_text (S33r::NamedBucket)</a><br />
97
- <a href="classes/MIME/Type.html#M000029">registered? (MIME::Type)</a><br />
98
- <a href="classes/S33r/NamedBucket.html#M000073">s3_authenticated_url (S33r::NamedBucket)</a><br />
99
- <a href="classes/S33r.html#M000051">s3_authenticated_url (S33r)</a><br />
100
- <a href="classes/S33r.html#M000050">s3_public_url (S33r)</a><br />
65
+ <a href="classes/S33r.html#M000047">guess_mime_type (S33r)</a><br />
66
+ <a href="classes/S33r/Client.html#M000092">head_resource (S33r::Client)</a><br />
67
+ <a href="classes/S33r/Client.html#M000082">init (S33r::Client)</a><br />
68
+ <a href="classes/S33r/NamedBucket.html#M000060">init (S33r::NamedBucket)</a><br />
69
+ <a href="classes/S33r/NamedBucket.html#M000070">key_exists? (S33r::NamedBucket)</a><br />
70
+ <a href="classes/S33r/NamedBucket.html#M000068">keys (S33r::NamedBucket)</a><br />
71
+ <a href="classes/S33r.html#M000053">keys_to_symbols (S33r)</a><br />
72
+ <a href="classes/MIME/Type.html#M000019">like? (MIME::Type)</a><br />
73
+ <a href="classes/S33r/Client.html#M000088">list_bucket (S33r::Client)</a><br />
74
+ <a href="classes/S33r/Client.html#M000087">list_buckets (S33r::Client)</a><br />
75
+ <a href="classes/S33r/NamedBucket.html#M000065">listing (S33r::NamedBucket)</a><br />
76
+ <a href="classes/S33r/Client.html#M000083">load_config (S33r::Client)</a><br />
77
+ <a href="classes/S33r/Sync.html#M000054">md5sum (S33r::Sync)</a><br />
78
+ <a href="classes/S33r.html#M000045">metadata_headers (S33r)</a><br />
79
+ <a href="classes/S33r/BucketListing.html#M000076">new (S33r::BucketListing)</a><br />
80
+ <a href="classes/S33r/S3Object.html#M000056">new (S33r::S3Object)</a><br />
81
+ <a href="classes/S33r/S3User.html#M000055">new (S33r::S3User)</a><br />
82
+ <a href="classes/MIME/Type.html#M000029">new (MIME::Type)</a><br />
83
+ <a href="classes/S33r/NamedBucket.html#M000061">new (S33r::NamedBucket)</a><br />
84
+ <a href="classes/S33r/Client.html#M000081">new (S33r::Client)</a><br />
85
+ <a href="classes/MIME/Types.html#M000010">new (MIME::Types)</a><br />
86
+ <a href="classes/Net/HTTPResponse.html#M000008">not_found (Net::HTTPResponse)</a><br />
87
+ <a href="classes/MIME/Type.html#M000022">obsolete? (MIME::Type)</a><br />
88
+ <a href="classes/MIME/Types.html#M000013">of (MIME::Types)</a><br />
89
+ <a href="classes/MIME/Types.html#M000017">of (MIME::Types)</a><br />
90
+ <a href="classes/Net/HTTPResponse.html#M000006">ok? (Net::HTTPResponse)</a><br />
91
+ <a href="classes/S33r/BucketListing.html#M000078">parse_listing (S33r::BucketListing)</a><br />
92
+ <a href="classes/MIME/Type.html#M000035">platform? (MIME::Type)</a><br />
93
+ <a href="classes/S33r/BucketListing.html#M000080">pretty (S33r::BucketListing)</a><br />
94
+ <a href="classes/S33r/NamedBucket.html#M000062">public_contents? (S33r::NamedBucket)</a><br />
95
+ <a href="classes/S33r/NamedBucket.html#M000072">put_file (S33r::NamedBucket)</a><br />
96
+ <a href="classes/S33r/Client.html#M000097">put_file (S33r::Client)</a><br />
97
+ <a href="classes/S33r/Client.html#M000095">put_resource (S33r::Client)</a><br />
98
+ <a href="classes/S33r/NamedBucket.html#M000073">put_stream (S33r::NamedBucket)</a><br />
99
+ <a href="classes/S33r/Client.html#M000096">put_text (S33r::Client)</a><br />
100
+ <a href="classes/S33r/NamedBucket.html#M000071">put_text (S33r::NamedBucket)</a><br />
101
+ <a href="classes/MIME/Type.html#M000030">registered? (MIME::Type)</a><br />
102
+ <a href="classes/S33r/NamedBucket.html#M000075">s3_authenticated_url (S33r::NamedBucket)</a><br />
103
+ <a href="classes/S33r.html#M000052">s3_authenticated_url (S33r)</a><br />
104
+ <a href="classes/S33r.html#M000051">s3_public_url (S33r)</a><br />
101
105
  <a href="classes/Net/HTTPGenericRequest.html#M000004">send_request_with_body_stream (Net::HTTPGenericRequest)</a><br />
102
- <a href="classes/S33r/S3Object.html#M000058">set_from_node (S33r::S3Object)</a><br />
103
- <a href="classes/S33r/S3Object.html#M000057">set_from_xml_string (S33r::S3Object)</a><br />
104
- <a href="classes/S33r/BucketListing.html#M000075">set_listing_xml (S33r::BucketListing)</a><br />
105
- <a href="classes/MIME/Type.html#M000032">signature? (MIME::Type)</a><br />
106
- <a href="classes/MIME/Type.html#M000024">simplified (MIME::Type)</a><br />
107
- <a href="classes/S33r/NamedBucket.html#M000062">strict? (S33r::NamedBucket)</a><br />
108
- <a href="classes/Net/HTTPResponse.html#M000006">success (Net::HTTPResponse)</a><br />
109
- <a href="classes/MIME/Type.html#M000033">system? (MIME::Type)</a><br />
110
- <a href="classes/MIME/Type.html#M000038">to_a (MIME::Type)</a><br />
111
- <a href="classes/MIME/Type.html#M000039">to_hash (MIME::Type)</a><br />
106
+ <a href="classes/S33r/S3Object.html#M000059">set_from_node (S33r::S3Object)</a><br />
107
+ <a href="classes/S33r/S3Object.html#M000058">set_from_xml_string (S33r::S3Object)</a><br />
108
+ <a href="classes/S33r/BucketListing.html#M000077">set_listing_xml (S33r::BucketListing)</a><br />
109
+ <a href="classes/MIME/Type.html#M000033">signature? (MIME::Type)</a><br />
110
+ <a href="classes/MIME/Type.html#M000025">simplified (MIME::Type)</a><br />
111
+ <a href="classes/S33r/NamedBucket.html#M000063">strict? (S33r::NamedBucket)</a><br />
112
+ <a href="classes/Net/HTTPResponse.html#M000007">success (Net::HTTPResponse)</a><br />
113
+ <a href="classes/MIME/Type.html#M000034">system? (MIME::Type)</a><br />
114
+ <a href="classes/MIME/Type.html#M000039">to_a (MIME::Type)</a><br />
115
+ <a href="classes/MIME/Type.html#M000040">to_hash (MIME::Type)</a><br />
116
+ <a href="classes/MIME/Type.html#M000037">to_s (MIME::Type)</a><br />
117
+ <a href="classes/Net/HTTPResponse.html#M000009">to_s (Net::HTTPResponse)</a><br />
112
118
  <a href="classes/Net/HTTPGenericRequest.html#M000003">to_s (Net::HTTPGenericRequest)</a><br />
113
- <a href="classes/Net/HTTPResponse.html#M000008">to_s (Net::HTTPResponse)</a><br />
114
- <a href="classes/MIME/Type.html#M000036">to_s (MIME::Type)</a><br />
115
- <a href="classes/MIME/Type.html#M000037">to_str (MIME::Type)</a><br />
116
- <a href="classes/MIME/Types.html#M000015">type_for (MIME::Types)</a><br />
117
- <a href="classes/MIME/Types.html#M000011">type_for (MIME::Types)</a><br />
118
- <a href="classes/S33r.html#M000049">url_join (S33r)</a><br />
119
- <a href="classes/MIME/Type.html#M000023">urls (MIME::Type)</a><br />
120
- <a href="classes/MIME/Type.html#M000020">use_instead (MIME::Type)</a><br />
121
- <a href="classes/S33r/Client.html#M000082">use_ssl? (S33r::Client)</a><br />
119
+ <a href="classes/MIME/Type.html#M000038">to_str (MIME::Type)</a><br />
120
+ <a href="classes/MIME/Types.html#M000016">type_for (MIME::Types)</a><br />
121
+ <a href="classes/MIME/Types.html#M000012">type_for (MIME::Types)</a><br />
122
+ <a href="classes/S33r.html#M000050">url_join (S33r)</a><br />
123
+ <a href="classes/MIME/Type.html#M000024">urls (MIME::Type)</a><br />
124
+ <a href="classes/MIME/Type.html#M000021">use_instead (MIME::Type)</a><br />
125
+ <a href="classes/S33r/Client.html#M000084">use_ssl? (S33r::Client)</a><br />
122
126
  <a href="classes/XML.html#M000001">xget (XML)</a><br />
123
127
  </div>
124
128
  </div>
@@ -9,8 +9,8 @@ module S33r
9
9
  # only client-specific headers are managed here: other headers
10
10
  # can be handled by the core.
11
11
  #--
12
- # TODO: need to wrap XML returned into object representation.
13
12
  # TODO: use customisable thread pool for requests.
13
+ # TODO: timeout on requests.
14
14
  #--
15
15
  class Client
16
16
  include S33r
@@ -94,8 +94,6 @@ module S33r
94
94
  #
95
95
  # This method streams +data+ if it responds to the +stat+ method
96
96
  # (as files do).
97
- #
98
- #-- TODO: set timeout on requests in case S3 is unresponsive
99
97
  def do_request(method, path, data=nil, headers={})
100
98
  req = get_requester(method, path)
101
99
  req.chunk_size = @chunk_size
@@ -130,9 +128,10 @@ module S33r
130
128
  end
131
129
 
132
130
  @client.start do
133
- return @client.request(req, data)
131
+ response = @client.request(req, data)
132
+ response.check_s3_availability
133
+ response
134
134
  end
135
-
136
135
  end
137
136
 
138
137
  # Return an instance of an appropriate request class.
@@ -197,10 +196,20 @@ module S33r
197
196
  do_head("/#{bucket_name}").ok?
198
197
  end
199
198
 
200
- # Fetch a resource and return a fleshed-out S3Object instance.
199
+ # Fetch head info for a key in a bucket.
200
+ def head_resource(bucket_name, resource_key, headers={})
201
+ do_head("/#{bucket_name}/#{resource_key}", headers)
202
+ end
203
+
204
+ # Fetch a resource.
201
205
  def get_resource(bucket_name, resource_key, headers={})
202
206
  do_get("/#{bucket_name}/#{resource_key}", headers)
203
207
  end
208
+
209
+ # TODO: return S3Object
210
+ def get_object(bucket_name, resource_key, headers)
211
+ response = get_resource(bucket_name, resource_key, headers)
212
+ end
204
213
 
205
214
  # Put some generic resource onto S3.
206
215
  def put_resource(bucket_name, resource_key, data, headers={})
@@ -1,4 +1,6 @@
1
- #-- TODO: provide access to metadata on the enclosed bucket_listing
1
+ #-- TODO: manipulation of bucket_listing through options hash, e.g. fetch particular page,
2
+ #-- specify a prefix and/or delimiter
3
+
2
4
  require File.join(File.dirname(__FILE__), 'client')
3
5
 
4
6
  module S33r
@@ -26,6 +28,10 @@ module S33r
26
28
  super(aws_access_key, aws_secret_access_key, options)
27
29
 
28
30
  @bucket_name = options[:default_bucket]
31
+ if @bucket_name.nil?
32
+ raise S33rException::MissingBucketName, "NamedBucket cannot be initialised without specifying\
33
+ a :default_bucket option"
34
+ end
29
35
 
30
36
  # holds a BucketListing instance
31
37
  @bucket_listing = nil
@@ -35,8 +41,8 @@ module S33r
35
41
  @client_headers.merge!(canned_acl_header('public-read')) if @public_contents
36
42
 
37
43
  @strict = (true == options[:strict])
38
- if ((@strict && !bucket_exists?(@bucket_name)) || @bucket_name.nil?)
39
- raise S33rException::MissingResource, "The specified bucket name #{@bucket_name} does not exist or is invalid"
44
+ if @strict && !bucket_exists?(@bucket_name)
45
+ raise S33rException::MissingResource, "Non-existent bucket #{@bucket_name} specified"
40
46
  end
41
47
 
42
48
  yield self if block_given?
@@ -63,6 +69,17 @@ module S33r
63
69
  @bucket_listing
64
70
  end
65
71
 
72
+ # Does this bucket exist?
73
+ # Returns true if the bucket this NamedBucket is mapped to exists.
74
+ def exists?
75
+ bucket_exists?(@bucket_name)
76
+ end
77
+
78
+ # Delete the bucket.
79
+ def destroy(headers={}, options={})
80
+ delete_bucket(@bucket_name, headers, options)
81
+ end
82
+
66
83
  # Get a pretty list of the keys in the bucket.
67
84
  def keys
68
85
  listing.pretty
@@ -73,10 +90,10 @@ module S33r
73
90
  listing.contents.each_value { |item| item.named_bucket = self; yield item }
74
91
  end
75
92
 
76
- # Does this bucket exist?
77
- # Returns true if the bucket this NamedBucket is mapped to exists.
78
- def exists?
79
- bucket_exists?(@bucket_name)
93
+ # Does the given key exist in the bucket?
94
+ # Returns boolean
95
+ def key_exists?(key)
96
+ head_resource(@bucket_name, key).ok?
80
97
  end
81
98
 
82
99
  # Put a string into a key inside the bucket.
@@ -89,23 +106,18 @@ module S33r
89
106
  super(filename, @bucket_name, resource_key, headers, options)
90
107
  end
91
108
 
92
- # Put a generic resource (e.g. from a data stream) into the bucket.
109
+ # Put a generic stream (e.g. from a file handle) into the bucket.
93
110
  def put_stream(data, resource_key, headers={})
94
111
  put_resource(@bucket_name, resource_key, data, headers)
95
112
  end
96
113
 
97
- # Delete the bucket.
98
- def delete(headers={}, options={})
99
- delete_bucket(@bucket_name, headers, options)
100
- end
101
-
102
114
  # Delete an object from the bucket.
103
- #
104
- # Returns boolean (true = deletion worked OK).
105
- def delete_key(resource_key, headers={})
106
- response = delete_resource(@bucket_name, resource_key, headers)
115
+ # NB S3 doesn't discriminate between successfully deleting a key
116
+ # and trying to delete a non-existent key (both return a 204).
117
+ # If you want to test for existence first, use key_exists?.
118
+ def delete_resource(resource_key, headers={})
119
+ super(@bucket_name, resource_key, headers)
107
120
  listing
108
- response.ok?
109
121
  end
110
122
 
111
123
  # Generate an authenticated URL (see http://docs.amazonwebservices.com/AmazonS3/2006-03-01/)
@@ -15,6 +15,9 @@ module S33r
15
15
 
16
16
  class MalformedBucketName < Exception
17
17
  end
18
+
19
+ class MissingBucketName < Exception
20
+ end
18
21
 
19
22
  class MissingResource < Exception
20
23
  end
@@ -24,6 +27,9 @@ module S33r
24
27
 
25
28
  class InvalidBucketListing < Exception
26
29
  end
30
+
31
+ class S3FallenOver < Exception
32
+ end
27
33
 
28
34
  end
29
35
  end
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require File.join(File.dirname(__FILE__), 's33r_exception')
2
3
 
3
4
  # Addtions to the Net::HTTP classes
4
5
 
@@ -6,6 +7,11 @@ require 'net/http'
6
7
  class Net::HTTPResponse
7
8
  attr_accessor :success
8
9
  attr_writer :body
10
+
11
+ def check_s3_availability
12
+ raise S33rException::S3FallenOver, "S3 has fallen over! (got a #{code} code in response)" \
13
+ if (500..503).include? code.to_i
14
+ end
9
15
 
10
16
  def ok?
11
17
  success
@@ -3,7 +3,7 @@ module S33r
3
3
  # Aim is to enable s33r to compare files on the filesystem to S3 objects.
4
4
  module Sync
5
5
 
6
- # Get the MD5 checksum for a file (comparable to the ETag on S3 objects).
6
+ # Get the MD5 checksum for a local file (comparable to the ETag on S3 objects).
7
7
  def md5sum(filename)
8
8
  f = File.open(filename).binmode
9
9
  OpenSSL::Digest::MD5.hexdigest(f.read)
@@ -78,7 +78,7 @@ context 'S33r bucket listing' do
78
78
  obj.etag.should_equal '24ce59274b89287b3960c184153ac24b'
79
79
  end
80
80
 
81
- specify 'should be able to build a full representation given full object XML from GET on resource key' do
81
+ specify 'should build a full S3Object representation when given XML from a GET on a resource key' do
82
82
  todo
83
83
  end
84
84