Class: Vk::API::Auth

Inherits:
Schema::Namespace show all
Defined in:
lib/vk/api/methods.rb,
lib/vk/api/responses.rb,
lib/vk/api/auth/methods/signup.rb,
lib/vk/api/auth/methods/confirm.rb,
lib/vk/api/auth/methods/restore.rb,
lib/vk/api/auth/methods/check_phone.rb,
lib/vk/api/auth/responses/signup_response.rb,
lib/vk/api/auth/responses/confirm_response.rb,
lib/vk/api/auth/responses/restore_response.rb,
lib/vk/api/auth/responses/check_phone_response.rb

Defined Under Namespace

Modules: Methods, Responses

Instance Attribute Summary

Attributes inherited from Schema::Namespace

#client

DSL collapse

Methods inherited from Schema::Namespace

#call, #initialize

Constructor Details

This class inherits a constructor from Vk::Schema::Namespace

Instance Method Details

#check_phone(arguments = {}) ⇒ Vk::API::Auth::Responses::CheckPhoneResponse

Returns Checks a user's phone number for correctness.

Parameters:

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

Options Hash (arguments):

Returns:

See Also:


166
167
168
169
170
171
172
# File 'lib/vk/api/methods.rb', line 166

def check_phone(arguments = {})
  require "vk/api/auth/methods/check_phone"
  method = Methods::CheckPhone.new(arguments)
  response = method.call(@client)
  require "vk/api/auth/responses/check_phone_response"
  Responses::CheckPhoneResponse.new(response.deep_symbolize_keys)
end

#confirm(arguments = {}) ⇒ Vk::API::Auth::Responses::ConfirmResponse

Returns Completes a user's registration (begun with the method) using an authorization code.

Parameters:

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

Options Hash (arguments):

Returns:

See Also:


203
204
205
206
207
208
209
# File 'lib/vk/api/methods.rb', line 203

def confirm(arguments = {})
  require "vk/api/auth/methods/confirm"
  method = Methods::Confirm.new(arguments)
  response = method.call(@client)
  require "vk/api/auth/responses/confirm_response"
  Responses::ConfirmResponse.new(response.deep_symbolize_keys)
end

#restore(arguments = {}) ⇒ Vk::API::Auth::Responses::RestoreResponse

Returns Allows to restore account access using a code received via SMS.; ; " This method is only available for apps with access. ".

Parameters:

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

Options Hash (arguments):

  • :phone (String)

    user phone number.

Returns:

See Also:


214
215
216
217
218
219
220
# File 'lib/vk/api/methods.rb', line 214

def restore(arguments = {})
  require "vk/api/auth/methods/restore"
  method = Methods::Restore.new(arguments)
  response = method.call(@client)
  require "vk/api/auth/responses/restore_response"
  Responses::RestoreResponse.new(response.deep_symbolize_keys)
end

#signup(arguments = {}) ⇒ Vk::API::Auth::Responses::SignupResponse

Returns Registers a new user by phone number.

Parameters:

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

Options Hash (arguments):

  • :first_name (String)

    User's first name.

  • :last_name (String)

    User's surname.

  • :client_id (Integer)

    Your application ID.

  • :client_secret (String)
  • :phone (String)

    User's phone number. Can be pre-checked with the method.

  • :password (String)

    User's password (minimum of 6 characters). Can be specified later with the method.

  • :test_mode (Boolean)

    '1' — test mode, in which the user will not be registered and the phone number will not be checked for availability; '0' — default mode (default)

  • :voice (Boolean)

    '1' — call the phone number and leave a voice message of the authorization code; '0' — send the code by SMS (default)

  • :sex (Integer)

    '1' — female; '2' — male

  • :sid (String)

    Session ID required for method recall when SMS was not delivered.

Returns:

See Also:


186
187
188
189
190
191
192
# File 'lib/vk/api/methods.rb', line 186

def (arguments = {})
  require "vk/api/auth/methods/signup"
  method = Methods::Signup.new(arguments)
  response = method.call(@client)
  require "vk/api/auth/responses/signup_response"
  Responses::SignupResponse.new(response.deep_symbolize_keys)
end