Class: SelfSDK::Services::Facts::Delegation
- Inherits:
-
Object
- Object
- SelfSDK::Services::Facts::Delegation
- Defined in:
- lib/services/facts.rb
Constant Summary collapse
- TYPE =
'delegation_certificate'
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#conditions ⇒ Object
Returns the value of attribute conditions.
-
#description ⇒ Object
Returns the value of attribute description.
-
#effect ⇒ Object
Returns the value of attribute effect.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#subjects ⇒ Object
Returns the value of attribute subjects.
Class Method Summary collapse
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(subjects, actions, effect, resources, opts = {}) ⇒ Delegation
constructor
A new instance of Delegation.
Constructor Details
#initialize(subjects, actions, effect, resources, opts = {}) ⇒ Delegation
Returns a new instance of Delegation.
156 157 158 159 160 161 162 163 |
# File 'lib/services/facts.rb', line 156 def initialize(subjects, actions, effect, resources, opts = {}) @subjects = subjects @actions = actions @effect = effect @resources = resources @conditions = opts.fetch(:conditions, nil) @description = opts.fetch(:description, nil) end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def actions @actions end |
#conditions ⇒ Object
Returns the value of attribute conditions.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def conditions @conditions end |
#description ⇒ Object
Returns the value of attribute description.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def description @description end |
#effect ⇒ Object
Returns the value of attribute effect.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def effect @effect end |
#resources ⇒ Object
Returns the value of attribute resources.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def resources @resources end |
#subjects ⇒ Object
Returns the value of attribute subjects.
154 155 156 |
# File 'lib/services/facts.rb', line 154 def subjects @subjects end |
Class Method Details
.parse(input) ⇒ Object
176 177 178 179 180 181 182 183 184 185 |
# File 'lib/services/facts.rb', line 176 def self.parse(input) b = JSON.parse(Base64.urlsafe_decode64(input)) Delegation.new( b['subjects'], b['actions'], b['effect'], b['resources'], conditions: b['conditions'], description: b['description']) end |
Instance Method Details
#encode ⇒ Object
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/services/facts.rb', line 165 def encode cert = { subjects: @subjects, actions: @actions, effect: @effect, resources: @resources, }.to_json Base64.urlsafe_encode64(cert, padding: false) end |