fog 0.3.23 → 0.3.24

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fog (0.3.23)
4
+ fog (0.3.24)
5
5
  builder
6
6
  excon (>= 0.2.4)
7
7
  formatador (>= 0.0.16)
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.3.23'
11
- s.date = '2010-11-19'
10
+ s.version = '0.3.24'
11
+ s.date = '2010-11-22'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -274,6 +274,7 @@ Gem::Specification.new do |s|
274
274
  lib/fog/aws/requests/storage/put_bucket_logging.rb
275
275
  lib/fog/aws/requests/storage/put_bucket_versioning.rb
276
276
  lib/fog/aws/requests/storage/put_object.rb
277
+ lib/fog/aws/requests/storage/put_object_acl.rb
277
278
  lib/fog/aws/requests/storage/put_object_url.rb
278
279
  lib/fog/aws/requests/storage/put_request_payment.rb
279
280
  lib/fog/aws/requests/storage/upload_part.rb
data/lib/fog.rb CHANGED
@@ -18,7 +18,7 @@ module Fog
18
18
  @mocking = false
19
19
 
20
20
  unless const_defined?(:VERSION)
21
- VERSION = '0.3.23'
21
+ VERSION = '0.3.24'
22
22
  end
23
23
 
24
24
  module Mock
@@ -0,0 +1,93 @@
1
+ module Fog
2
+ module AWS
3
+ class Storage
4
+ class Real
5
+
6
+ # Change access control list for an S3 object
7
+ #
8
+ # ==== Parameters
9
+ # * bucket_name<~String> - name of bucket to modify
10
+ # * object_name<~String> - name of object to get access control list for
11
+ # * acl<~Hash>:
12
+ # * Owner<~Hash>:
13
+ # * ID<~String>: id of owner
14
+ # * DisplayName<~String>: display name of owner
15
+ # * AccessControlList<~Array>:
16
+ # * Grantee<~Hash>:
17
+ # * 'DisplayName'<~String> - Display name of grantee
18
+ # * 'ID'<~String> - Id of grantee
19
+ # or
20
+ # * 'EmailAddress'<~String> - Email address of grantee
21
+ # or
22
+ # * 'URI'<~String> - URI of group to grant access for
23
+ # * Permission<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
24
+ # * options<~Hash>:
25
+ # * 'versionId'<~String> - specify a particular version to retrieve
26
+ #
27
+ # ==== See Also
28
+ # http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUTacl.html
29
+
30
+ def put_object_acl(bucket_name, object_name, acl, options = {})
31
+ query = {'acl' => nil}
32
+ if version_id = options.delete('versionId')
33
+ query['versionId'] = version_id
34
+ end
35
+
36
+ data =
37
+ <<-DATA
38
+ <AccessControlPolicy>
39
+ <Owner>
40
+ <ID>#{acl['Owner']['ID']}</ID>
41
+ <DisplayName>#{acl['Owner']['DisplayName']}</DisplayName>
42
+ </Owner>
43
+ <AccessControlList>
44
+ DATA
45
+
46
+ acl['AccessControlList'].each do |grant|
47
+ data << " <Grant>"
48
+ type = case grant['Grantee'].keys.sort
49
+ when ['DisplayName', 'ID']
50
+ 'CanonicalUser'
51
+ when ['EmailAddress']
52
+ 'AmazonCustomerByEmail'
53
+ when ['URI']
54
+ 'Group'
55
+ end
56
+ data << " <Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"#{type}\">"
57
+ for key, value in grant['Grantee']
58
+ data << " <#{key}>#{value}</#{key}>"
59
+ end
60
+ data << " </Grantee>"
61
+ data << " <Permission>#{grant['Permission']}</Permission>"
62
+ data << " </Grant>"
63
+ end
64
+
65
+ data <<
66
+ <<-DATA
67
+ </AccessControlList>
68
+ </AccessControlPolicy>
69
+ DATA
70
+
71
+ request({
72
+ :body => data,
73
+ :expects => 200,
74
+ :headers => {},
75
+ :host => "#{bucket_name}.#{@host}",
76
+ :method => 'PUT',
77
+ :path => CGI.escape(object_name),
78
+ :query => query
79
+ })
80
+ end
81
+
82
+ end
83
+
84
+ class Mock # :nodoc:all
85
+
86
+ def put_object_acl(bucket_name, object_name, options, acl)
87
+ Fog::Mock.not_implemented
88
+ end
89
+
90
+ end
91
+ end
92
+ end
93
+ end
@@ -38,6 +38,7 @@ module Fog
38
38
  request :put_bucket_logging
39
39
  request :put_bucket_versioning
40
40
  request :put_object
41
+ request :put_object_acl
41
42
  request :put_object_url
42
43
  request :put_request_payment
43
44
  request :upload_part
@@ -30,24 +30,26 @@ module Fog
30
30
  yml = <<-YML
31
31
 
32
32
  :#{credential}:
33
- :aws_access_key_id: INTENTIONALLY_LEFT_BLANK
34
- :aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
35
- :bluebox_api_key: INTENTIONALLY_LEFT_BLANK
36
- :bluebox_customer_id: INTENTIONALLY_LEFT_BLANK
37
- :brightbox_client_id: INTENTIONALLY_LEFT_BLANK
38
- :brightbox_secret: INTENTIONALLY_LEFT_BLANK
39
- :go_grid_api_key: INTENTIONALLY_LEFT_BLANK
40
- :go_grid_shared_secret: INTENTIONALLY_LEFT_BLANK
41
- :local_root: INTENTIONALLY_LEFT_BLANK
42
- :new_servers_password: INTENTIONALLY_LEFT_BLANK
43
- :new_servers_username: INTENTIONALLY_LEFT_BLANK
44
- :public_key_path: INTENTIONALLY_LEFT_BLANK
45
- :private_key_path: INTENTIONALLY_LEFT_BLANK
46
- :rackspace_api_key: INTENTIONALLY_LEFT_BLANK
47
- :rackspace_username: INTENTIONALLY_LEFT_BLANK
48
- :slicehost_password: INTENTIONALLY_LEFT_BLANK
49
- :terremark_username: INTENTIONALLY_LEFT_BLANK
50
- :terremark_password: INTENTIONALLY_LEFT_BLANK
33
+ :aws_access_key_id: INTENTIONALLY_LEFT_BLANK
34
+ :aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
35
+ :bluebox_api_key: INTENTIONALLY_LEFT_BLANK
36
+ :bluebox_customer_id: INTENTIONALLY_LEFT_BLANK
37
+ :brightbox_client_id: INTENTIONALLY_LEFT_BLANK
38
+ :brightbox_secret: INTENTIONALLY_LEFT_BLANK
39
+ :go_grid_api_key: INTENTIONALLY_LEFT_BLANK
40
+ :go_grid_shared_secret: INTENTIONALLY_LEFT_BLANK
41
+ :google_storage_access_key_id: INTENTIONALLY_LEFT_BLANK
42
+ :google_storage_secret_access_key: INTENTIONALLY_LEFT_BLANK
43
+ :local_root: INTENTIONALLY_LEFT_BLANK
44
+ :new_servers_password: INTENTIONALLY_LEFT_BLANK
45
+ :new_servers_username: INTENTIONALLY_LEFT_BLANK
46
+ :public_key_path: INTENTIONALLY_LEFT_BLANK
47
+ :private_key_path: INTENTIONALLY_LEFT_BLANK
48
+ :rackspace_api_key: INTENTIONALLY_LEFT_BLANK
49
+ :rackspace_username: INTENTIONALLY_LEFT_BLANK
50
+ :slicehost_password: INTENTIONALLY_LEFT_BLANK
51
+ :terremark_username: INTENTIONALLY_LEFT_BLANK
52
+ :terremark_password: INTENTIONALLY_LEFT_BLANK
51
53
  YML
52
54
  print(yml)
53
55
  raise(ArgumentError.new("Missing Credentials"))
@@ -45,7 +45,11 @@ module Fog
45
45
  def save(options = {})
46
46
  requires :body, :directory, :key
47
47
  file = ::File.new(path, 'w')
48
- file.write(body)
48
+ if body.is_a?(String)
49
+ file.write(body)
50
+ else
51
+ file.write(body.read)
52
+ end
49
53
  file.close
50
54
  merge_attributes(
51
55
  :content_length => ::File.size(path),
@@ -1,12 +1,16 @@
1
+ __DIR__ = File.dirname(__FILE__)
2
+ __LIB_DIR__ = File.join(__DIR__, '../lib')
3
+
4
+ [ __DIR__, __LIB_DIR__ ].each do |directory|
5
+ $LOAD_PATH.unshift directory unless
6
+ $LOAD_PATH.include?(directory) ||
7
+ $LOAD_PATH.include?(File.expand_path(directory))
8
+ end
9
+
1
10
  require 'fog'
2
11
  require 'fog/core/bin'
3
- Fog.bin = true
4
-
5
- __DIR__ = File.dirname(__FILE__)
6
12
 
7
- $LOAD_PATH.unshift __DIR__ unless
8
- $LOAD_PATH.include?(__DIR__) ||
9
- $LOAD_PATH.include?(File.expand_path(__DIR__))
13
+ Fog.bin = true
10
14
 
11
15
  require 'tests/helpers/collection_tests'
12
16
  require 'tests/helpers/model_tests'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 23
9
- version: 0.3.23
8
+ - 24
9
+ version: 0.3.24
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-19 00:00:00 -08:00
17
+ date: 2010-11-22 00:00:00 -08:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -383,6 +383,7 @@ files:
383
383
  - lib/fog/aws/requests/storage/put_bucket_logging.rb
384
384
  - lib/fog/aws/requests/storage/put_bucket_versioning.rb
385
385
  - lib/fog/aws/requests/storage/put_object.rb
386
+ - lib/fog/aws/requests/storage/put_object_acl.rb
386
387
  - lib/fog/aws/requests/storage/put_object_url.rb
387
388
  - lib/fog/aws/requests/storage/put_request_payment.rb
388
389
  - lib/fog/aws/requests/storage/upload_part.rb