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.



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

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).



116
117
118
# File 'lib/nexpose/web_credentials.rb', line 116

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.



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

def dynamic
  @dynamic
end

#nameObject (readonly)

The name of the HTML field (form parameter).



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

def name
  @name
end

#typeObject (readonly)

The type of the HTML field (form parameter).



109
110
111
# File 'lib/nexpose/web_credentials.rb', line 109

def type
  @type
end

#valueObject (readonly)

The value of the HTML field (form parameter).



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

def value
  @value
end

Instance Method Details

#to_hObject



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

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

#to_jsonObject



126
127
128
# File 'lib/nexpose/web_credentials.rb', line 126

def to_json
  JSON.generate(to_h)
end