class Fog::Storage::InternetArchive::Mock
Public Class Methods
acls(type)
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 109 def self.acls(type) case type when 'private' { "AccessControlList" => [ { "Permission" => "FULL_CONTROL", "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} } ], "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} } when 'public-read' { "AccessControlList" => [ { "Permission" => "FULL_CONTROL", "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} }, { "Permission" => "READ", "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"} } ], "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} } when 'public-read-write' { "AccessControlList" => [ { "Permission" => "FULL_CONTROL", "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} }, { "Permission" => "READ", "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"} }, { "Permission" => "WRITE", "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AllUsers"} } ], "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} } when 'authenticated-read' { "AccessControlList" => [ { "Permission" => "FULL_CONTROL", "Grantee" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} }, { "Permission" => "READ", "Grantee" => {"URI" => "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"} } ], "Owner" => {"DisplayName" => "me", "ID" => "2744ccd10c7533bd736ad890f9dd5cab2adb27b07d500b9493f29cdc420cb2e0"} } end end
data()
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 170 def self.data @data ||= Hash.new do |hash, region| hash[region] = Hash.new do |region_hash, key| region_hash[key] = { :acls => { :bucket => {}, :object => {} }, :buckets => {}, :cors => { :bucket => {} } } end end end
new(options={})
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 191 def initialize(options={}) setup_credentials(options) options[:region] ||= 'us-east-1' @host = options[:host] || Fog::InternetArchive::API_DOMAIN_NAME @scheme = options[:scheme] || 'http' @region = options[:region] end
reset()
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 187 def self.reset @data = nil end
Public Instance Methods
data()
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 199 def data self.class.data[@region][@ia_access_key_id] end
put_bucket_acl(bucket_name, acl)
click to toggle source
# File lib/fog/storage/internet_archive/requests/put_bucket_acl.rb, line 56 def put_bucket_acl(bucket_name, acl) if acl.is_a?(Hash) self.data[:acls][:bucket][bucket_name] = Fog::Storage::InternetArchive.hash_to_acl(acl) else if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl) raise Excon::Errors::BadRequest.new('invalid x-amz-acl') end self.data[:acls][:bucket][bucket_name] = acl end end
put_bucket_cors(bucket_name, cors)
click to toggle source
# File lib/fog/storage/internet_archive/requests/put_bucket_cors.rb, line 41 def put_bucket_cors(bucket_name, cors) self.data[:cors][:bucket][bucket_name] = Fog::Storage::InternetArchive.hash_to_cors(cors) end
put_object_acl(bucket_name, object_name, acl, options = {})
click to toggle source
# File lib/fog/storage/internet_archive/requests/put_object_acl.rb, line 60 def put_object_acl(bucket_name, object_name, acl, options = {}) if acl.is_a?(Hash) self.data[:acls][:object][bucket_name][object_name] = Fog::Storage::InternetArchive.hash_to_acl(acl) else if !['private', 'public-read', 'public-read-write', 'authenticated-read'].include?(acl) raise Excon::Errors::BadRequest.new('invalid x-amz-acl') end self.data[:acls][:object][bucket_name][object_name] = acl end end
reset_data()
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 203 def reset_data self.class.data[@region].delete(@ia_access_key_id) end
setup_credentials(options)
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 211 def setup_credentials(options) @ia_access_key_id = options[:ia_access_key_id] @ia_secret_access_key = options[:ia_secret_access_key] @ia_session_token = options[:ia_session_token] @ia_credentials_expire_at = options[:ia_credentials_expire_at] end
signature(params)
click to toggle source
# File lib/fog/storage/internet_archive.rb, line 207 def signature(params) "foo" end