# File lib/duracloud/store.rb, line 17 def self.primary all.detect { |store| store.primary? } end
class Duracloud::Store
A Duracloud
storage provider account.
Attributes
id[R]
owner_id[R]
primary[R]
provider_type[R]
Public Class Methods
all()
click to toggle source
@return [Array<Duracloud::Store>] the list of available storage provider accounts.
# 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
new(xml_node)
click to toggle source
@api private
# 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
primary()
click to toggle source
@return [Duracloud::Store] the primary storage provider account.
Public Instance Methods
primary?()
click to toggle source
# File lib/duracloud/store.rb, line 33 def primary? primary == "1" end