Class: Duracloud::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/duracloud/store.rb

Overview

A Duracloud storage provider account.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_node) ⇒ Store

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Store.



26
27
28
29
30
31
# File 'lib/duracloud/store.rb', line 26

def initialize(xml_node)
  @owner_id = xml_node['ownerId']
  @primary = xml_node['isPrimary']
  @id = xml_node.css('id').text
  @provider_type = xml_node.css('storageProviderType').text
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



23
24
25
# File 'lib/duracloud/store.rb', line 23

def id
  @id
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



23
24
25
# File 'lib/duracloud/store.rb', line 23

def owner_id
  @owner_id
end

#primaryObject (readonly)

Returns the value of attribute primary.



23
24
25
# File 'lib/duracloud/store.rb', line 23

def primary
  @primary
end

#provider_typeObject (readonly)

Returns the value of attribute provider_type.



23
24
25
# File 'lib/duracloud/store.rb', line 23

def provider_type
  @provider_type
end

Class Method Details

.allArray<Duracloud::Store>

Returns the list of available storage provider accounts.

Returns:

  • (Array<Duracloud::Store>)

    the list of available storage provider accounts.



10
11
12
13
14
# File 'lib/duracloud/store.rb', line 10

def self.all
  response = Client.get_stores
  doc = Nokogiri::XML(response.body)
  doc.css('storageAcct').map { |acct| new(acct) }
end

.primaryDuracloud::Store

Returns the primary storage provider account.

Returns:



17
18
19
# File 'lib/duracloud/store.rb', line 17

def self.primary
  all.detect { |store| store.primary? }
end

Instance Method Details

#primary?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/duracloud/store.rb', line 33

def primary?
  primary == "1"
end