Class: OrgTrust

Inherits:
Object
  • Object
show all
Defined in:
lib/satops/operator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(org) ⇒ OrgTrust

Returns a new instance of OrgTrust.



917
918
919
920
921
# File 'lib/satops/operator.rb', line 917

def initialize(org)
  @id=org['id']
  @name=org['name']
  @trusted_orgs=org['trusted_orgs']
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



898
899
900
# File 'lib/satops/operator.rb', line 898

def id
  @id
end

Class Method Details

.reader(sat, org) ⇒ Object



900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
# File 'lib/satops/operator.rb', line 900

def self.reader(sat, org)
  org_trusts=org
  # Misnomer - listTrusts actually returns all orgs!
  alltrusts=sat.orgTrusts.listTrusts(org['id'])
  trusts=[]
  alltrusts.each do |trust|
    if trust['trustEnabled']
      trusts << trust
      # Broken - BZ#815715
      # sat.orgTrusts.getDetails(trust['orgId'])
      # ...
    end
  end
  org_trusts.merge!({'trusted_orgs'=>trusts})
  org_trusts
end

Instance Method Details

#create(sat) ⇒ Object



923
924
925
926
927
# File 'lib/satops/operator.rb', line 923

def create(sat)
  @trusted_orgs.each do |trust|
    sat.orgTrusts.addTrust(@id, trust['orgId'])
  end
end

#delete(sat) ⇒ Object



929
930
931
932
933
# File 'lib/satops/operator.rb', line 929

def delete(sat)
  @trusted_orgs.each do |trusted|
    sat.orgTrusts.removeTrust(@id, trusted['orgId'])
  end
end

#update(sat) ⇒ Object



935
936
937
# File 'lib/satops/operator.rb', line 935

def update(sat)
  self.create(sat)
end