2013-02-15 15:26:45 -05:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Storage
|
|
|
|
class Rackspace
|
|
|
|
class Account < Fog::Model
|
2013-03-07 17:01:42 -05:00
|
|
|
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/View_Account_Info-d1e11995.html
|
|
|
|
|
2013-03-11 11:05:23 -04:00
|
|
|
# @!attribute [rw] meta_temp_url_key
|
|
|
|
# @return [String] The temporary URL key used to generate temporary access to files
|
2013-03-07 17:01:42 -05:00
|
|
|
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html
|
2013-02-15 15:26:45 -05:00
|
|
|
attribute :meta_temp_url_key, :aliases => 'X-Account-Meta-Temp-Url-Key'
|
2013-03-07 17:01:42 -05:00
|
|
|
|
|
|
|
# @!attribute [r] container_count
|
|
|
|
# @return [Integer] The number of containers in account
|
2013-02-15 15:26:45 -05:00
|
|
|
attribute :container_count, :aliases => 'X-Account-Container-Count', :type => :integer
|
2013-03-07 17:01:42 -05:00
|
|
|
|
|
|
|
# @!attribute [r] bytes_used
|
|
|
|
# @return [Integer] The total number of bytes used by the account
|
2013-02-15 15:26:45 -05:00
|
|
|
attribute :bytes_used, :aliases => 'X-Account-Bytes-Used', :type => :integer
|
2013-03-07 17:01:42 -05:00
|
|
|
|
|
|
|
# @!attribute [r] object_count
|
|
|
|
# @return [Integer] The total number of objects in the account
|
2013-02-15 15:26:45 -05:00
|
|
|
attribute :object_count, :aliases => 'X-Account-Object-Count', :type => :integer
|
|
|
|
|
2013-03-07 17:01:42 -05:00
|
|
|
# Saves account settings (meta_temp_url_key)
|
|
|
|
# @return [Boolean] returns true if successfully updated
|
2013-04-15 14:12:14 -04:00
|
|
|
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
|
|
|
|
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
|
|
|
|
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
|
|
|
|
# @raise [Fog::Storage::Rackspace::ServiceError]
|
2013-02-15 15:26:45 -05:00
|
|
|
def save
|
|
|
|
service.post_set_meta_temp_url_key meta_temp_url_key
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-03-07 17:01:42 -05:00
|
|
|
# Reload account with latest data from Cloud Files
|
|
|
|
# @return [Fog::Storage::Rackspace::Account] returns itself
|
2013-04-15 14:12:14 -04:00
|
|
|
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
|
|
|
|
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
|
|
|
|
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
|
|
|
|
# @raise [Fog::Storage::Rackspace::ServiceError]
|
2013-02-15 15:26:45 -05:00
|
|
|
def reload
|
|
|
|
response = service.head_containers
|
|
|
|
merge_attributes response.headers
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|