Class: WeConnect::Authentication::PasswordFormParser
- Inherits:
-
Object
- Object
- WeConnect::Authentication::PasswordFormParser
- Defined in:
- lib/weconnect/authorization.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#initialize(html) ⇒ PasswordFormParser
constructor
A new instance of PasswordFormParser.
Constructor Details
#initialize(html) ⇒ PasswordFormParser
Returns a new instance of PasswordFormParser.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/weconnect/authorization.rb', line 185 def initialize(html) doc = Nokogiri::HTML( html ) # 1 loginform username form = doc/'form[name="emailPasswordForm"]' if form @action = form.attribute('action').to_s @method = form.attribute('method').to_s # get hidden fields @fields = {} (form/'input').each do |input| @fields[input.attribute('name').to_s] = input.attribute('value').to_s end else raise IncompatibleAPIError.new( 'emailPasswordForm not found' ) end end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
184 185 186 |
# File 'lib/weconnect/authorization.rb', line 184 def action @action end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
184 185 186 |
# File 'lib/weconnect/authorization.rb', line 184 def fields @fields end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
184 185 186 |
# File 'lib/weconnect/authorization.rb', line 184 def method @method end |