Class: Attached::Storage::Rackspace

Inherits:
Fog
  • Object
show all
Defined in:
lib/attached/storage/rackspace.rb

Instance Attribute Summary collapse

Attributes inherited from Fog

#defaults

Instance Method Summary collapse

Methods inherited from Fog

#destroy, #retrieve, #save

Methods inherited from Base

#destroy, #options, #parse, #retrieve, #save

Constructor Details

#initialize(credentials) ⇒ Rackspace

Create a new interface supporting save and destroy operations.

Usage:

Attached::Storage::Rackspace.new()
Attached::Storage::Rackspace.new("rackspace.yml")


19
20
21
22
23
24
25
26
# File 'lib/attached/storage/rackspace.rb', line 19

def initialize(credentials)
  super
  credentials = parse(credentials)
  @container    = credentials[:container] || credentials['container']
  @username     = credentials[:username]  || credentials['username']
  @api_key      = credentials[:api_key]   || credentials['api_key']
  raise "'container' must be specified if using 'rackspace' for storage" unless @container
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



10
11
12
# File 'lib/attached/storage/rackspace.rb', line 10

def api_key
  @api_key
end

#containerObject (readonly)

Returns the value of attribute container.



8
9
10
# File 'lib/attached/storage/rackspace.rb', line 8

def container
  @container
end

#usernameObject (readonly)

Returns the value of attribute username.



9
10
11
# File 'lib/attached/storage/rackspace.rb', line 9

def username
  @username
end

Instance Method Details

#hostObject

Access the host (e.g. storage.clouddrive.com/container) for a storage service.

Usage:

storage.host


34
35
36
# File 'lib/attached/storage/rackspace.rb', line 34

def host()
  "https://storage.clouddrive.com/#{self.container}/"
end