Class: Gobbler::Volume

Inherits:
Base
  • Object
show all
Includes:
Mappable
Defined in:
lib/gobbler/volume.rb

Instance Attribute Summary

Attributes inherited from Base

#json

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mappable

#city, #coordinates, included, #lat, #lng, #zip

Methods inherited from Base

#base_attr, get, #initialize

Constructor Details

This class inherits a constructor from Gobbler::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gobbler::Base

Class Method Details

.list(opts = {}) ⇒ Array<Volume>

Returns an array of volumes.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :limit (Integer)

    The number of records to return

  • :offset (Integer)

    The number of records to offset the results (useful for paging)

Returns:

  • (Array<Volume>)

    an array of volumes



19
20
21
22
# File 'lib/gobbler/volume.rb', line 19

def self.list(opts = {})
  opts[:offset] ||= 0
  ::Gobbler.request("client_volume/sync_ask", options: opts)["updates"].map {|volume| new(volume)}
end

Instance Method Details

#connected?Boolean

Returns If the volume is currently connected to a machine.

Returns:

  • (Boolean)

    If the volume is currently connected to a machine



25
26
27
# File 'lib/gobbler/volume.rb', line 25

def connected?
  currently_connected
end