Class: APDM::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/apdm/credentials.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Credentials

Returns a new instance of Credentials.



13
14
15
# File 'lib/apdm/credentials.rb', line 13

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



12
13
14
# File 'lib/apdm/credentials.rb', line 12

def data
  @data
end

Class Method Details

.authorized?(id) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/apdm/credentials.rb', line 4

def self.authorized?(id)
  self.for(id).authorized?
end

.for(id) ⇒ Object



8
9
10
# File 'lib/apdm/credentials.rb', line 8

def self.for(id)
  new APDM::Origo.fetch_credentials(id)
end

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/apdm/credentials.rb', line 17

def authorized?
  data.each do |credential|
    return true if credential["authorized"]
  end
  false
end