Class: Duracloud::StorageReports
- Inherits:
-
Object
- Object
- Duracloud::StorageReports
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/duracloud/storage_reports.rb
Defined Under Namespace
Classes: Params
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
- .by_space(space_id, **query) ⇒ Object
- .by_store(**query) ⇒ Object
- .for_all_spaces_in_a_store(epoch_ms = nil, **query) ⇒ Object
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(response) ⇒ StorageReports
constructor
A new instance of StorageReports.
Constructor Details
#initialize(response) ⇒ StorageReports
Returns a new instance of StorageReports.
32 33 34 |
# File 'lib/duracloud/storage_reports.rb', line 32 def initialize(response) @data = JSON.parse(response.body) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/duracloud/storage_reports.rb', line 11 def data @data end |
Class Method Details
.by_space(space_id, **query) ⇒ Object
13 14 15 16 17 |
# File 'lib/duracloud/storage_reports.rb', line 13 def self.by_space(space_id, **query) params = Params.new(query) response = Client.get_storage_reports_by_space(space_id, **params) new(response) end |
.by_store(**query) ⇒ Object
19 20 21 22 23 |
# File 'lib/duracloud/storage_reports.rb', line 19 def self.by_store(**query) params = Params.new(query) response = Client.get_storage_reports_by_store(**params) new(response) end |
.for_all_spaces_in_a_store(epoch_ms = nil, **query) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/duracloud/storage_reports.rb', line 25 def self.for_all_spaces_in_a_store(epoch_ms = nil, **query) epoch_ms ||= (Time.now - (3600 * 24)).to_i * 1000 params = Params.new(query) response = Client.get_storage_reports_for_all_spaces_in_a_store(epoch_ms, **params) new(response) end |
Instance Method Details
#each ⇒ Object
36 37 38 39 40 |
# File 'lib/duracloud/storage_reports.rb', line 36 def each data.each do |report| yield StorageReport.new(report) end end |