Class: CredHubble::Resources::CredentialCollection

Inherits:
Resource show all
Includes:
Enumerable
Defined in:
lib/cred_hubble/resources/credential_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RestResource

from_json, #to_json

Constructor Details

#initialize(value_hash) ⇒ CredentialCollection

Returns a new instance of CredentialCollection.



9
10
11
12
# File 'lib/cred_hubble/resources/credential_collection.rb', line 9

def initialize(value_hash)
  credentials_array = value_hash['data']
  @data = credentials_array.map { |credential_data| CredentialFactory.credential_from_data(credential_data) }
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



18
19
20
# File 'lib/cred_hubble/resources/credential_collection.rb', line 18

def data
  @data
end

Instance Method Details

#each(&block) ⇒ Object



14
15
16
# File 'lib/cred_hubble/resources/credential_collection.rb', line 14

def each(&block)
  data.each(&block)
end