Class: Fog::RiakCS::Usage::Real
- Inherits:
-
Object
- Object
- Fog::RiakCS::Usage::Real
- Includes:
- Utils, Fog::RiakCS::Utils
- Defined in:
- lib/fog/riakcs/usage.rb,
lib/fog/riakcs/usage/get_usage.rb
Constant Summary
Constants included from Utils
Utils::DEFAULT_FORMAT, Utils::DEFAULT_TYPES, Utils::TYPES_TO_STRING
Instance Method Summary collapse
- #get_usage(access_key_id, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
Methods included from Utils
#format_and_types_to_path, #request_uri, #sanitize_and_convert_time
Methods included from Fog::RiakCS::Utils
#configure_uri_options, #riakcs_uri
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fog/riakcs/usage.rb', line 41 def initialize( = {}) () @riakcs_access_key_id = [:riakcs_access_key_id] @riakcs_secret_access_key = [:riakcs_secret_access_key] @connection_options = [:connection_options] || {} @persistent = [:persistent] || false @connection = Fog::Storage.new( :provider => 'AWS', :aws_access_key_id => @riakcs_access_key_id, :aws_secret_access_key => @riakcs_secret_access_key, :host => @host, :port => @port, :scheme => @scheme, :connection_options => @connection_options ) end |
Instance Method Details
#get_usage(access_key_id, options = {}) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/fog/riakcs/usage/get_usage.rb', line 36 def get_usage(access_key_id, = {}) response = @connection.get_object('riak-cs', ["usage", request_uri(access_key_id, )].join("/")) if !response.body.empty? response.body = Fog::JSON.decode(response.body) end response end |