Class: Fog::RiakCS::Usage::Mock
- Inherits:
-
Object
- Object
- Fog::RiakCS::Usage::Mock
show all
- 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
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Utils
#format_and_types_to_path, #request_uri, #sanitize_and_convert_time
#configure_uri_options, #riakcs_uri
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
25
26
27
|
# File 'lib/fog/riakcs/usage.rb', line 25
def initialize(options = {})
configure_uri_options(options)
end
|
Class Method Details
.data ⇒ Object
15
16
17
18
19
|
# File 'lib/fog/riakcs/usage.rb', line 15
def self.data
@data ||= Hash.new do |hash, key|
hash[key] = {}
end
end
|
.reset ⇒ Object
21
22
23
|
# File 'lib/fog/riakcs/usage.rb', line 21
def self.reset
@data = nil
end
|
Instance Method Details
#data ⇒ Object
29
30
31
|
# File 'lib/fog/riakcs/usage.rb', line 29
def data
self.class.data[riakcs_uri]
end
|
#get_usage(access_key, options = {}) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/fog/riakcs/usage/get_usage.rb', line 49
def get_usage(access_key, options = {})
Excon::Response.new.tap do |response|
response.status = 200
response.['Content-Type'] = 'application/json'
response.body = {
'Access' => {
'Nodes' => [],
'Errors' => []
},
'Storage' => {
'Samples' => [],
'Errors' => []
}
}
end
end
|
#reset_data ⇒ Object
33
34
35
|
# File 'lib/fog/riakcs/usage.rb', line 33
def reset_data
self.class.data.delete(riakcs_uri)
end
|