Class: Fog::Radosgw::Usage::Mock

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/fog/radosgw/usage.rb,
lib/fog/radosgw/requests/usage/get_usage.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#sanitize_and_convert_time

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



25
26
27
# File 'lib/fog/radosgw/usage.rb', line 25

def initialize(options = {})
  configure_uri_options(options)
end

Class Method Details

.dataObject



15
16
17
18
19
# File 'lib/fog/radosgw/usage.rb', line 15

def self.data
  @data ||= Hash.new do |hash, key|
    hash[key] = {}
  end
end

.resetObject



21
22
23
# File 'lib/fog/radosgw/usage.rb', line 21

def self.reset
  @data = nil
end

Instance Method Details

#dataObject



29
30
31
# File 'lib/fog/radosgw/usage.rb', line 29

def data
  self.class.data[radosgw_uri]
end

#get_usage(access_key, options = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/radosgw/requests/usage/get_usage.rb', line 47

def get_usage(access_key, options = {})
  Excon::Response.new.tap do |response|
    response.status = 200
    response.headers['Content-Type'] = 'application/json'
    response.body = {
      'entries' =>  [],
      'summary'  => []
    }
  end
end

#reset_dataObject



33
34
35
# File 'lib/fog/radosgw/usage.rb', line 33

def reset_data
  self.class.data.delete(radosgw_uri)
end