Class: Arcp::Credential
- Inherits:
-
Data
- Object
- Data
- Arcp::Credential
- Defined in:
- lib/arcp/credential.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, scheme:, value:, endpoint:, profile: nil, constraints: nil) ⇒ Credential
constructor
A new instance of Credential.
- #to_h ⇒ Object
- #to_redacted_h ⇒ Object
Constructor Details
#initialize(id:, scheme:, value:, endpoint:, profile: nil, constraints: nil) ⇒ Credential
Returns a new instance of Credential.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/arcp/credential.rb', line 5 def initialize(id:, scheme:, value:, endpoint:, profile: nil, constraints: nil) super( id: id, scheme: scheme, value: value, endpoint: endpoint, profile: profile, constraints: constraints || {} ) end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def constraints @constraints end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def endpoint @endpoint end |
#id ⇒ Object (readonly)
Returns the value of attribute id
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def id @id end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def profile @profile end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def scheme @scheme end |
#value ⇒ Object (readonly)
Returns the value of attribute value
4 5 6 |
# File 'lib/arcp/credential.rb', line 4 def value @value end |
Class Method Details
.from_h(h) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/arcp/credential.rb', line 16 def self.from_h(h) h = h.transform_keys(&:to_s) new( id: h.fetch('id'), scheme: h.fetch('scheme'), value: h.fetch('value'), endpoint: h.fetch('endpoint'), profile: h['profile'], constraints: h['constraints'] || {} ) end |
Instance Method Details
#to_h ⇒ Object
28 29 30 31 32 33 |
# File 'lib/arcp/credential.rb', line 28 def to_h out = { 'id' => id, 'scheme' => scheme, 'value' => value, 'endpoint' => endpoint } out['profile'] = profile if profile out['constraints'] = constraints if constraints && !constraints.empty? out end |
#to_redacted_h ⇒ Object
35 36 37 |
# File 'lib/arcp/credential.rb', line 35 def to_redacted_h to_h.merge('value' => '[REDACTED]') end |