Class: Duracloud::Store
- Inherits:
-
Object
- Object
- Duracloud::Store
- Defined in:
- lib/duracloud/store.rb
Overview
A Duracloud storage provider account.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#owner_id ⇒ Object
readonly
Returns the value of attribute owner_id.
-
#primary ⇒ Object
readonly
Returns the value of attribute primary.
-
#provider_type ⇒ Object
readonly
Returns the value of attribute provider_type.
Class Method Summary collapse
-
.all ⇒ Array<Duracloud::Store>
The list of available storage provider accounts.
-
.primary ⇒ Duracloud::Store
The primary storage provider account.
Instance Method Summary collapse
-
#initialize(xml_node) ⇒ Store
constructor
private
A new instance of Store.
- #primary? ⇒ Boolean
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
23 24 25 |
# File 'lib/duracloud/store.rb', line 23 def id @id end |
#owner_id ⇒ Object (readonly)
Returns the value of attribute owner_id.
23 24 25 |
# File 'lib/duracloud/store.rb', line 23 def owner_id @owner_id end |
#primary ⇒ Object (readonly)
Returns the value of attribute primary.
23 24 25 |
# File 'lib/duracloud/store.rb', line 23 def primary @primary end |
#provider_type ⇒ Object (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
.all ⇒ Array<Duracloud::Store>
Returns 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 |
.primary ⇒ Duracloud::Store
Returns the primary storage provider account.
17 18 19 |
# File 'lib/duracloud/store.rb', line 17 def self.primary all.detect { |store| store.primary? } end |
Instance Method Details
#primary? ⇒ Boolean
33 34 35 |
# File 'lib/duracloud/store.rb', line 33 def primary? primary == "1" end |