Class: CXML::Credential

Inherits:
Object
  • Object
show all
Defined in:
lib/cxml/credential.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Credential

Initialize a new Credential instance

Parameters:

  • data (Hash) (defaults to: {})

    optional initial data



45
46
47
48
49
50
51
52
# File 'lib/cxml/credential.rb', line 45

def initialize(data={})
  if data.kind_of?(Hash) && !data.empty?
    @domain        = data['domain']
    @type          = data['type']
    @identity      = data['Identity']
    @shared_secret = data['SharedSecret']
  end
end

Instance Attribute Details

#credential_macObject

Returns the value of attribute credential_mac.



40
41
42
# File 'lib/cxml/credential.rb', line 40

def credential_mac
  @credential_mac
end

#domainObject

Returns the value of attribute domain.



37
38
39
# File 'lib/cxml/credential.rb', line 37

def domain
  @domain
end

#identityObject

Returns the value of attribute identity.



41
42
43
# File 'lib/cxml/credential.rb', line 41

def identity
  @identity
end

#shared_secretObject

Returns the value of attribute shared_secret.



39
40
41
# File 'lib/cxml/credential.rb', line 39

def shared_secret
  @shared_secret
end

#typeObject

Returns the value of attribute type.



38
39
40
# File 'lib/cxml/credential.rb', line 38

def type
  @type
end

Instance Method Details

#render(node) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/cxml/credential.rb', line 54

def render(node)
  node.Credential('domain' => domain) do |c|
    c.Identity(@identity)
    c.SharedSecret(@shared_secret) if @shared_secret
  end
  node
end