Class: OneLogin::Api::Models::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/onelogin/api/models/statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Statement

Returns a new instance of Statement.


9
10
11
12
13
14
15
# File 'lib/onelogin/api/models/statement.rb', line 9

def initialize(*args)
  if args.length == 1
    self.from_data(args[0])
  else
    self.from_values(args[0], args[1], args[2])
  end
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.


7
8
9
# File 'lib/onelogin/api/models/statement.rb', line 7

def actions
  @actions
end

#effectObject

Returns the value of attribute effect.


7
8
9
# File 'lib/onelogin/api/models/statement.rb', line 7

def effect
  @effect
end

#scopesObject

Returns the value of attribute scopes.


7
8
9
# File 'lib/onelogin/api/models/statement.rb', line 7

def scopes
  @scopes
end

Instance Method Details

#from_data(data) ⇒ Object


17
18
19
20
21
# File 'lib/onelogin/api/models/statement.rb', line 17

def from_data(data)
  @effect = data['Effect']? data['Effect'] : "Allow"
  @actions = data['Action']? data['Action'] : []
  @scopes = data['Scope']? data['Scope'] : []
end

#from_values(effect, actions, scopes) ⇒ Object


23
24
25
26
27
# File 'lib/onelogin/api/models/statement.rb', line 23

def from_values(effect, actions, scopes)
  @effect = effect
  @actions = actions
  @scopes = scopes
end

#get_valid_actionsObject


29
30
31
32
# File 'lib/onelogin/api/models/statement.rb', line 29

def get_valid_actions
  return 
    Constants.VALID_ACTIONS
end