s33r 0.4.2 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/examples/cli/instant_download_server.rb +88 -0
  2. data/examples/cli/s3cli.rb +31 -52
  3. data/examples/cli/simple.rb +16 -6
  4. data/examples/fores33r/app/controllers/browser_controller.rb +12 -10
  5. data/examples/fores33r/app/helpers/application_helper.rb +2 -1
  6. data/examples/fores33r/app/views/browser/_upload.rhtml +1 -1
  7. data/examples/fores33r/app/views/browser/index.rhtml +4 -4
  8. data/examples/fores33r/config/environment.rb +5 -3
  9. data/examples/fores33r/log/development.log +2259 -0
  10. data/examples/fores33r/log/mongrel.log +59 -0
  11. data/examples/s3.yaml +2 -6
  12. data/lib/s33r/bucket.rb +103 -0
  13. data/lib/s33r/bucket_listing.rb +33 -76
  14. data/lib/s33r/client.rb +305 -446
  15. data/lib/s33r/networking.rb +197 -0
  16. data/lib/s33r/s33r_exception.rb +29 -18
  17. data/lib/s33r/s33r_http.rb +36 -18
  18. data/lib/s33r/s3_acl.rb +32 -52
  19. data/lib/s33r/s3_logging.rb +117 -0
  20. data/lib/s33r/s3_obj.rb +124 -69
  21. data/lib/s33r/utility.rb +447 -0
  22. data/test/cases/spec_acl.rb +10 -40
  23. data/test/cases/spec_bucket_listing.rb +12 -32
  24. data/test/cases/spec_logging.rb +47 -0
  25. data/test/cases/spec_networking.rb +11 -0
  26. data/test/cases/spec_s3_object.rb +44 -5
  27. data/test/cases/spec_utility.rb +264 -0
  28. data/test/files/acl.xml +0 -6
  29. data/test/files/config.yaml +5 -0
  30. data/test/files/logging_status_disabled.xml +3 -0
  31. data/test/files/logging_status_enabled.xml +7 -0
  32. data/test/test_setup.rb +7 -2
  33. metadata +16 -94
  34. data/examples/cli/acl_x.rb +0 -41
  35. data/examples/cli/logging_x.rb +0 -20
  36. data/examples/fores33r/README +0 -183
  37. data/html/classes/MIME.html +0 -120
  38. data/html/classes/MIME/InvalidContentType.html +0 -119
  39. data/html/classes/MIME/Type.html +0 -1173
  40. data/html/classes/MIME/Types.html +0 -566
  41. data/html/classes/Net.html +0 -108
  42. data/html/classes/Net/HTTPGenericRequest.html +0 -233
  43. data/html/classes/Net/HTTPResponse.html +0 -271
  44. data/html/classes/S33r.html +0 -986
  45. data/html/classes/S33r/BucketListing.html +0 -434
  46. data/html/classes/S33r/Client.html +0 -1575
  47. data/html/classes/S33r/LoggingResource.html +0 -222
  48. data/html/classes/S33r/NamedBucket.html +0 -693
  49. data/html/classes/S33r/OrderlyXmlMarkup.html +0 -165
  50. data/html/classes/S33r/S33rException.html +0 -124
  51. data/html/classes/S33r/S33rException/BucketListingMaxKeysError.html +0 -111
  52. data/html/classes/S33r/S33rException/BucketNotLogTargetable.html +0 -119
  53. data/html/classes/S33r/S33rException/InvalidBucketListing.html +0 -111
  54. data/html/classes/S33r/S33rException/InvalidPermission.html +0 -111
  55. data/html/classes/S33r/S33rException/InvalidS3GroupType.html +0 -111
  56. data/html/classes/S33r/S33rException/MalformedBucketName.html +0 -111
  57. data/html/classes/S33r/S33rException/MethodNotAvailable.html +0 -111
  58. data/html/classes/S33r/S33rException/MissingBucketName.html +0 -111
  59. data/html/classes/S33r/S33rException/MissingRequiredHeaders.html +0 -111
  60. data/html/classes/S33r/S33rException/MissingResource.html +0 -111
  61. data/html/classes/S33r/S33rException/S3FallenOver.html +0 -111
  62. data/html/classes/S33r/S33rException/TryingToPutEmptyResource.html +0 -117
  63. data/html/classes/S33r/S33rException/UnsupportedCannedACL.html +0 -111
  64. data/html/classes/S33r/S33rException/UnsupportedHTTPMethod.html +0 -111
  65. data/html/classes/S33r/S3ACL.html +0 -125
  66. data/html/classes/S33r/S3ACL/ACLDoc.html +0 -521
  67. data/html/classes/S33r/S3ACL/AmazonCustomer.html +0 -168
  68. data/html/classes/S33r/S3ACL/CanonicalUser.html +0 -212
  69. data/html/classes/S33r/S3ACL/Grant.html +0 -403
  70. data/html/classes/S33r/S3ACL/Grantee.html +0 -239
  71. data/html/classes/S33r/S3ACL/Group.html +0 -178
  72. data/html/classes/S33r/S3Object.html +0 -618
  73. data/html/classes/S33r/Sync.html +0 -152
  74. data/html/classes/XML.html +0 -202
  75. data/html/classes/XML/Document.html +0 -125
  76. data/html/classes/XML/Node.html +0 -124
  77. data/html/created.rid +0 -1
  78. data/html/files/CHANGELOG.html +0 -107
  79. data/html/files/MIT-LICENSE.html +0 -129
  80. data/html/files/README_txt.html +0 -259
  81. data/html/files/lib/s33r/bucket_listing_rb.html +0 -101
  82. data/html/files/lib/s33r/builder_rb.html +0 -108
  83. data/html/files/lib/s33r/client_rb.html +0 -111
  84. data/html/files/lib/s33r/core_rb.html +0 -113
  85. data/html/files/lib/s33r/libxml_extensions_rb.html +0 -101
  86. data/html/files/lib/s33r/libxml_loader_rb.html +0 -109
  87. data/html/files/lib/s33r/logging_rb.html +0 -108
  88. data/html/files/lib/s33r/mimetypes_rb.html +0 -120
  89. data/html/files/lib/s33r/named_bucket_rb.html +0 -101
  90. data/html/files/lib/s33r/s33r_exception_rb.html +0 -101
  91. data/html/files/lib/s33r/s33r_http_rb.html +0 -108
  92. data/html/files/lib/s33r/s3_acl_rb.html +0 -108
  93. data/html/files/lib/s33r/s3_obj_rb.html +0 -108
  94. data/html/files/lib/s33r/sync_rb.html +0 -101
  95. data/html/files/lib/s33r_rb.html +0 -101
  96. data/html/fr_class_index.html +0 -66
  97. data/html/fr_file_index.html +0 -44
  98. data/html/fr_method_index.html +0 -183
  99. data/html/index.html +0 -24
  100. data/html/rdoc-style.css +0 -208
  101. data/lib/s33r/core.rb +0 -296
  102. data/lib/s33r/logging.rb +0 -43
  103. data/lib/s33r/named_bucket.rb +0 -148
  104. data/lib/s33r/sync.rb +0 -13
  105. data/test/cases/spec_all_buckets.rb +0 -28
  106. data/test/cases/spec_client.rb +0 -101
  107. data/test/cases/spec_core.rb +0 -128
  108. data/test/cases/spec_namedbucket.rb +0 -46
  109. data/test/cases/spec_sync.rb +0 -34
  110. data/test/files/all_buckets.xml +0 -21
  111. data/test/files/client_config.yml +0 -5
  112. data/test/files/namedbucket_config.yml +0 -8
  113. data/test/files/namedbucket_config2.yml +0 -8
  114. data/test/test_bucket_setup.rb +0 -41
@@ -1,168 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S3ACL::AmazonCustomer</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S3ACL::AmazonCustomer</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s3_acl_rb.html">
59
- lib/s33r/s3_acl.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- <a href="Grantee.html">
69
- Grantee
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- An Amazon customer for the purposes of assigning permissions.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000063">new</a>&nbsp;&nbsp;
98
- </div>
99
- </div>
100
-
101
- </div>
102
-
103
-
104
- <!-- if includes -->
105
-
106
- <div id="section">
107
-
108
-
109
-
110
-
111
-
112
- <div id="attribute-list">
113
- <h3 class="section-bar">Attributes</h3>
114
-
115
- <div class="name-list">
116
- <table>
117
- <tr class="top-aligned-row context-row">
118
- <td class="context-item-name">email_address</td>
119
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
120
- <td class="context-item-desc"></td>
121
- </tr>
122
- </table>
123
- </div>
124
- </div>
125
-
126
-
127
-
128
- <!-- if method_list -->
129
- <div id="methods">
130
- <h3 class="section-bar">Public Class methods</h3>
131
-
132
- <div id="method-M000063" class="method-detail">
133
- <a name="M000063"></a>
134
-
135
- <div class="method-heading">
136
- <a href="#M000063" class="method-signature">
137
- <span class="method-name">new</span><span class="method-args">(email_address)</span>
138
- </a>
139
- </div>
140
-
141
- <div class="method-description">
142
- <p><a class="source-toggle" href="#"
143
- onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
144
- <div class="method-source-code" id="M000063-source">
145
- <pre>
146
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 290</span>
147
- 290: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">email_address</span>)
148
- 291: <span class="ruby-ivar">@grantee_type</span> = <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:amazon_customer</span>]
149
- 292: <span class="ruby-ivar">@email_address</span> = <span class="ruby-identifier">email_address</span>
150
- 293: <span class="ruby-keyword kw">end</span>
151
- </pre>
152
- </div>
153
- </div>
154
- </div>
155
-
156
-
157
- </div>
158
-
159
-
160
- </div>
161
-
162
-
163
- <div id="validator-badges">
164
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
165
- </div>
166
-
167
- </body>
168
- </html>
@@ -1,212 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S3ACL::CanonicalUser</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S3ACL::CanonicalUser</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s3_acl_rb.html">
59
- lib/s33r/s3_acl.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- <a href="Grantee.html">
69
- Grantee
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- An S3 user.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000062">from_xml</a>&nbsp;&nbsp;
98
- <a href="#M000061">new</a>&nbsp;&nbsp;
99
- </div>
100
- </div>
101
-
102
- </div>
103
-
104
-
105
- <!-- if includes -->
106
-
107
- <div id="section">
108
-
109
-
110
-
111
-
112
-
113
- <div id="attribute-list">
114
- <h3 class="section-bar">Attributes</h3>
115
-
116
- <div class="name-list">
117
- <table>
118
- <tr class="top-aligned-row context-row">
119
- <td class="context-item-name">display_name</td>
120
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
121
- <td class="context-item-desc"></td>
122
- </tr>
123
- <tr class="top-aligned-row context-row">
124
- <td class="context-item-name">user_id</td>
125
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
126
- <td class="context-item-desc"></td>
127
- </tr>
128
- </table>
129
- </div>
130
- </div>
131
-
132
-
133
-
134
- <!-- if method_list -->
135
- <div id="methods">
136
- <h3 class="section-bar">Public Class methods</h3>
137
-
138
- <div id="method-M000062" class="method-detail">
139
- <a name="M000062"></a>
140
-
141
- <div class="method-heading">
142
- <a href="#M000062" class="method-signature">
143
- <span class="method-name">from_xml</span><span class="method-args">(user_xml_doc)</span>
144
- </a>
145
- </div>
146
-
147
- <div class="method-description">
148
- <p>
149
- Create a user object from an <a href="../../XML.html">XML</a> fragment with
150
- ID and DisplayName elements. (Both ACL documents and bucket listings
151
- represent users this way.)
152
- </p>
153
- <p><a class="source-toggle" href="#"
154
- onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
155
- <div class="method-source-code" id="M000062-source">
156
- <pre>
157
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 313</span>
158
- 313: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">user_xml_doc</span>)
159
- 314: <span class="ruby-identifier">user_id</span> = <span class="ruby-identifier">user_xml_doc</span>.<span class="ruby-identifier">xget</span>(<span class="ruby-value str">'ID'</span>)
160
- 315: <span class="ruby-identifier">display_name</span> = <span class="ruby-identifier">user_xml_doc</span>.<span class="ruby-identifier">xget</span>(<span class="ruby-value str">'DisplayName'</span>)
161
- 316: <span class="ruby-identifier">new</span>(<span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">display_name</span>)
162
- 317: <span class="ruby-keyword kw">end</span>
163
- </pre>
164
- </div>
165
- </div>
166
- </div>
167
-
168
- <div id="method-M000061" class="method-detail">
169
- <a name="M000061"></a>
170
-
171
- <div class="method-heading">
172
- <a href="#M000061" class="method-signature">
173
- <span class="method-name">new</span><span class="method-args">(user_id, display_name)</span>
174
- </a>
175
- </div>
176
-
177
- <div class="method-description">
178
- <p>
179
- <tt>owner_xml_doc</tt>: <a href="../../XML/Document.html">XML::Document</a>
180
- or Node instance, representing an &lt;Owner&gt; node from inside a
181
- ListBucketResult &lt;Contents&gt; element (see <a
182
- href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01">docs.amazonwebservices.com/AmazonS3/2006-03-01</a>/)
183
- or an ACL &lt;<a href="Grantee.html">Grantee</a>&gt; element.
184
- </p>
185
- <p><a class="source-toggle" href="#"
186
- onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
187
- <div class="method-source-code" id="M000061-source">
188
- <pre>
189
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 304</span>
190
- 304: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">display_name</span>)
191
- 305: <span class="ruby-ivar">@grantee_type</span> = <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:canonical_user</span>]
192
- 306: <span class="ruby-ivar">@user_id</span> = <span class="ruby-identifier">user_id</span>
193
- 307: <span class="ruby-ivar">@display_name</span> = <span class="ruby-identifier">display_name</span>
194
- 308: <span class="ruby-keyword kw">end</span>
195
- </pre>
196
- </div>
197
- </div>
198
- </div>
199
-
200
-
201
- </div>
202
-
203
-
204
- </div>
205
-
206
-
207
- <div id="validator-badges">
208
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
209
- </div>
210
-
211
- </body>
212
- </html>
@@ -1,403 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S3ACL::Grant</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S3ACL::Grant</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s3_acl_rb.html">
59
- lib/s33r/s3_acl.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- Representation of an S3 <a href="Grant.html">Grant</a> (see <a
84
- href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingGrantees.html">docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingGrantees.html</a>).
85
- </p>
86
- <p>
87
- A <a href="Grant.html">Grant</a> consists of a <a
88
- href="Grantee.html">Grantee</a> and a permission they are to be assigned.
89
- </p>
90
-
91
- </div>
92
-
93
-
94
- </div>
95
-
96
- <div id="method-list">
97
- <h3 class="section-bar">Methods</h3>
98
-
99
- <div class="name-list">
100
- <a href="#M000084">==</a>&nbsp;&nbsp;
101
- <a href="#M000078">for_amazon_customer</a>&nbsp;&nbsp;
102
- <a href="#M000079">for_canonical_user</a>&nbsp;&nbsp;
103
- <a href="#M000080">for_group</a>&nbsp;&nbsp;
104
- <a href="#M000082">log_target_grants</a>&nbsp;&nbsp;
105
- <a href="#M000077">new</a>&nbsp;&nbsp;
106
- <a href="#M000081">public_read_grant</a>&nbsp;&nbsp;
107
- <a href="#M000083">to_xml</a>&nbsp;&nbsp;
108
- </div>
109
- </div>
110
-
111
- </div>
112
-
113
-
114
- <!-- if includes -->
115
-
116
- <div id="section">
117
-
118
-
119
-
120
-
121
-
122
- <div id="attribute-list">
123
- <h3 class="section-bar">Attributes</h3>
124
-
125
- <div class="name-list">
126
- <table>
127
- <tr class="top-aligned-row context-row">
128
- <td class="context-item-name">grantee</td>
129
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
130
- <td class="context-item-desc"></td>
131
- </tr>
132
- <tr class="top-aligned-row context-row">
133
- <td class="context-item-name">permission</td>
134
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
135
- <td class="context-item-desc"></td>
136
- </tr>
137
- </table>
138
- </div>
139
- </div>
140
-
141
-
142
-
143
- <!-- if method_list -->
144
- <div id="methods">
145
- <h3 class="section-bar">Public Class methods</h3>
146
-
147
- <div id="method-M000078" class="method-detail">
148
- <a name="M000078"></a>
149
-
150
- <div class="method-heading">
151
- <a href="#M000078" class="method-signature">
152
- <span class="method-name">for_amazon_customer</span><span class="method-args">(email_address, permission)</span>
153
- </a>
154
- </div>
155
-
156
- <div class="method-description">
157
- <p>
158
- Note that setting a grant for an Amazon customer is the same as setting a
159
- grant for the <a href="CanonicalUser.html">CanonicalUser</a> who owns the
160
- specified email address. So when you get the ACL back, it will actually
161
- contain a <a href="CanonicalUser.html">CanonicalUser</a> grant.
162
- </p>
163
- <p><a class="source-toggle" href="#"
164
- onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
165
- <div class="method-source-code" id="M000078-source">
166
- <pre>
167
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 181</span>
168
- 181: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">for_amazon_customer</span>(<span class="ruby-identifier">email_address</span>, <span class="ruby-identifier">permission</span>)
169
- 182: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">AmazonCustomer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">email_address</span>), <span class="ruby-identifier">permission</span>)
170
- 183: <span class="ruby-keyword kw">end</span>
171
- </pre>
172
- </div>
173
- </div>
174
- </div>
175
-
176
- <div id="method-M000079" class="method-detail">
177
- <a name="M000079"></a>
178
-
179
- <div class="method-heading">
180
- <a href="#M000079" class="method-signature">
181
- <span class="method-name">for_canonical_user</span><span class="method-args">(id, display_name, permission)</span>
182
- </a>
183
- </div>
184
-
185
- <div class="method-description">
186
- <p><a class="source-toggle" href="#"
187
- onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
188
- <div class="method-source-code" id="M000079-source">
189
- <pre>
190
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 185</span>
191
- 185: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">for_canonical_user</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">display_name</span>, <span class="ruby-identifier">permission</span>)
192
- 186: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">CanonicalUser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">display_name</span>), <span class="ruby-identifier">permission</span>)
193
- 187: <span class="ruby-keyword kw">end</span>
194
- </pre>
195
- </div>
196
- </div>
197
- </div>
198
-
199
- <div id="method-M000080" class="method-detail">
200
- <a name="M000080"></a>
201
-
202
- <div class="method-heading">
203
- <a href="#M000080" class="method-signature">
204
- <span class="method-name">for_group</span><span class="method-args">(group_type, permission)</span>
205
- </a>
206
- </div>
207
-
208
- <div class="method-description">
209
- <p><a class="source-toggle" href="#"
210
- onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
211
- <div class="method-source-code" id="M000080-source">
212
- <pre>
213
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 189</span>
214
- 189: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">for_group</span>(<span class="ruby-identifier">group_type</span>, <span class="ruby-identifier">permission</span>)
215
- 190: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Group</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">group_type</span>), <span class="ruby-identifier">permission</span>)
216
- 191: <span class="ruby-keyword kw">end</span>
217
- </pre>
218
- </div>
219
- </div>
220
- </div>
221
-
222
- <div id="method-M000082" class="method-detail">
223
- <a name="M000082"></a>
224
-
225
- <div class="method-heading">
226
- <a href="#M000082" class="method-signature">
227
- <span class="method-name">log_target_grants</span><span class="method-args">()</span>
228
- </a>
229
- </div>
230
-
231
- <div class="method-description">
232
- <p>
233
- Generator for a grant which gives the LogDelivery group write and read_acl
234
- permissions on a bucket.
235
- </p>
236
- <p>
237
- Returns an array with the two required <a href="Grant.html">Grant</a>
238
- instances.
239
- </p>
240
- <p><a class="source-toggle" href="#"
241
- onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
242
- <div class="method-source-code" id="M000082-source">
243
- <pre>
244
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 203</span>
245
- 203: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>
246
- 204: <span class="ruby-identifier">log_delivery_group</span> = <span class="ruby-constant">Group</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:log_delivery</span>)
247
- 205: [<span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">log_delivery_group</span>, <span class="ruby-identifier">:read_acl</span>), <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">log_delivery_group</span>, <span class="ruby-identifier">:write</span>)]
248
- 206: <span class="ruby-keyword kw">end</span>
249
- </pre>
250
- </div>
251
- </div>
252
- </div>
253
-
254
- <div id="method-M000077" class="method-detail">
255
- <a name="M000077"></a>
256
-
257
- <div class="method-heading">
258
- <a href="#M000077" class="method-signature">
259
- <span class="method-name">new</span><span class="method-args">(grantee, permission)</span>
260
- </a>
261
- </div>
262
-
263
- <div class="method-description">
264
- <p>
265
- permission: one of the keys in the PERMISSIONS hash or a raw permission
266
- string
267
- </p>
268
- <p><a class="source-toggle" href="#"
269
- onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
270
- <div class="method-source-code" id="M000077-source">
271
- <pre>
272
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 167</span>
273
- 167: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">grantee</span>, <span class="ruby-identifier">permission</span>)
274
- 168: <span class="ruby-ivar">@grantee</span> = <span class="ruby-identifier">grantee</span>
275
- 169: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">permission</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
276
- 170: <span class="ruby-ivar">@permission</span> = <span class="ruby-identifier">permission</span>
277
- 171: <span class="ruby-keyword kw">else</span>
278
- 172: <span class="ruby-ivar">@permission</span> = <span class="ruby-constant">PERMISSIONS</span>[<span class="ruby-identifier">permission</span>]
279
- 173: <span class="ruby-keyword kw">end</span>
280
- 174: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPermission</span>, <span class="ruby-node">&quot;Permission #{permission.to_s} is not a valid permission specifier&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@permission</span>.<span class="ruby-identifier">nil?</span>
281
- 175: <span class="ruby-keyword kw">end</span>
282
- </pre>
283
- </div>
284
- </div>
285
- </div>
286
-
287
- <div id="method-M000081" class="method-detail">
288
- <a name="M000081"></a>
289
-
290
- <div class="method-heading">
291
- <a href="#M000081" class="method-signature">
292
- <span class="method-name">public_read_grant</span><span class="method-args">()</span>
293
- </a>
294
- </div>
295
-
296
- <div class="method-description">
297
- <p>
298
- Generator for a <a href="Grant.html">Grant</a> which gives READ permissions
299
- to the AllUsers group type.
300
- </p>
301
- <p><a class="source-toggle" href="#"
302
- onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
303
- <div class="method-source-code" id="M000081-source">
304
- <pre>
305
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 195</span>
306
- 195: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>
307
- 196: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Group</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:all_users</span>), <span class="ruby-identifier">:read</span>)
308
- 197: <span class="ruby-keyword kw">end</span>
309
- </pre>
310
- </div>
311
- </div>
312
- </div>
313
-
314
- <h3 class="section-bar">Public Instance methods</h3>
315
-
316
- <div id="method-M000084" class="method-detail">
317
- <a name="M000084"></a>
318
-
319
- <div class="method-heading">
320
- <a href="#M000084" class="method-signature">
321
- <span class="method-name">==</span><span class="method-args">(obj)</span>
322
- </a>
323
- </div>
324
-
325
- <div class="method-description">
326
- <p><a class="source-toggle" href="#"
327
- onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
328
- <div class="method-source-code" id="M000084-source">
329
- <pre>
330
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 232</span>
331
- 232: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">obj</span>)
332
- 233: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Grant</span>)
333
- 234: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
334
- 235: <span class="ruby-keyword kw">end</span>
335
- 236: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">permission</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">permission</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">grantee</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">grantee</span>
336
- 237: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
337
- 238: <span class="ruby-keyword kw">end</span>
338
- 239: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
339
- 240: <span class="ruby-keyword kw">end</span>
340
- </pre>
341
- </div>
342
- </div>
343
- </div>
344
-
345
- <div id="method-M000083" class="method-detail">
346
- <a name="M000083"></a>
347
-
348
- <div class="method-heading">
349
- <a href="#M000083" class="method-signature">
350
- <span class="method-name">to_xml</span><span class="method-args">()</span>
351
- </a>
352
- </div>
353
-
354
- <div class="method-description">
355
- <p>
356
- Convert a <a href="Grant.html">Grant</a> object into an <a
357
- href="../../XML.html">XML</a> fragment.
358
- </p>
359
- <p><a class="source-toggle" href="#"
360
- onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
361
- <div class="method-source-code" id="M000083-source">
362
- <pre>
363
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 209</span>
364
- 209: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
365
- 210: <span class="ruby-identifier">xml_str</span> = <span class="ruby-value str">&quot;&quot;</span>
366
- 211: <span class="ruby-identifier">xml</span> = <span class="ruby-constant">S33r</span><span class="ruby-operator">::</span><span class="ruby-constant">OrderlyXmlMarkup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:target</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">xml_str</span>, <span class="ruby-identifier">:indent</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
367
- 212:
368
- 213: <span class="ruby-comment cmt"># &lt;Grant&gt; element.</span>
369
- 214: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Grant</span> {
370
- 215: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Grantee</span>({<span class="ruby-node">&quot;xmlns:#{NAMESPACE}&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">NAMESPACE_URI</span>, <span class="ruby-value str">&quot;xsi:type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">grantee_type</span>}) {
371
- 216: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">grantee_type</span>
372
- 217: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:amazon_customer</span>]
373
- 218: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">EmailAddress</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">email_address</span>
374
- 219: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:canonical_user</span>]
375
- 220: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">ID</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">user_id</span>
376
- 221: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">DisplayName</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">display_name</span>
377
- 222: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:group</span>]
378
- 223: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">URI</span> <span class="ruby-constant">GROUP_ACL_URI_BASE</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">group_type</span>
379
- 224: <span class="ruby-keyword kw">end</span>
380
- 225: }
381
- 226: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Permission</span> <span class="ruby-ivar">@permission</span>
382
- 227: }
383
- 228:
384
- 229: <span class="ruby-identifier">xml_str</span>
385
- 230: <span class="ruby-keyword kw">end</span>
386
- </pre>
387
- </div>
388
- </div>
389
- </div>
390
-
391
-
392
- </div>
393
-
394
-
395
- </div>
396
-
397
-
398
- <div id="validator-badges">
399
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
400
- </div>
401
-
402
- </body>
403
- </html>