Class: SharedCredential
- Inherits:
-
Object
- Object
- SharedCredential
- Defined in:
- lib/domain/shared_credential/model.rb
Overview
Shared Credential can be used in multiple sites NOTE: There is no dimension, so the API is the source of truth
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#description ⇒ Object
Returns the value of attribute description.
-
#host_restriction ⇒ Object
Returns the value of attribute host_restriction.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port_restriction ⇒ Object
Returns the value of attribute port_restriction.
-
#site_assignment ⇒ Object
Returns the value of attribute site_assignment.
-
#sites ⇒ Object
Returns the value of attribute sites.
Class Method Summary collapse
Instance Method Summary collapse
-
#cyberark?(country) ⇒ Boolean
returns true if the name starts with CyberArk and the name contains the country name.
- #domain ⇒ Object
- #from_csv ⇒ Object
-
#initialize(id:, name:, account:, site_assignment:, sites:, description:, host_restriction:, port_restriction:) ⇒ SharedCredential
constructor
A new instance of SharedCredential.
- #permission_elevation ⇒ Object
- #permission_elevation_user_name ⇒ Object
- #service ⇒ Object
- #service_name ⇒ Object
- #to_csv ⇒ Object
- #to_json(*_options) ⇒ Object
- #to_s ⇒ Object
- #user_name ⇒ Object
Constructor Details
#initialize(id:, name:, account:, site_assignment:, sites:, description:, host_restriction:, port_restriction:) ⇒ SharedCredential
Returns a new instance of SharedCredential.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/domain/shared_credential/model.rb', line 8 def initialize(id:, name:, account:, site_assignment:, sites:, description:, host_restriction:, port_restriction:) @account = account @description = description @host_restriction = host_restriction @id = id @name = name @port_restriction = port_restriction @site_assignment = site_assignment @sites = sites end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def account @account end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def description @description end |
#host_restriction ⇒ Object
Returns the value of attribute host_restriction.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def host_restriction @host_restriction end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def name @name end |
#port_restriction ⇒ Object
Returns the value of attribute port_restriction.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def port_restriction @port_restriction end |
#site_assignment ⇒ Object
Returns the value of attribute site_assignment.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def site_assignment @site_assignment end |
#sites ⇒ Object
Returns the value of attribute sites.
6 7 8 |
# File 'lib/domain/shared_credential/model.rb', line 6 def sites @sites end |
Class Method Details
.from_json(data) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/domain/shared_credential/model.rb', line 50 def self.from_json(data) SharedCredential.new( account: data['account'], description: data['description'], host_restriction: data['hostRestriction'], id: data['id'], name: data['name'], port_restriction: data['portRestriction'], site_assignment: data['siteAssignment'], sites: data['sites'] ) end |
Instance Method Details
#cyberark?(country) ⇒ Boolean
returns true if the name starts with CyberArk and the name contains the country name
90 91 92 |
# File 'lib/domain/shared_credential/model.rb', line 90 def cyberark?(country) name.downcase.include?('cyberark') && name.downcase.include?(country.downcase) end |
#domain ⇒ Object
26 27 28 |
# File 'lib/domain/shared_credential/model.rb', line 26 def domain @account['domain'] end |
#from_csv ⇒ Object
80 |
# File 'lib/domain/shared_credential/model.rb', line 80 def from_csv; end |
#permission_elevation ⇒ Object
42 43 44 |
# File 'lib/domain/shared_credential/model.rb', line 42 def @account['permissionElevation'] end |
#permission_elevation_user_name ⇒ Object
46 47 48 |
# File 'lib/domain/shared_credential/model.rb', line 46 def @account['permissionElevationUsername'] end |
#service ⇒ Object
30 31 32 |
# File 'lib/domain/shared_credential/model.rb', line 30 def service @account['service'] end |
#service_name ⇒ Object
34 35 36 |
# File 'lib/domain/shared_credential/model.rb', line 34 def service_name @account['serviceName'] end |
#to_csv ⇒ Object
82 83 84 85 |
# File 'lib/domain/shared_credential/model.rb', line 82 def to_csv site_ids = sites&.join('|') || '' [id, name, account, site_assignment, site_ids].join ',' end |
#to_json(*_options) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/domain/shared_credential/model.rb', line 63 def to_json(*) { account: @account, description: @description, hostRestriction: @host_restriction, id: @id, name: @name, portRestriction: @port_restriction, siteAssignment: @site_assignment, sites: @sites }.to_json end |
#to_s ⇒ Object
76 77 78 |
# File 'lib/domain/shared_credential/model.rb', line 76 def to_s [id, name, service, domain, user_name].join ',' end |
#user_name ⇒ Object
38 39 40 |
# File 'lib/domain/shared_credential/model.rb', line 38 def user_name @account['userName'] end |