s33r 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/examples/cli/simple.rb +17 -0
  2. data/examples/fores33r/app/controllers/browser_controller.rb +32 -8
  3. data/examples/fores33r/app/views/browser/_create_bucket.rhtml +6 -0
  4. data/examples/fores33r/app/views/browser/_upload.rhtml +5 -0
  5. data/examples/fores33r/app/views/browser/index.rhtml +1 -8
  6. data/examples/fores33r/app/views/browser/plain_bucket.rhtml +3 -0
  7. data/examples/fores33r/app/views/browser/s3_index.rhtml +9 -0
  8. data/examples/fores33r/app/views/browser/show_bucket.rhtml +6 -8
  9. data/examples/fores33r/app/views/layouts/application.rhtml +2 -0
  10. data/examples/fores33r/app/views/layouts/s3_layout.rhtml +14 -0
  11. data/examples/fores33r/config/environment.rb +1 -1
  12. data/examples/fores33r/config/routes.rb +2 -0
  13. data/examples/fores33r/public/stylesheets/core.css +2 -2
  14. data/html/classes/Net/HTTPResponse.html +3 -0
  15. data/html/classes/S33r.html +127 -116
  16. data/html/classes/S33r/BucketListing.html +119 -94
  17. data/html/classes/S33r/Client.html +602 -536
  18. data/html/classes/S33r/LoggingResource.html +3 -3
  19. data/html/classes/S33r/NamedBucket.html +235 -191
  20. data/html/classes/S33r/OrderlyXmlMarkup.html +7 -7
  21. data/html/classes/S33r/S33rException.html +1 -0
  22. data/html/classes/S33r/S33rException/TryingToPutEmptyResource.html +117 -0
  23. data/html/classes/S33r/S3ACL/ACLDoc.html +94 -94
  24. data/html/classes/S33r/S3ACL/AmazonCustomer.html +5 -5
  25. data/html/classes/S33r/S3ACL/CanonicalUser.html +12 -12
  26. data/html/classes/S33r/S3ACL/Grant.html +64 -64
  27. data/html/classes/S33r/S3ACL/Grantee.html +36 -36
  28. data/html/classes/S33r/S3ACL/Group.html +8 -8
  29. data/html/classes/S33r/S3Object.html +387 -79
  30. data/html/classes/XML.html +15 -15
  31. data/html/created.rid +1 -1
  32. data/html/files/CHANGELOG.html +7 -1
  33. data/html/files/MIT-LICENSE.html +1 -1
  34. data/html/files/README_txt.html +3 -7
  35. data/html/files/lib/s33r/bucket_listing_rb.html +1 -9
  36. data/html/files/lib/s33r/builder_rb.html +1 -1
  37. data/html/files/lib/s33r/client_rb.html +1 -1
  38. data/html/files/lib/s33r/core_rb.html +1 -2
  39. data/html/files/lib/s33r/libxml_extensions_rb.html +1 -7
  40. data/html/files/lib/s33r/libxml_loader_rb.html +109 -0
  41. data/html/files/lib/s33r/logging_rb.html +1 -2
  42. data/html/files/lib/s33r/mimetypes_rb.html +1 -1
  43. data/html/files/lib/s33r/named_bucket_rb.html +1 -1
  44. data/html/files/lib/s33r/s33r_exception_rb.html +1 -1
  45. data/html/files/lib/s33r/s33r_http_rb.html +1 -1
  46. data/html/files/lib/s33r/s3_acl_rb.html +1 -2
  47. data/html/files/lib/s33r/s3_obj_rb.html +108 -0
  48. data/html/files/lib/s33r/sync_rb.html +1 -1
  49. data/html/files/lib/s33r_rb.html +1 -1
  50. data/html/fr_class_index.html +1 -0
  51. data/html/fr_file_index.html +2 -0
  52. data/html/fr_method_index.html +80 -71
  53. data/lib/s33r/bucket_listing.rb +30 -55
  54. data/lib/s33r/client.rb +70 -28
  55. data/lib/s33r/core.rb +9 -4
  56. data/lib/s33r/libxml_extensions.rb +2 -0
  57. data/lib/s33r/libxml_loader.rb +6 -0
  58. data/lib/s33r/logging.rb +3 -3
  59. data/lib/s33r/named_bucket.rb +33 -15
  60. data/lib/s33r/s33r_exception.rb +4 -0
  61. data/lib/s33r/s33r_http.rb +1 -1
  62. data/lib/s33r/s3_acl.rb +3 -2
  63. data/lib/s33r/s3_obj.rb +186 -0
  64. data/test/cases/spec_bucket_listing.rb +9 -33
  65. data/test/cases/spec_s3_object.rb +35 -0
  66. data/test/files/suspect_bucket_listing.xml +19 -0
  67. metadata +94 -89
  68. data/examples/fores33r/log/development.log +0 -5960
  69. data/examples/fores33r/log/production.log +0 -0
  70. data/examples/fores33r/log/server.log +0 -0
  71. data/examples/fores33r/log/test.log +0 -0
  72. data/examples/fores33r/tmp/sessions/ruby_sess.2ea325f604aa5fb9 +0 -0
  73. data/examples/fores33r/tmp/sessions/ruby_sess.39d37e054d21d545 +0 -0
  74. data/examples/fores33r/tmp/sessions/ruby_sess.acf71fc73aa74983 +0 -0
  75. data/examples/fores33r/tmp/sessions/ruby_sess.c1697b7d6670f3cd +0 -0
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # Simple client for uploading individual files from the command line
3
+ require 'rubygems'
4
+ require 's33r'
5
+
6
+ local_file = ARGV[0]
7
+ base_name = File.basename(local_file)
8
+ bucket = ARGV[1]
9
+
10
+ puts "Uploading #{local_file} as '#{base_name}' to '#{bucket}'"
11
+
12
+ S33r::NamedBucket.new('accesskey', 'secretaccesskey',
13
+ :default_bucket => bucket) do |client|
14
+ client.put_file(local_file, base_name)
15
+ end
16
+
17
+ puts "Uploaded!"
@@ -1,5 +1,6 @@
1
1
  class BrowserController < ApplicationController
2
2
  before_filter :get_s3_client
3
+ before_filter :get_bucket_listing, :only => ['show_bucket', 'plain_bucket', 'add_index']
3
4
 
4
5
  def get_s3_client
5
6
  @s3 = S3_CLIENT
@@ -8,17 +9,27 @@ class BrowserController < ApplicationController
8
9
 
9
10
  def index
10
11
  @buckets = @s3.list_buckets
12
+ @options_pane = 'create_bucket'
11
13
  end
12
14
 
13
15
  def show_bucket
14
- @bucket_name = params[:bucket_name]
15
- resp, listing = @s3.list_bucket(@bucket_name)
16
- if resp.ok?
17
- @keys = listing.pretty
18
- else
19
- flash[:notice] = "Bucket listing could not be retrieved"
20
- redirect_to :action => 'index'
21
- end
16
+ @options_pane = 'upload'
17
+ end
18
+
19
+ # Show bucket content as links in plain text.
20
+ def plain_bucket
21
+ response.headers['Content-Type'] = 'text/plain'
22
+ response.headers['Content-Disposition'] = 'attachment'
23
+ render :action => 'plain_bucket', :layout => false
24
+ end
25
+
26
+ # Add an S3 index page to the bucket (puts an HTML file index.html
27
+ # into the S3 bucket, with authenticated links to the bucket content).
28
+ def add_index
29
+ out = render(:action => 's3_index', :layout => 's3_layout')
30
+ @s3.put_resource(@bucket_name, 'index.html', out, {'Content-Type' => 'text/html'})
31
+ flash[:notice] = 'Added an index to the bucket'
32
+ response.redirect url_for(:action => 'show_bucket', :bucket_name => @bucket_name)
22
33
  end
23
34
 
24
35
  # NB this doesn't check whether the thing being deleted exists;
@@ -70,4 +81,17 @@ class BrowserController < ApplicationController
70
81
  end
71
82
  redirect_to :action => 'index'
72
83
  end
84
+
85
+ private
86
+ def get_bucket_listing
87
+ @bucket_name = params[:bucket_name]
88
+ resp, listing = @s3.list_bucket(@bucket_name)
89
+ if resp.ok?
90
+ @keys = listing.pretty
91
+ @objects = listing.contents
92
+ else
93
+ flash[:notice] = "Bucket listing could not be retrieved"
94
+ redirect_to :action => 'index'
95
+ end
96
+ end
73
97
  end
@@ -0,0 +1,6 @@
1
+ <%= start_form_tag :action => 'create_bucket' %>
2
+ <p>Create a new bucket: <%= text_field 'bucket', 'name' %></p>
3
+ <p>Use your default bucket prefix (<strong><%= @default_prefix %></strong>)?
4
+ <%= check_box_tag 'bucket[prefix]', 1, true %></p>
5
+ <p><%= submit_tag 'Create' %></p>
6
+ <%= end_form_tag %>
@@ -0,0 +1,5 @@
1
+ <%= start_form_tag({:action => 'upload'}, :multipart => true) %>
2
+ <%= hidden_field 'upload', 'bucket_name', :value => @bucket_name %>
3
+ <p>Upload a file to this bucket:<br /><%= file_field('upload', 'filename') %></p>
4
+ <p><%= submit_tag 'Upload' %></p>
5
+ <%= end_form_tag %>
@@ -8,11 +8,4 @@
8
8
  :bucket_name => bucket.name %> | <%= link_to 'delete', {:action => 'delete', :bucket_name => bucket.name},
9
9
  :confirm => 'Are you sure you want to delete this bucket?' %></p>
10
10
  <% end %>
11
- <% end %>
12
-
13
- <%= start_form_tag :action => 'create_bucket' %>
14
- <p>Create a new bucket: <%= text_field 'bucket', 'name' %></p>
15
- <p>Use your default bucket prefix (<strong><%= @default_prefix %></strong>)?
16
- <%= check_box_tag 'bucket[prefix]', 1, true %></p>
17
- <p><%= submit_tag 'Create' %></p>
18
- <%= end_form_tag %>
11
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <% for key in @keys do -%>
2
+ <%= authenticated_url(@bucket_name, key) %>
3
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <h1>Contents of <%= @bucket_name %> bucket on S3</h1>
2
+
3
+ <% for key in @keys -%>
4
+ <% obj = @objects[key] -%>
5
+ <% size = " (#{human_size(obj.size)})" -%>
6
+ <% unless 'index.html' == key -%>
7
+ <%= content_tag 'p', link_to(key, authenticated_url(@bucket_name, key)) + size %>
8
+ <% end %>
9
+ <% end -%>
@@ -1,14 +1,12 @@
1
1
  <h2>Content of bucket <em><%= @bucket_name %></em></h2>
2
2
 
3
+ <p>[ <%= link_to 'Authenticated URLs for bucket contents as plain text',
4
+ :action => 'plain_bucket', :bucket_name => @bucket_name %> |
5
+ <%= link_to 'Add index to bucket', :action => 'add_index', :bucket_name => @bucket_name %> ]</p>
6
+
3
7
  <% for key in @keys do %>
4
- <p><%= link_to key, authenticated_url(@bucket_name, key) %>&nbsp;|&nbsp;
8
+ <p><%= link_to key, authenticated_url(@bucket_name, key) %>&nbsp;|
5
9
  <%= link_to 'delete', {:action => 'delete', :bucket_name => @bucket_name,
6
10
  :resource_key => key}, :confirm => 'Are you sure you want to delete this resource?' %>
7
11
  </p>
8
- <% end %>
9
-
10
- <%= start_form_tag({:action => 'upload'}, :multipart => true) %>
11
- <%= hidden_field 'upload', 'bucket_name', :value => @bucket_name %>
12
- <p>Upload a file to this bucket: <%= file_field('upload', 'filename') %></p>
13
- <p><%= submit_tag 'Upload' %></p>
14
- <%= end_form_tag %>
12
+ <% end %>
@@ -14,6 +14,8 @@
14
14
 
15
15
  <div id="left_pane">
16
16
  <p><%= link_to 'Buckets', :controller => 'browser', :action => 'index' %></p>
17
+
18
+ <%= render :partial => @options_pane if @options_pane %>
17
19
  </div>
18
20
 
19
21
  <div id="main_pane">
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
5
+ <head>
6
+ <title>Contents of <%= @bucket_name %></title>
7
+ <%= stylesheet_link_tag 'core' %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= @content_for_layout %>
12
+
13
+ </body>
14
+ </html>
@@ -61,4 +61,4 @@ require File.join(RAILS_ROOT, '..', '..', 'lib', 's33r')
61
61
  ACCESS_KEY, SECRET_ACCESS_KEY, S3_OPTIONS =
62
62
  S33r::Client.load_config(File.join(RAILS_ROOT, 'config', 's3.yaml'))
63
63
 
64
- S3_CLIENT = S33r::Client.new(ACCESS_KEY, SECRET_ACCESS_KEY, S3_OPTIONS)
64
+ S3_CLIENT = S33r::Client.new(ACCESS_KEY, SECRET_ACCESS_KEY, S3_OPTIONS)
@@ -14,6 +14,8 @@ ActionController::Routing::Routes.draw do |map|
14
14
  map.connect '', :controller => 'browser'
15
15
 
16
16
  map.connect '/show_bucket/:bucket_name', :controller => 'browser', :action => 'show_bucket'
17
+ map.connect '/plain_bucket/:bucket_name/listing.txt', :controller => 'browser', :action => 'plain_bucket'
18
+ map.connect '/add_index/:bucket_name', :controller => 'browser', :action => 'add_index'
17
19
  map.connect '/delete/:bucket_name', :controller => 'browser', :action => 'delete'
18
20
  map.connect '/delete/:bucket_name/:resource_key', :controller => 'browser', :action => 'delete'
19
21
  map.connect '/create_bucket', :controller => 'browser', :action => 'create_bucket'
@@ -3,7 +3,7 @@
3
3
  }
4
4
  #left_pane {
5
5
  float: left;
6
- width: 20%;
6
+ width: 30%;
7
7
  background-color: #EEEEEE;
8
8
  font-size: 1em;
9
9
  }
@@ -12,7 +12,7 @@
12
12
  }
13
13
  #main_pane {
14
14
  float: right;
15
- width: 78%;
15
+ width: 68%;
16
16
  padding-left: 2%;
17
17
  }
18
18
  #main_pane h2 {
@@ -80,6 +80,9 @@
80
80
 
81
81
  <div id="description">
82
82
  <p>
83
+ Addtions to the Net::HTTP classes
84
+ </p>
85
+ <p>
83
86
  Adds some convenience functions for checking response status.
84
87
  </p>
85
88
 
@@ -55,40 +55,44 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../files/lib/s33r/sync_rb.html">
59
- lib/s33r/sync.rb
58
+ <a href="../files/lib/s33r/bucket_listing_rb.html">
59
+ lib/s33r/bucket_listing.rb
60
60
  </a>
61
61
  <br />
62
62
  <a href="../files/lib/s33r/client_rb.html">
63
63
  lib/s33r/client.rb
64
64
  </a>
65
65
  <br />
66
- <a href="../files/lib/s33r/builder_rb.html">
67
- lib/s33r/builder.rb
68
- </a>
69
- <br />
70
- <a href="../files/lib/s33r/bucket_listing_rb.html">
71
- lib/s33r/bucket_listing.rb
66
+ <a href="../files/lib/s33r/named_bucket_rb.html">
67
+ lib/s33r/named_bucket.rb
72
68
  </a>
73
69
  <br />
74
70
  <a href="../files/lib/s33r/s3_acl_rb.html">
75
71
  lib/s33r/s3_acl.rb
76
72
  </a>
77
73
  <br />
78
- <a href="../files/lib/s33r/core_rb.html">
79
- lib/s33r/core.rb
74
+ <a href="../files/lib/s33r/s3_obj_rb.html">
75
+ lib/s33r/s3_obj.rb
80
76
  </a>
81
77
  <br />
82
- <a href="../files/lib/s33r/named_bucket_rb.html">
83
- lib/s33r/named_bucket.rb
78
+ <a href="../files/lib/s33r/builder_rb.html">
79
+ lib/s33r/builder.rb
80
+ </a>
81
+ <br />
82
+ <a href="../files/lib/s33r/logging_rb.html">
83
+ lib/s33r/logging.rb
84
+ </a>
85
+ <br />
86
+ <a href="../files/lib/s33r/core_rb.html">
87
+ lib/s33r/core.rb
84
88
  </a>
85
89
  <br />
86
90
  <a href="../files/lib/s33r/s33r_exception_rb.html">
87
91
  lib/s33r/s33r_exception.rb
88
92
  </a>
89
93
  <br />
90
- <a href="../files/lib/s33r/logging_rb.html">
91
- lib/s33r/logging.rb
94
+ <a href="../files/lib/s33r/sync_rb.html">
95
+ lib/s33r/sync.rb
92
96
  </a>
93
97
  <br />
94
98
  </td>
@@ -374,13 +378,13 @@ Returns a hash with &#8216;symbolised&#8217; keys.
374
378
  onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
375
379
  <div class="method-source-code" id="M000056-source">
376
380
  <pre>
377
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 255</span>
378
- 255: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">keys_to_symbols</span>(<span class="ruby-identifier">hsh</span>)
379
- 256: <span class="ruby-identifier">symbolised</span> = <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">symbolised</span>, <span class="ruby-identifier">key_value</span><span class="ruby-operator">|</span>
380
- 257: <span class="ruby-identifier">symbolised</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-identifier">key_value</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_sym</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key_value</span>[<span class="ruby-value">1</span>]})
381
- 258: <span class="ruby-keyword kw">end</span>
382
- 259: <span class="ruby-identifier">symbolised</span>
383
- 260: <span class="ruby-keyword kw">end</span>
381
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 260</span>
382
+ 260: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">keys_to_symbols</span>(<span class="ruby-identifier">hsh</span>)
383
+ 261: <span class="ruby-identifier">symbolised</span> = <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">symbolised</span>, <span class="ruby-identifier">key_value</span><span class="ruby-operator">|</span>
384
+ 262: <span class="ruby-identifier">symbolised</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-identifier">key_value</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_sym</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key_value</span>[<span class="ruby-value">1</span>]})
385
+ 263: <span class="ruby-keyword kw">end</span>
386
+ 264: <span class="ruby-identifier">symbolised</span>
387
+ 265: <span class="ruby-keyword kw">end</span>
384
388
  </pre>
385
389
  </div>
386
390
  </div>
@@ -412,21 +416,21 @@ TODO: testing for this
412
416
  onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
413
417
  <div class="method-source-code" id="M000057-source">
414
418
  <pre>
415
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 270</span>
416
- 270: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">parse_expiry</span>(<span class="ruby-identifier">expires</span>)
417
- 271: <span class="ruby-identifier">base_expires</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
418
- 272: <span class="ruby-keyword kw">if</span> <span class="ruby-value str">'forever'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">expires</span>
419
- 273: <span class="ruby-comment cmt"># 20 years (same as forever in computer terms)</span>
420
- 274: <span class="ruby-identifier">expires</span> = <span class="ruby-identifier">base_expires</span> <span class="ruby-operator">+</span> (<span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span> <span class="ruby-operator">*</span> <span class="ruby-value">365.25</span> <span class="ruby-operator">*</span> <span class="ruby-value">20</span>).<span class="ruby-identifier">to_i</span>
421
- 275: <span class="ruby-keyword kw">elsif</span> <span class="ruby-value str">'default'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">expires</span>
422
- 276: <span class="ruby-comment cmt"># default to DEFAULT_EXPIRY_SECS seconds from now if expires not set</span>
423
- 277: <span class="ruby-identifier">expires</span> = <span class="ruby-identifier">base_expires</span> <span class="ruby-operator">+</span> <span class="ruby-constant">DEFAULT_EXPIRY_SECS</span>
424
- 278: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">expires</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
425
- 279: <span class="ruby-identifier">datetime_parts</span> = <span class="ruby-constant">ParseDate</span>.<span class="ruby-identifier">parsedate</span>(<span class="ruby-identifier">expires</span>)
426
- 280: <span class="ruby-identifier">expires</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">gm</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">datetime_parts</span>).<span class="ruby-identifier">to_i</span>
427
- 281: <span class="ruby-keyword kw">end</span>
428
- 282: <span class="ruby-identifier">expires</span>
429
- 283: <span class="ruby-keyword kw">end</span>
419
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 275</span>
420
+ 275: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">parse_expiry</span>(<span class="ruby-identifier">expires</span>)
421
+ 276: <span class="ruby-identifier">base_expires</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
422
+ 277: <span class="ruby-keyword kw">if</span> <span class="ruby-value str">'forever'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">expires</span>
423
+ 278: <span class="ruby-comment cmt"># 20 years (same as forever in computer terms)</span>
424
+ 279: <span class="ruby-identifier">expires</span> = <span class="ruby-identifier">base_expires</span> <span class="ruby-operator">+</span> (<span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">60</span> <span class="ruby-operator">*</span> <span class="ruby-value">24</span> <span class="ruby-operator">*</span> <span class="ruby-value">365.25</span> <span class="ruby-operator">*</span> <span class="ruby-value">20</span>).<span class="ruby-identifier">to_i</span>
425
+ 280: <span class="ruby-keyword kw">elsif</span> <span class="ruby-value str">'default'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">expires</span>
426
+ 281: <span class="ruby-comment cmt"># default to DEFAULT_EXPIRY_SECS seconds from now if expires not set</span>
427
+ 282: <span class="ruby-identifier">expires</span> = <span class="ruby-identifier">base_expires</span> <span class="ruby-operator">+</span> <span class="ruby-constant">DEFAULT_EXPIRY_SECS</span>
428
+ 283: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">expires</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
429
+ 284: <span class="ruby-identifier">datetime_parts</span> = <span class="ruby-constant">ParseDate</span>.<span class="ruby-identifier">parsedate</span>(<span class="ruby-identifier">expires</span>)
430
+ 285: <span class="ruby-identifier">expires</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">gm</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">datetime_parts</span>).<span class="ruby-identifier">to_i</span>
431
+ 286: <span class="ruby-keyword kw">end</span>
432
+ 287: <span class="ruby-identifier">expires</span>
433
+ 288: <span class="ruby-keyword kw">end</span>
430
434
  </pre>
431
435
  </div>
432
436
  </div>
@@ -450,11 +454,11 @@ response bodies (libxml isn&#8217;t fond of it).
450
454
  onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
451
455
  <div class="method-source-code" id="M000058-source">
452
456
  <pre>
453
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 287</span>
454
- 287: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">remove_namespace</span>(<span class="ruby-identifier">xml_in</span>)
455
- 288: <span class="ruby-identifier">namespace</span> = <span class="ruby-constant">RESPONSE_NAMESPACE_URI</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span>, <span class="ruby-value str">'\/'</span>)
456
- 289: <span class="ruby-identifier">xml_in</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/ xmlns=&quot;#{namespace}&quot;/</span>, <span class="ruby-value str">''</span>)
457
- 290: <span class="ruby-keyword kw">end</span>
457
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 292</span>
458
+ 292: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">remove_namespace</span>(<span class="ruby-identifier">xml_in</span>)
459
+ 293: <span class="ruby-identifier">namespace</span> = <span class="ruby-constant">S33r</span><span class="ruby-operator">::</span><span class="ruby-constant">RESPONSE_NAMESPACE_URI</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span>, <span class="ruby-value str">'\/'</span>)
460
+ 294: <span class="ruby-identifier">xml_in</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/ xmlns=&quot;#{namespace}&quot;/</span>, <span class="ruby-value str">''</span>)
461
+ 295: <span class="ruby-keyword kw">end</span>
458
462
  </pre>
459
463
  </div>
460
464
  </div>
@@ -519,12 +523,12 @@ Ensure that a bucket_name is well-formed (no leading or trailing slash).
519
523
  onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
520
524
  <div class="method-source-code" id="M000048-source">
521
525
  <pre>
522
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 190</span>
523
- 190: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bucket_name_valid?</span>(<span class="ruby-identifier">bucket_name</span>)
524
- 191: <span class="ruby-keyword kw">if</span> (<span class="ruby-value str">'/'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">bucket_name</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">bucket_name</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>])
525
- 192: <span class="ruby-identifier">raise</span> <span class="ruby-constant">S33rException</span><span class="ruby-operator">::</span><span class="ruby-constant">MalformedBucketName</span>, <span class="ruby-value str">&quot;Bucket name cannot have a leading or trailing slash&quot;</span>
526
- 193: <span class="ruby-keyword kw">end</span>
527
- 194: <span class="ruby-keyword kw">end</span>
526
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 195</span>
527
+ 195: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bucket_name_valid?</span>(<span class="ruby-identifier">bucket_name</span>)
528
+ 196: <span class="ruby-keyword kw">if</span> (<span class="ruby-value str">'/'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">bucket_name</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">bucket_name</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>])
529
+ 197: <span class="ruby-identifier">raise</span> <span class="ruby-constant">S33rException</span><span class="ruby-operator">::</span><span class="ruby-constant">MalformedBucketName</span>, <span class="ruby-value str">&quot;Bucket name cannot have a leading or trailing slash&quot;</span>
530
+ 198: <span class="ruby-keyword kw">end</span>
531
+ 199: <span class="ruby-keyword kw">end</span>
528
532
  </pre>
529
533
  </div>
530
534
  </div>
@@ -547,16 +551,16 @@ Add a canned ACL setter header.
547
551
  onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
548
552
  <div class="method-source-code" id="M000046-source">
549
553
  <pre>
550
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 171</span>
551
- 171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canned_acl_header</span>(<span class="ruby-identifier">canned_acl</span>, <span class="ruby-identifier">headers</span>={})
552
- 172: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">canned_acl</span>.<span class="ruby-identifier">nil?</span>
553
- 173: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">CANNED_ACLS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">canned_acl</span>)
554
- 174: <span class="ruby-identifier">raise</span> <span class="ruby-constant">S33rException</span><span class="ruby-operator">::</span><span class="ruby-constant">UnsupportedCannedACL</span>, <span class="ruby-node">&quot;The canned ACL #{canned_acl} is not supported&quot;</span>
555
- 175: <span class="ruby-keyword kw">end</span>
556
- 176: <span class="ruby-identifier">headers</span>[<span class="ruby-constant">AWS_HEADER_PREFIX</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'acl'</span>] = <span class="ruby-identifier">canned_acl</span>
557
- 177: <span class="ruby-keyword kw">end</span>
558
- 178: <span class="ruby-identifier">headers</span>
559
- 179: <span class="ruby-keyword kw">end</span>
554
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 176</span>
555
+ 176: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canned_acl_header</span>(<span class="ruby-identifier">canned_acl</span>, <span class="ruby-identifier">headers</span>={})
556
+ 177: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">canned_acl</span>.<span class="ruby-identifier">nil?</span>
557
+ 178: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">CANNED_ACLS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">canned_acl</span>)
558
+ 179: <span class="ruby-identifier">raise</span> <span class="ruby-constant">S33rException</span><span class="ruby-operator">::</span><span class="ruby-constant">UnsupportedCannedACL</span>, <span class="ruby-node">&quot;The canned ACL #{canned_acl} is not supported&quot;</span>
559
+ 180: <span class="ruby-keyword kw">end</span>
560
+ 181: <span class="ruby-identifier">headers</span>[<span class="ruby-constant">AWS_HEADER_PREFIX</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'acl'</span>] = <span class="ruby-identifier">canned_acl</span>
561
+ 182: <span class="ruby-keyword kw">end</span>
562
+ 183: <span class="ruby-identifier">headers</span>
563
+ 184: <span class="ruby-keyword kw">end</span>
560
564
  </pre>
561
565
  </div>
562
566
  </div>
@@ -683,14 +687,14 @@ variable can be a string or symbol.
683
687
  onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
684
688
  <div class="method-source-code" id="M000049-source">
685
689
  <pre>
686
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 198</span>
687
- 198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate_querystring</span>(<span class="ruby-identifier">pairs</span>={})
688
- 199: <span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
689
- 200: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pairs</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
690
- 201: <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;?&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">pairs</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{key}=#{CGI::escape(value.to_s)}&quot;</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&amp;'</span>)
691
- 202: <span class="ruby-keyword kw">end</span>
692
- 203: <span class="ruby-identifier">str</span>
693
- 204: <span class="ruby-keyword kw">end</span>
690
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 203</span>
691
+ 203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate_querystring</span>(<span class="ruby-identifier">pairs</span>={})
692
+ 204: <span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
693
+ 205: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pairs</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
694
+ 206: <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;?&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">pairs</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{key}=#{CGI::escape(value.to_s)}&quot;</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&amp;'</span>)
695
+ 207: <span class="ruby-keyword kw">end</span>
696
+ 208: <span class="ruby-identifier">str</span>
697
+ 209: <span class="ruby-keyword kw">end</span>
694
698
  </pre>
695
699
  </div>
696
700
  </div>
@@ -742,12 +746,12 @@ guessed, &quot;text/plain&quot; is used.
742
746
  onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
743
747
  <div class="method-source-code" id="M000047-source">
744
748
  <pre>
745
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 183</span>
746
- 183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">guess_mime_type</span>(<span class="ruby-identifier">file_name</span>)
747
- 184: <span class="ruby-identifier">mime_type</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Types</span>.<span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">file_name</span>)[<span class="ruby-value">0</span>]
748
- 185: <span class="ruby-identifier">mime_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Types</span>[<span class="ruby-value str">'text/plain'</span>][<span class="ruby-value">0</span>]
749
- 186: <span class="ruby-identifier">mime_type</span>
750
- 187: <span class="ruby-keyword kw">end</span>
749
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 188</span>
750
+ 188: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">guess_mime_type</span>(<span class="ruby-identifier">file_name</span>)
751
+ 189: <span class="ruby-identifier">mime_type</span> = <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Types</span>.<span class="ruby-identifier">type_for</span>(<span class="ruby-identifier">file_name</span>)[<span class="ruby-value">0</span>]
752
+ 190: <span class="ruby-identifier">mime_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">MIME</span><span class="ruby-operator">::</span><span class="ruby-constant">Types</span>[<span class="ruby-value str">'text/plain'</span>][<span class="ruby-value">0</span>]
753
+ 191: <span class="ruby-identifier">mime_type</span>
754
+ 192: <span class="ruby-keyword kw">end</span>
751
755
  </pre>
752
756
  </div>
753
757
  </div>
@@ -764,8 +768,15 @@ guessed, &quot;text/plain&quot; is used.
764
768
 
765
769
  <div class="method-description">
766
770
  <p>
767
- Add metadata headers, correctly prefixing them first.
771
+ Add metadata headers, correctly prefixing them first, e.g. you might do <a
772
+ href="S33r.html#M000045">metadata_headers</a>({}, {&#8216;myname&#8217;
773
+ =&gt; &#8216;elliot&#8217;, &#8216;myage&#8217; =&gt; 36}) to add two
774
+ headers to the request:
768
775
  </p>
776
+ <pre>
777
+ x-amz-meta-myname: elliot
778
+ x-amz-meta-myage: 36
779
+ </pre>
769
780
  <p>
770
781
  Returns headers with the metadata headers appended.
771
782
  </p>
@@ -773,13 +784,13 @@ Returns headers with the metadata headers appended.
773
784
  onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
774
785
  <div class="method-source-code" id="M000045-source">
775
786
  <pre>
776
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 163</span>
777
- 163: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metadata_headers</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">metadata</span>={})
778
- 164: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">metadata</span>.<span class="ruby-identifier">empty?</span>
779
- 165: <span class="ruby-identifier">metadata</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">headers</span>[<span class="ruby-constant">METADATA_PREFIX</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span> }
780
- 166: <span class="ruby-keyword kw">end</span>
781
- 167: <span class="ruby-identifier">headers</span>
782
- 168: <span class="ruby-keyword kw">end</span>
787
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 168</span>
788
+ 168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metadata_headers</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">metadata</span>={})
789
+ 169: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">metadata</span>.<span class="ruby-identifier">empty?</span>
790
+ 170: <span class="ruby-identifier">metadata</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">headers</span>[<span class="ruby-constant">METADATA_PREFIX</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span> }
791
+ 171: <span class="ruby-keyword kw">end</span>
792
+ 172: <span class="ruby-identifier">headers</span>
793
+ 173: <span class="ruby-keyword kw">end</span>
783
794
  </pre>
784
795
  </div>
785
796
  </div>
@@ -802,10 +813,10 @@ Return the location of the ACL for a resource.
802
813
  onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
803
814
  <div class="method-source-code" id="M000050-source">
804
815
  <pre>
805
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 207</span>
806
- 207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_acl_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
807
- 208: <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;?acl&quot;</span>
808
- 209: <span class="ruby-keyword kw">end</span>
816
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 212</span>
817
+ 212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_acl_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
818
+ 213: <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;?acl&quot;</span>
819
+ 214: <span class="ruby-keyword kw">end</span>
809
820
  </pre>
810
821
  </div>
811
822
  </div>
@@ -834,20 +845,20 @@ suitable value from a string.
834
845
  onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
835
846
  <div class="method-source-code" id="M000055-source">
836
847
  <pre>
837
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 238</span>
838
- 238: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_authenticated_url</span>(<span class="ruby-identifier">aws_access_key</span>, <span class="ruby-identifier">aws_secret_access_key</span>, <span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>,
839
- 239: <span class="ruby-identifier">expires</span>=<span class="ruby-keyword kw">nil</span>)
840
- 240: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
841
- 241: <span class="ruby-identifier">expires</span> = <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">parse_expiry</span>(<span class="ruby-identifier">expires</span>)
842
- 242:
843
- 243: <span class="ruby-identifier">canonical_string</span> = <span class="ruby-identifier">generate_canonical_string</span>(<span class="ruby-value str">'GET'</span>, <span class="ruby-identifier">path</span>, {}, <span class="ruby-identifier">expires</span>)
844
- 244: <span class="ruby-identifier">signature</span> = <span class="ruby-identifier">generate_signature</span>(<span class="ruby-identifier">aws_secret_access_key</span>, <span class="ruby-identifier">canonical_string</span>)
845
- 245:
846
- 246: <span class="ruby-identifier">querystring</span> = <span class="ruby-identifier">generate_querystring</span>({ <span class="ruby-value str">'Signature'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">signature</span>, <span class="ruby-value str">'Expires'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">expires</span>,
847
- 247: <span class="ruby-value str">'AWSAccessKeyId'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">aws_access_key</span> })
848
- 248:
849
- 249: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">querystring</span>
850
- 250: <span class="ruby-keyword kw">end</span>
848
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 243</span>
849
+ 243: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_authenticated_url</span>(<span class="ruby-identifier">aws_access_key</span>, <span class="ruby-identifier">aws_secret_access_key</span>, <span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>,
850
+ 244: <span class="ruby-identifier">expires</span>=<span class="ruby-keyword kw">nil</span>)
851
+ 245: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
852
+ 246: <span class="ruby-identifier">expires</span> = <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">parse_expiry</span>(<span class="ruby-identifier">expires</span>)
853
+ 247:
854
+ 248: <span class="ruby-identifier">canonical_string</span> = <span class="ruby-identifier">generate_canonical_string</span>(<span class="ruby-value str">'GET'</span>, <span class="ruby-identifier">path</span>, {}, <span class="ruby-identifier">expires</span>)
855
+ 249: <span class="ruby-identifier">signature</span> = <span class="ruby-identifier">generate_signature</span>(<span class="ruby-identifier">aws_secret_access_key</span>, <span class="ruby-identifier">canonical_string</span>)
856
+ 250:
857
+ 251: <span class="ruby-identifier">querystring</span> = <span class="ruby-identifier">generate_querystring</span>({ <span class="ruby-value str">'Signature'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">signature</span>, <span class="ruby-value str">'Expires'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">expires</span>,
858
+ 252: <span class="ruby-value str">'AWSAccessKeyId'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">aws_access_key</span> })
859
+ 253:
860
+ 254: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">querystring</span>
861
+ 255: <span class="ruby-keyword kw">end</span>
851
862
  </pre>
852
863
  </div>
853
864
  </div>
@@ -870,10 +881,10 @@ Return the location of the logging definition for a resource.
870
881
  onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
871
882
  <div class="method-source-code" id="M000051-source">
872
883
  <pre>
873
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 212</span>
874
- 212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_logging_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
875
- 213: <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;?logging&quot;</span>
876
- 214: <span class="ruby-keyword kw">end</span>
884
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 217</span>
885
+ 217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_logging_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
886
+ 218: <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;?logging&quot;</span>
887
+ 219: <span class="ruby-keyword kw">end</span>
877
888
  </pre>
878
889
  </div>
879
890
  </div>
@@ -896,12 +907,12 @@ Returns the path for this bucket and key.
896
907
  onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
897
908
  <div class="method-source-code" id="M000054-source">
898
909
  <pre>
899
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 228</span>
900
- 228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
901
- 229: <span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bucket_name</span>
902
- 230: <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">resource_key</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-value str">''</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">resource_key</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">resource_key</span>.<span class="ruby-identifier">nil?</span>
903
- 231: <span class="ruby-identifier">path</span>
904
- 232: <span class="ruby-keyword kw">end</span>
910
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 233</span>
911
+ 233: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
912
+ 234: <span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bucket_name</span>
913
+ 235: <span class="ruby-identifier">path</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">resource_key</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-value str">''</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">resource_key</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">resource_key</span>.<span class="ruby-identifier">nil?</span>
914
+ 236: <span class="ruby-identifier">path</span>
915
+ 237: <span class="ruby-keyword kw">end</span>
905
916
  </pre>
906
917
  </div>
907
918
  </div>
@@ -924,11 +935,11 @@ Public readable URL for a bucket and resource.
924
935
  onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
925
936
  <div class="method-source-code" id="M000053-source">
926
937
  <pre>
927
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 222</span>
928
- 222: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_public_url</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>=<span class="ruby-value str">''</span>)
929
- 223: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
930
- 224: <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>)
931
- 225: <span class="ruby-keyword kw">end</span>
938
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 227</span>
939
+ 227: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_public_url</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>=<span class="ruby-value str">''</span>)
940
+ 228: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">s3_path</span>(<span class="ruby-identifier">bucket_name</span>, <span class="ruby-identifier">resource_key</span>)
941
+ 229: <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>)
942
+ 230: <span class="ruby-keyword kw">end</span>
932
943
  </pre>
933
944
  </div>
934
945
  </div>
@@ -951,10 +962,10 @@ Prepend scheme and HOST to path.
951
962
  onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
952
963
  <div class="method-source-code" id="M000052-source">
953
964
  <pre>
954
- <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 217</span>
955
- 217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>)
956
- 218: <span class="ruby-value str">&quot;http://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">HOST</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>
957
- 219: <span class="ruby-keyword kw">end</span>
965
+ <span class="ruby-comment cmt"># File lib/s33r/core.rb, line 222</span>
966
+ 222: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">s3_url</span>(<span class="ruby-identifier">path</span>)
967
+ 223: <span class="ruby-value str">&quot;http://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">HOST</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>
968
+ 224: <span class="ruby-keyword kw">end</span>
958
969
  </pre>
959
970
  </div>
960
971
  </div>