Class: Nexpose::WebCredentials::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/web_credentials.rb

Overview

When using HTML form, this represents the login form information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, type, dynamic, checked) ⇒ Field

Returns a new instance of Field.



116
117
118
119
120
121
122
# File 'lib/nexpose/web_credentials.rb', line 116

def initialize(name, value, type, dynamic, checked)
  @name    = name
  @value   = value
  @type    = type
  @dynamic = dynamic
  @checked = checked
end

Instance Attribute Details

#checkedObject (readonly)

If the HTML field (form parameter) is a radio button, checkbox or select field, this flag determines if the field should be checked (selected).



114
115
116
# File 'lib/nexpose/web_credentials.rb', line 114

def checked
  @checked
end

#dynamicObject (readonly)

Is the HTML field (form parameter) dynamically generated? If so, the login page is requested and the value of the field is extracted from the response.



111
112
113
# File 'lib/nexpose/web_credentials.rb', line 111

def dynamic
  @dynamic
end

#nameObject (readonly)

The name of the HTML field (form parameter).



103
104
105
# File 'lib/nexpose/web_credentials.rb', line 103

def name
  @name
end

#typeObject (readonly)

The type of the HTML field (form parameter).



107
108
109
# File 'lib/nexpose/web_credentials.rb', line 107

def type
  @type
end

#valueObject (readonly)

The value of the HTML field (form parameter).



105
106
107
# File 'lib/nexpose/web_credentials.rb', line 105

def value
  @value
end

Instance Method Details

#to_hObject



128
129
130
131
132
133
134
135
136
# File 'lib/nexpose/web_credentials.rb', line 128

def to_h
  {
    value: value,
    type: type,
    name: name,
    dynamic: dynamic,
    checked: checked
  }
end

#to_jsonObject



124
125
126
# File 'lib/nexpose/web_credentials.rb', line 124

def to_json
  JSON.generate(to_h)
end