Class: Fog::RiakCS::Usage::Mock
- Inherits:
-
Object
- Object
- Fog::RiakCS::Usage::Mock
show all
- 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
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Utils
#format_and_types_to_path, #request_uri, #sanitize_and_convert_time
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
26
27
28
|
# File 'lib/fog/riakcs/usage.rb', line 26
def initialize(options = {})
configure_uri_options(options)
end
|
Class Method Details
.data ⇒ Object
16
17
18
19
20
|
# File 'lib/fog/riakcs/usage.rb', line 16
def self.data
@data ||= Hash.new do |hash, key|
hash[key] = {}
end
end
|
.reset ⇒ Object
22
23
24
|
# File 'lib/fog/riakcs/usage.rb', line 22
def self.reset
@data = nil
end
|
Instance Method Details
#data ⇒ Object
30
31
32
|
# File 'lib/fog/riakcs/usage.rb', line 30
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/requests/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
34
35
36
|
# File 'lib/fog/riakcs/usage.rb', line 34
def reset_data
self.class.data.delete(riakcs_uri)
end
|