Class: VkMusic::Request::Login

Inherits:
Base
  • Object
show all
Defined in:
lib/vk_music/request/login.rb

Overview

Logging in request

Instance Attribute Summary

Attributes inherited from Base

#data, #headers, #method, #path, #response

Instance Method Summary collapse

Methods inherited from Base

#call

Constructor Details

#initializeLogin

Initialize new request



8
9
10
11
# File 'lib/vk_music/request/login.rb', line 8

def initialize
  super("#{VK_ROOT}/login", {}, 'GET', {})
  @success = false
end

Instance Method Details

#send_form(login, password, agent) ⇒ Object

Send login form



19
20
21
22
23
24
25
26
# File 'lib/vk_music/request/login.rb', line 19

def send_form(, password, agent)
  form = @parser.
  form['email'] = 
  form['pass'] = password
  page = agent.submit(form)

  @success = (page.uri.to_s == 'https://m.vk.com/feed')
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/vk_music/request/login.rb', line 14

def success?
  !!@success
end