Class: Fog::RiakCS::Usage::Real
- Inherits:
-
Object
- Object
- Fog::RiakCS::Usage::Real
- Includes:
- Utils
- Defined in:
- lib/fog/riakcs/usage.rb,
lib/fog/riakcs/requests/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
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/riakcs/usage.rb', line 43 def initialize( = {}) require 'mime/types' require 'multi_json' () @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/requests/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 = MultiJson.decode(response.body) end response end |