s33r 0.3.1 → 0.4

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 (120) hide show
  1. data/examples/cli/acl_x.rb +41 -0
  2. data/examples/cli/logging_x.rb +20 -0
  3. data/{bin → examples/cli}/s3cli.rb +13 -20
  4. data/examples/fores33r/README +183 -0
  5. data/examples/fores33r/Rakefile +10 -0
  6. data/examples/fores33r/app/controllers/application.rb +4 -0
  7. data/examples/fores33r/app/controllers/browser_controller.rb +68 -0
  8. data/examples/fores33r/app/helpers/application_helper.rb +8 -0
  9. data/examples/fores33r/app/views/browser/index.rhtml +14 -0
  10. data/examples/fores33r/app/views/browser/show_bucket.rhtml +14 -0
  11. data/examples/fores33r/app/views/layouts/application.rhtml +29 -0
  12. data/examples/fores33r/config/boot.rb +44 -0
  13. data/examples/fores33r/config/database.yml +35 -0
  14. data/examples/fores33r/config/environment.rb +64 -0
  15. data/examples/fores33r/config/environments/development.rb +21 -0
  16. data/examples/fores33r/config/environments/production.rb +18 -0
  17. data/examples/fores33r/config/environments/test.rb +19 -0
  18. data/examples/fores33r/config/routes.rb +23 -0
  19. data/examples/fores33r/doc/README_FOR_APP +2 -0
  20. data/examples/fores33r/log/development.log +5507 -0
  21. data/examples/fores33r/log/production.log +0 -0
  22. data/examples/fores33r/log/server.log +0 -0
  23. data/examples/fores33r/log/test.log +0 -0
  24. data/examples/fores33r/public/404.html +8 -0
  25. data/examples/fores33r/public/500.html +8 -0
  26. data/examples/fores33r/public/dispatch.cgi +10 -0
  27. data/examples/fores33r/public/dispatch.fcgi +24 -0
  28. data/examples/fores33r/public/dispatch.rb +10 -0
  29. data/examples/fores33r/public/favicon.ico +0 -0
  30. data/examples/fores33r/public/images/rails.png +0 -0
  31. data/examples/fores33r/public/javascripts/application.js +2 -0
  32. data/examples/fores33r/public/javascripts/controls.js +815 -0
  33. data/examples/fores33r/public/javascripts/dragdrop.js +913 -0
  34. data/examples/fores33r/public/javascripts/effects.js +958 -0
  35. data/examples/fores33r/public/javascripts/prototype.js +2006 -0
  36. data/examples/fores33r/public/robots.txt +1 -0
  37. data/examples/fores33r/public/stylesheets/core.css +37 -0
  38. data/examples/fores33r/script/about +3 -0
  39. data/examples/fores33r/script/breakpointer +3 -0
  40. data/examples/fores33r/script/console +3 -0
  41. data/examples/fores33r/script/destroy +3 -0
  42. data/examples/fores33r/script/generate +3 -0
  43. data/examples/fores33r/script/performance/benchmarker +3 -0
  44. data/examples/fores33r/script/performance/profiler +3 -0
  45. data/examples/fores33r/script/plugin +3 -0
  46. data/examples/fores33r/script/process/reaper +3 -0
  47. data/examples/fores33r/script/process/spawner +3 -0
  48. data/examples/fores33r/script/runner +3 -0
  49. data/examples/fores33r/script/server +3 -0
  50. data/examples/fores33r/test/test_helper.rb +28 -0
  51. data/examples/fores33r/tmp/sessions/ruby_sess.39d37e054d21d545 +0 -0
  52. data/examples/fores33r/tmp/sessions/ruby_sess.acf71fc73aa74983 +0 -0
  53. data/examples/fores33r/tmp/sessions/ruby_sess.c1697b7d6670f3cd +0 -0
  54. data/examples/s3.yaml +11 -0
  55. data/html/classes/Net/HTTPGenericRequest.html +32 -32
  56. data/html/classes/Net/HTTPResponse.html +20 -19
  57. data/html/classes/S33r.html +422 -190
  58. data/html/classes/S33r/BucketListing.html +107 -70
  59. data/html/classes/S33r/Client.html +888 -414
  60. data/html/classes/S33r/LoggingResource.html +222 -0
  61. data/html/classes/S33r/NamedBucket.html +149 -150
  62. data/html/classes/S33r/OrderlyXmlMarkup.html +165 -0
  63. data/html/classes/S33r/S33rException.html +3 -0
  64. data/html/classes/S33r/S33rException/BucketNotLogTargetable.html +119 -0
  65. data/html/classes/S33r/S33rException/InvalidPermission.html +111 -0
  66. data/html/classes/S33r/S33rException/InvalidS3GroupType.html +111 -0
  67. data/html/classes/S33r/S3ACL.html +125 -0
  68. data/html/classes/S33r/S3ACL/ACLDoc.html +521 -0
  69. data/html/classes/S33r/{S3User.html → S3ACL/AmazonCustomer.html} +27 -30
  70. data/html/classes/S33r/S3ACL/CanonicalUser.html +212 -0
  71. data/html/classes/S33r/S3ACL/Grant.html +403 -0
  72. data/html/classes/S33r/S3ACL/Grantee.html +239 -0
  73. data/html/classes/S33r/S3ACL/Group.html +178 -0
  74. data/html/classes/S33r/S3Object.html +53 -50
  75. data/html/classes/S33r/Sync.html +6 -6
  76. data/html/classes/XML.html +4 -2
  77. data/html/created.rid +1 -1
  78. data/html/files/README_txt.html +82 -28
  79. data/html/files/lib/s33r/bucket_listing_rb.html +1 -8
  80. data/html/files/lib/s33r/builder_rb.html +108 -0
  81. data/html/files/lib/s33r/client_rb.html +2 -1
  82. data/html/files/lib/s33r/core_rb.html +2 -1
  83. data/html/files/lib/s33r/libxml_extensions_rb.html +1 -1
  84. data/html/files/lib/s33r/logging_rb.html +109 -0
  85. data/html/files/lib/s33r/named_bucket_rb.html +1 -1
  86. data/html/files/lib/s33r/s33r_exception_rb.html +1 -1
  87. data/html/files/lib/s33r/s33r_http_rb.html +1 -1
  88. data/html/files/lib/s33r/s3_acl_rb.html +109 -0
  89. data/html/fr_class_index.html +12 -1
  90. data/html/fr_file_index.html +3 -0
  91. data/html/fr_method_index.html +101 -57
  92. data/lib/s33r/bucket_listing.rb +21 -22
  93. data/lib/s33r/builder.rb +20 -0
  94. data/lib/s33r/client.rb +240 -42
  95. data/lib/s33r/core.rb +106 -36
  96. data/lib/s33r/libxml_extensions.rb +2 -2
  97. data/lib/s33r/logging.rb +43 -0
  98. data/lib/s33r/named_bucket.rb +16 -17
  99. data/lib/s33r/s33r_exception.rb +11 -0
  100. data/lib/s33r/s33r_http.rb +2 -1
  101. data/lib/s33r/s3_acl.rb +337 -0
  102. data/test/cases/spec_acl.rb +146 -0
  103. data/test/cases/spec_all_buckets.rb +28 -0
  104. data/test/cases/spec_bucket_listing.rb +2 -2
  105. data/test/cases/spec_client.rb +45 -18
  106. data/test/cases/spec_core.rb +0 -9
  107. data/test/cases/spec_namedbucket.rb +3 -3
  108. data/test/files/acl.xml +47 -0
  109. data/test/files/acl_grant1.xml +7 -0
  110. data/test/files/acl_grant2.xml +6 -0
  111. data/test/files/acl_grant3.xml +6 -0
  112. data/test/files/acl_grant4.xml +6 -0
  113. data/test/files/all_buckets.xml +21 -0
  114. data/test/files/bucket_listing.xml +138 -1
  115. data/test/files/client_config.yml +0 -1
  116. data/test/files/logging_acl.xml +34 -0
  117. data/test/files/namedbucket_config.yml +1 -5
  118. data/test/files/namedbucket_config2.yml +1 -5
  119. data/test/test_setup.rb +1 -0
  120. metadata +132 -7
@@ -5,10 +5,10 @@
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
- <title>Class: S33r::S3User</title>
8
+ <title>Class: S33r::S3ACL::AmazonCustomer</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
12
  <script type="text/javascript">
13
13
  // <![CDATA[
14
14
 
@@ -50,13 +50,13 @@
50
50
  <table class="header-table">
51
51
  <tr class="top-aligned-row">
52
52
  <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S3User</td>
53
+ <td class="class-name-in-header">S33r::S3ACL::AmazonCustomer</td>
54
54
  </tr>
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/lib/s33r/bucket_listing_rb.html">
59
- lib/s33r/bucket_listing.rb
58
+ <a href="../../../files/lib/s33r/s3_acl_rb.html">
59
+ lib/s33r/s3_acl.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -65,7 +65,9 @@
65
65
  <tr class="top-aligned-row">
66
66
  <td><strong>Parent:</strong></td>
67
67
  <td>
68
- Object
68
+ <a href="Grantee.html">
69
+ Grantee
70
+ </a>
69
71
  </td>
70
72
  </tr>
71
73
  </table>
@@ -78,6 +80,12 @@
78
80
 
79
81
  <div id="contextContent">
80
82
 
83
+ <div id="description">
84
+ <p>
85
+ An Amazon customer for the purposes of assigning permissions.
86
+ </p>
87
+
88
+ </div>
81
89
 
82
90
 
83
91
  </div>
@@ -86,7 +94,7 @@
86
94
  <h3 class="section-bar">Methods</h3>
87
95
 
88
96
  <div class="name-list">
89
- <a href="#M000055">new</a>&nbsp;&nbsp;
97
+ <a href="#M000063">new</a>&nbsp;&nbsp;
90
98
  </div>
91
99
  </div>
92
100
 
@@ -107,12 +115,7 @@
107
115
  <div class="name-list">
108
116
  <table>
109
117
  <tr class="top-aligned-row context-row">
110
- <td class="context-item-name">display_name</td>
111
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
112
- <td class="context-item-desc"></td>
113
- </tr>
114
- <tr class="top-aligned-row context-row">
115
- <td class="context-item-name">id</td>
118
+ <td class="context-item-name">email_address</td>
116
119
  <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
117
120
  <td class="context-item-desc"></td>
118
121
  </tr>
@@ -126,31 +129,25 @@
126
129
  <div id="methods">
127
130
  <h3 class="section-bar">Public Class methods</h3>
128
131
 
129
- <div id="method-M000055" class="method-detail">
130
- <a name="M000055"></a>
132
+ <div id="method-M000063" class="method-detail">
133
+ <a name="M000063"></a>
131
134
 
132
135
  <div class="method-heading">
133
- <a href="#M000055" class="method-signature">
134
- <span class="method-name">new</span><span class="method-args">(owner_xml_doc)</span>
136
+ <a href="#M000063" class="method-signature">
137
+ <span class="method-name">new</span><span class="method-args">(email_address)</span>
135
138
  </a>
136
139
  </div>
137
140
 
138
141
  <div class="method-description">
139
- <p>
140
- <tt>owner_xml_doc</tt>: <a href="../XML/Document.html">XML::Document</a>
141
- instance, representing an &lt;Owner&gt; node from inside a ListBucketResult
142
- &lt;Contents&gt; element (see <a
143
- href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01">docs.amazonwebservices.com/AmazonS3/2006-03-01</a>/).
144
- </p>
145
142
  <p><a class="source-toggle" href="#"
146
- onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
147
- <div class="method-source-code" id="M000055-source">
143
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
144
+ <div class="method-source-code" id="M000063-source">
148
145
  <pre>
149
- <span class="ruby-comment cmt"># File lib/s33r/bucket_listing.rb, line 145</span>
150
- 145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">owner_xml_doc</span>)
151
- 146: <span class="ruby-ivar">@id</span> = <span class="ruby-identifier">owner_xml_doc</span>.<span class="ruby-identifier">xget</span>(<span class="ruby-value str">'//ID'</span>)
152
- 147: <span class="ruby-ivar">@display_name</span> = <span class="ruby-identifier">owner_xml_doc</span>.<span class="ruby-identifier">xget</span>(<span class="ruby-value str">'//DisplayName'</span>)
153
- 148: <span class="ruby-keyword kw">end</span>
146
+ <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 289</span>
147
+ 289: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">email_address</span>)
148
+ 290: <span class="ruby-ivar">@grantee_type</span> = <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:amazon_customer</span>]
149
+ 291: <span class="ruby-ivar">@email_address</span> = <span class="ruby-identifier">email_address</span>
150
+ 292: <span class="ruby-keyword kw">end</span>
154
151
  </pre>
155
152
  </div>
156
153
  </div>
@@ -0,0 +1,212 @@
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 312</span>
158
+ 312: <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
+ 313: <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
+ 314: <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
+ 315: <span class="ruby-identifier">new</span>(<span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">display_name</span>)
162
+ 316: <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 303</span>
190
+ 303: <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
+ 304: <span class="ruby-ivar">@grantee_type</span> = <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:canonical_user</span>]
192
+ 305: <span class="ruby-ivar">@user_id</span> = <span class="ruby-identifier">user_id</span>
193
+ 306: <span class="ruby-ivar">@display_name</span> = <span class="ruby-identifier">display_name</span>
194
+ 307: <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>
@@ -0,0 +1,403 @@
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 180</span>
168
+ 180: <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
+ 181: <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
+ 182: <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 184</span>
191
+ 184: <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
+ 185: <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
+ 186: <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 188</span>
214
+ 188: <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
+ 189: <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
+ 190: <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 202</span>
245
+ 202: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>
246
+ 203: <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
+ 204: [<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
+ 205: <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 166</span>
273
+ 166: <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
+ 167: <span class="ruby-ivar">@grantee</span> = <span class="ruby-identifier">grantee</span>
275
+ 168: <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
+ 169: <span class="ruby-ivar">@permission</span> = <span class="ruby-identifier">permission</span>
277
+ 170: <span class="ruby-keyword kw">else</span>
278
+ 171: <span class="ruby-ivar">@permission</span> = <span class="ruby-constant">PERMISSIONS</span>[<span class="ruby-identifier">permission</span>]
279
+ 172: <span class="ruby-keyword kw">end</span>
280
+ 173: <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
+ 174: <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 194</span>
306
+ 194: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>
307
+ 195: <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
+ 196: <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 231</span>
331
+ 231: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">obj</span>)
332
+ 232: <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
+ 233: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
334
+ 234: <span class="ruby-keyword kw">end</span>
335
+ 235: <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
+ 236: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
337
+ 237: <span class="ruby-keyword kw">end</span>
338
+ 238: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
339
+ 239: <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 208</span>
364
+ 208: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
365
+ 209: <span class="ruby-identifier">xml_str</span> = <span class="ruby-value str">&quot;&quot;</span>
366
+ 210: <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
+ 211:
368
+ 212: <span class="ruby-comment cmt"># &lt;Grant&gt; element.</span>
369
+ 213: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Grant</span> {
370
+ 214: <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
+ 215: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@grantee</span>.<span class="ruby-identifier">grantee_type</span>
372
+ 216: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:amazon_customer</span>]
373
+ 217: <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
+ 218: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:canonical_user</span>]
375
+ 219: <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
+ 220: <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
+ 221: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">GRANTEE_TYPES</span>[<span class="ruby-identifier">:group</span>]
378
+ 222: <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
+ 223: <span class="ruby-keyword kw">end</span>
380
+ 224: }
381
+ 225: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Permission</span> <span class="ruby-ivar">@permission</span>
382
+ 226: }
383
+ 227:
384
+ 228: <span class="ruby-identifier">xml_str</span>
385
+ 229: <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>