Class: Vk::API::Friends

Inherits:
Schema::Namespace show all
Defined in:
lib/vk/api/methods.rb,
lib/vk/api/objects.rb,
lib/vk/api/responses.rb,
lib/vk/api/friends/requests.rb,
lib/vk/api/friends/methods/add.rb,
lib/vk/api/friends/methods/get.rb,
lib/vk/api/friends/friends_list.rb,
lib/vk/api/friends/methods/edit.rb,
lib/vk/api/friends/friend_status.rb,
lib/vk/api/friends/methods/delete.rb,
lib/vk/api/friends/methods/search.rb,
lib/vk/api/friends/user_xtr_lists.rb,
lib/vk/api/friends/user_xtr_phone.rb,
lib/vk/api/friends/methods/add_list.rb,
lib/vk/api/friends/methods/edit_list.rb,
lib/vk/api/friends/methods/get_lists.rb,
lib/vk/api/friends/methods/get_mutual.rb,
lib/vk/api/friends/methods/get_online.rb,
lib/vk/api/friends/methods/get_recent.rb,
lib/vk/api/friends/methods/are_friends.rb,
lib/vk/api/friends/methods/delete_list.rb,
lib/vk/api/friends/methods/get_requests.rb,
lib/vk/api/friends/requests_xtr_message.rb,
lib/vk/api/friends/methods/get_app_users.rb,
lib/vk/api/friends/methods/get_by_phones.rb,
lib/vk/api/friends/responses/add_response.rb,
lib/vk/api/friends/responses/get_response.rb,
lib/vk/api/friends/methods/get_suggestions.rb,
lib/vk/api/friends/responses/edit_response.rb,
lib/vk/api/friends/responses/delete_response.rb,
lib/vk/api/friends/responses/search_response.rb,
lib/vk/api/friends/methods/delete_all_requests.rb,
lib/vk/api/friends/responses/add_list_response.rb,
lib/vk/api/friends/responses/edit_list_response.rb,
lib/vk/api/friends/responses/get_lists_response.rb,
lib/vk/api/friends/responses/get_mutual_response.rb,
lib/vk/api/friends/responses/get_online_response.rb,
lib/vk/api/friends/responses/get_recent_response.rb,
lib/vk/api/friends/methods/get_available_for_call.rb,
lib/vk/api/friends/responses/are_friends_response.rb,
lib/vk/api/friends/responses/delete_list_response.rb,
lib/vk/api/friends/responses/get_requests_response.rb,
lib/vk/api/friends/responses/get_app_users_response.rb,
lib/vk/api/friends/responses/get_by_phones_response.rb,
lib/vk/api/friends/responses/get_suggestions_response.rb,
lib/vk/api/friends/responses/delete_all_requests_response.rb,
lib/vk/api/friends/responses/get_available_for_call_response.rb

Defined Under Namespace

Modules: Methods, Responses Classes: FriendStatus, FriendsList, Requests, RequestsXtrMessage, UserXtrLists, UserXtrPhone

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

#add(arguments = {}) ⇒ Vk::API::Friends::Responses::AddResponse

Returns Approves or creates a friend request.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    ID of the user whose friend request will be approved or to whom a friend request will be sent.

  • :text (String)

    Text of the message (up to 500 characters) for the friend request, if any.

  • :follow (Boolean)

    '1' to pass an incoming request to followers list.

Returns:

See Also:



1306
1307
1308
1309
1310
1311
1312
# File 'lib/vk/api/methods.rb', line 1306

def add(arguments = {})
  require "vk/api/friends/methods/add"
  method = Methods::Add.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/add_response"
  Responses::AddResponse.new(response.deep_symbolize_keys)
end

#add_list(arguments = {}) ⇒ Vk::API::Friends::Responses::AddListResponse

Returns Creates a new friend list for the current user.

Parameters:

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

Options Hash (arguments):

  • :name (String)

    Name of the friend list.

  • :user_ids (Array)

    IDs of users to be added to the friend list.;

Returns:

See Also:



1353
1354
1355
1356
1357
1358
1359
# File 'lib/vk/api/methods.rb', line 1353

def add_list(arguments = {})
  require "vk/api/friends/methods/add_list"
  method = Methods::AddList.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/add_list_response"
  Responses::AddListResponse.new(response.deep_symbolize_keys)
end

#are_friends(arguments = {}) ⇒ Vk::API::Friends::Responses::AreFriendsResponse

Returns Checks the current user's friendship status with other specified users.

Parameters:

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

Options Hash (arguments):

  • :user_ids (Array)

    IDs of the users whose friendship status to check.

  • :need_sign (Boolean)

    '1' — to return 'sign' field. 'sign' is md5("\$1id\$1_\$1user_id\$1_\$1friends_status\$1_\$1application_secret\$1"), where id is current user ID.; This field allows to check that data has not been modified by the client.; By default: '0'.

Returns:

See Also:



1438
1439
1440
1441
1442
1443
1444
# File 'lib/vk/api/methods.rb', line 1438

def are_friends(arguments = {})
  require "vk/api/friends/methods/are_friends"
  method = Methods::AreFriends.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/are_friends_response"
  Responses::AreFriendsResponse.new(response.deep_symbolize_keys)
end

#delete(arguments = {}) ⇒ Vk::API::Friends::Responses::DeleteResponse

Returns Declines a friend request or deletes a user from the current user's friend list.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    ID of the user whose friend request is to be declined or who is to be deleted from the current user's friend list.

Returns:

See Also:



1329
1330
1331
1332
1333
1334
1335
# File 'lib/vk/api/methods.rb', line 1329

def delete(arguments = {})
  require "vk/api/friends/methods/delete"
  method = Methods::Delete.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/delete_response"
  Responses::DeleteResponse.new(response.deep_symbolize_keys)
end

#delete_all_requests(arguments = {}) ⇒ Vk::API::Friends::Responses::DeleteAllRequestsResponse

Returns Marks all incoming friend requests as viewed.

Parameters:

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

Returns:

See Also:



1411
1412
1413
1414
1415
1416
1417
# File 'lib/vk/api/methods.rb', line 1411

def delete_all_requests(arguments = {})
  require "vk/api/friends/methods/delete_all_requests"
  method = Methods::DeleteAllRequests.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/delete_all_requests_response"
  Responses::DeleteAllRequestsResponse.new(response.deep_symbolize_keys)
end

#delete_list(arguments = {}) ⇒ Vk::API::Friends::Responses::DeleteListResponse

Returns Deletes a friend list of the current user.

Parameters:

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

Options Hash (arguments):

  • :list_id (Integer)

    ID of the friend list to delete.

Returns:

See Also:



1379
1380
1381
1382
1383
1384
1385
# File 'lib/vk/api/methods.rb', line 1379

def delete_list(arguments = {})
  require "vk/api/friends/methods/delete_list"
  method = Methods::DeleteList.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/delete_list_response"
  Responses::DeleteListResponse.new(response.deep_symbolize_keys)
end

#edit(arguments = {}) ⇒ Vk::API::Friends::Responses::EditResponse

Returns Edits the friend lists of the selected user.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    ID of the user whose friend list is to be edited.

  • :list_ids (Array)

    IDs of the friend lists to which to add the user.

Returns:

See Also:



1318
1319
1320
1321
1322
1323
1324
# File 'lib/vk/api/methods.rb', line 1318

def edit(arguments = {})
  require "vk/api/friends/methods/edit"
  method = Methods::Edit.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/edit_response"
  Responses::EditResponse.new(response.deep_symbolize_keys)
end

#edit_list(arguments = {}) ⇒ Vk::API::Friends::Responses::EditListResponse

Returns Edits a friend list of the current user.

Parameters:

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

Options Hash (arguments):

  • :name (String)

    Name of the friend list.

  • :list_id (Integer)

    Friend list ID.

  • :user_ids (Array)

    IDs of users in the friend list.

  • :add_user_ids (Array) — default: Applies if 'user_ids' parameter is not set.

    ; User IDs to add to the friend list.

  • :delete_user_ids (Array) — default: Applies if 'user_ids' parameter is not set.

    ; User IDs to delete from the friend list.

Returns:

See Also:



1368
1369
1370
1371
1372
1373
1374
# File 'lib/vk/api/methods.rb', line 1368

def edit_list(arguments = {})
  require "vk/api/friends/methods/edit_list"
  method = Methods::EditList.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/edit_list_response"
  Responses::EditListResponse.new(response.deep_symbolize_keys)
end

#get(arguments = {}) ⇒ Vk::API::Friends::Responses::GetResponse

Returns a list of user IDs or detailed information about a user's friends.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID. By default, the current user ID.

  • :order (String)

    Sort order: ; 'name' — by name (enabled only if the 'fields' parameter is used); 'hints' — by rating, similar to how friends are sorted in My friends section; ; This parameter is available only for .

  • :list_id (Integer)

    ID of the friend list returned by the method to be used as the source. This parameter is taken into account only when the uid parameter is set to the current user ID.; ; This parameter is available only for .;

  • :count (Integer)

    Number of friends to return.

  • :offset (Integer)

    Offset needed to return a specific subset of friends.

  • :fields (Array, 'bdate')

    Profile fields to return. Sample values: 'uid', 'first_name', 'last_name', 'nickname', 'sex', 'bdate' (birthdate), 'city', 'country', 'timezone', 'photo', 'photo_medium', 'photo_big', 'domain', 'has_mobile', 'rate', 'contacts', 'education'.;

  • :name_case (String)

    Case for declension of user name and surname: ; 'nom' — nominative (default) ; 'gen' — genitive ; 'dat' — dative ; 'acc' — accusative ; 'ins' — instrumental ; 'abl' — prepositional

Returns:

See Also:



1233
1234
1235
1236
1237
1238
1239
# File 'lib/vk/api/methods.rb', line 1233

def get(arguments = {})
  require "vk/api/friends/methods/get"
  method = Methods::Get.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_response"
  Responses::GetResponse.new(response.deep_symbolize_keys)
end

#get_app_users(arguments = {}) ⇒ Vk::API::Friends::Responses::GetAppUsersResponse

Returns a list of IDs of the current user's friends who installed the application.

Parameters:

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

Returns:

See Also:



1389
1390
1391
1392
1393
1394
1395
# File 'lib/vk/api/methods.rb', line 1389

def get_app_users(arguments = {})
  require "vk/api/friends/methods/get_app_users"
  method = Methods::GetAppUsers.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_app_users_response"
  Responses::GetAppUsersResponse.new(response.deep_symbolize_keys)
end

#get_available_for_call(arguments = {}) ⇒ Vk::API::Friends::Responses::GetAvailableForCallResponse

Returns a list of friends who can be called by the current user.

Parameters:

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

Options Hash (arguments):

  • :fields (Array, 'bdate')

    Profile fields to return. Sample values: 'uid', 'first_name', 'last_name', 'nickname', 'sex', 'bdate' (birthdate), 'city', 'country', 'timezone', 'photo', 'photo_medium', 'photo_big', 'domain', 'has_mobile', 'rate', 'contacts', 'education'.;

  • :name_case (String) — default: "nom"

    Case for declension of user name and surname: ; 'nom' — nominative (default) ; 'gen' — genitive ; 'dat' — dative ; 'acc' — accusative ; 'ins' — instrumental ; 'abl' — prepositional

Returns:

See Also:



1450
1451
1452
1453
1454
1455
1456
# File 'lib/vk/api/methods.rb', line 1450

def get_available_for_call(arguments = {})
  require "vk/api/friends/methods/get_available_for_call"
  method = Methods::GetAvailableForCall.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_available_for_call_response"
  Responses::GetAvailableForCallResponse.new(response.deep_symbolize_keys)
end

#get_by_phones(arguments = {}) ⇒ Vk::API::Friends::Responses::GetByPhonesResponse

Returns a list of the current user's friends whose phone numbers, validated or specified in a profile, are in a given list.

Parameters:

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

Options Hash (arguments):

  • :phones (Array)

    List of phone numbers in MSISDN format (maximum 1000).; Example:; "+79219876543,+79111234567"

  • :fields (Array, 'bdate')

    Profile fields to return. Sample values: 'nickname', 'screen_name', 'sex', 'bdate' (birthdate), 'city', 'country', 'timezone', 'photo', 'photo_medium', 'photo_big', 'has_mobile', 'rate', 'contacts', 'education', 'online, counters'.;

Returns:

See Also:



1401
1402
1403
1404
1405
1406
1407
# File 'lib/vk/api/methods.rb', line 1401

def get_by_phones(arguments = {})
  require "vk/api/friends/methods/get_by_phones"
  method = Methods::GetByPhones.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_by_phones_response"
  Responses::GetByPhonesResponse.new(response.deep_symbolize_keys)
end

#get_lists(arguments = {}) ⇒ Vk::API::Friends::Responses::GetListsResponse

Returns a list of the user's friend lists.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

  • :return_system (Boolean)

    '1' — to return system friend lists. By default: '0'.

Returns:

See Also:



1341
1342
1343
1344
1345
1346
1347
# File 'lib/vk/api/methods.rb', line 1341

def get_lists(arguments = {})
  require "vk/api/friends/methods/get_lists"
  method = Methods::GetLists.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_lists_response"
  Responses::GetListsResponse.new(response.deep_symbolize_keys)
end

#get_mutual(arguments = {}) ⇒ Vk::API::Friends::Responses::GetMutualResponse

Returns a list of user IDs of the mutual friends of two users.

Parameters:

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

Options Hash (arguments):

  • :source_uid (Integer)

    ID of the user whose friends will be checked against the friends of the user specified in 'target_uid'.

  • :target_uid (Integer)

    ID of the user whose friends will be checked against the friends of the user specified in 'source_uid'.

  • :target_uids (Array)

    IDs of the users whose friends will be checked against the friends of the user specified in 'source_uid'.

  • :order (String)

    Sort order:; 'random' — random order

  • :count (Integer)

    Number of mutual friends to return.

  • :offset (Integer)

    Offset needed to return a specific subset of mutual friends.

Returns:

See Also:



1265
1266
1267
1268
1269
1270
1271
# File 'lib/vk/api/methods.rb', line 1265

def get_mutual(arguments = {})
  require "vk/api/friends/methods/get_mutual"
  method = Methods::GetMutual.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_mutual_response"
  Responses::GetMutualResponse.new(response.deep_symbolize_keys)
end

#get_online(arguments = {}) ⇒ Vk::API::Friends::Responses::GetOnlineResponse

Returns a list of user IDs of a user's friends who are online.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

  • :list_id (Integer)

    Friend list ID. If this parameter is not set, information about all online friends is returned.

  • :online_mobile (Boolean)

    '1' — to return an additional 'online_mobile' field; '0' — (default);

  • :order (String)

    Sort order:; 'random' — random order

  • :count (Integer)

    Number of friends to return.

  • :offset (Integer)

    Offset needed to return a specific subset of friends.

Returns:

See Also:



1249
1250
1251
1252
1253
1254
1255
# File 'lib/vk/api/methods.rb', line 1249

def get_online(arguments = {})
  require "vk/api/friends/methods/get_online"
  method = Methods::GetOnline.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_online_response"
  Responses::GetOnlineResponse.new(response.deep_symbolize_keys)
end

#get_recent(arguments = {}) ⇒ Vk::API::Friends::Responses::GetRecentResponse

Returns a list of user IDs of the current user's recently added friends.

Parameters:

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

Options Hash (arguments):

  • :count (Integer) — default: 100

    Number of recently added friends to return.

Returns:

See Also:



1276
1277
1278
1279
1280
1281
1282
# File 'lib/vk/api/methods.rb', line 1276

def get_recent(arguments = {})
  require "vk/api/friends/methods/get_recent"
  method = Methods::GetRecent.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_recent_response"
  Responses::GetRecentResponse.new(response.deep_symbolize_keys)
end

#get_requests(arguments = {}) ⇒ Vk::API::Friends::Responses::GetRequestsResponse

Returns information about the current user's incoming and outgoing friend requests.

Parameters:

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

Options Hash (arguments):

  • :offset (Integer)

    Offset needed to return a specific subset of friend requests.

  • :count (Integer)

    Number of friend requests to return (default 100, maximum 1000).

  • :extended (Boolean)

    '1' — to return response messages from users who have sent a friend request or, if 'suggested' is set to '1', to return a list of suggested friends

  • :need_mutual (Boolean)

    '1' — to return a list of mutual friends (up to 20), if any

  • :out (Boolean)

    '1' — to return outgoing requests; '0' — to return incoming requests (default)

  • :sort (Integer)

    Sort order:; '1' — by number of mutual friends; '0' — by date

  • :suggested (Boolean)

    '1' — to return a list of suggested friends; '0' — to return friend requests (default)

Returns:

See Also:



1293
1294
1295
1296
1297
1298
1299
# File 'lib/vk/api/methods.rb', line 1293

def get_requests(arguments = {})
  require "vk/api/friends/methods/get_requests"
  method = Methods::GetRequests.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_requests_response"
  Responses::GetRequestsResponse.new(response.deep_symbolize_keys)
end

#get_suggestions(arguments = {}) ⇒ Vk::API::Friends::Responses::GetSuggestionsResponse

Returns a list of profiles of users whom the current user may know.

Parameters:

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

Options Hash (arguments):

  • :filter (Array)

    Types of potential friends to return:; 'mutual' — users with many mutual friends ; 'contacts' — users found with the method; 'mutual_contacts' — users who imported the same contacts as the current user with the method

  • :count (Integer) — default: 500

    Number of suggestions to return.

  • :offset (Integer)

    Offset needed to return a specific subset of suggestions.

  • :fields (Array, 'bdate')

    Profile fields to return. Sample values: 'nickname', 'screen_name', 'sex', 'bdate' (birthdate), 'city', 'country', 'timezone', 'photo', 'photo_medium', 'photo_big', 'has_mobile', 'rate', 'contacts', 'education', 'online', 'counters'.;

  • :name_case (String)

    Case for declension of user name and surname: ; 'nom' — nominative (default) ; 'gen' — genitive ; 'dat' — dative ; 'acc' — accusative ; 'ins' — instrumental ; 'abl' — prepositional

Returns:

See Also:



1426
1427
1428
1429
1430
1431
1432
# File 'lib/vk/api/methods.rb', line 1426

def get_suggestions(arguments = {})
  require "vk/api/friends/methods/get_suggestions"
  method = Methods::GetSuggestions.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/get_suggestions_response"
  Responses::GetSuggestionsResponse.new(response.deep_symbolize_keys)
end

#search(arguments = {}) ⇒ Vk::API::Friends::Responses::SearchResponse

Returns a list of friends matching the search criteria.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

  • :q (String)

    Search query string (e.g., 'Vasya Babich').

  • :fields (Array, 'bdate')

    Profile fields to return. Sample values: 'nickname', 'screen_name', 'sex', 'bdate' (birthdate), 'city', 'country', 'timezone', 'photo', 'photo_medium', 'photo_big', 'has_mobile', 'rate', 'contacts', 'education', 'online';

  • :name_case (String) — default: "nom"

    Case for declension of user name and surname:; 'nom' — nominative (default); 'gen' — genitive ; 'dat' — dative; 'acc' — accusative ; 'ins' — instrumental ; 'abl' — prepositional

  • :offset (Integer)

    Offset needed to return a specific subset of friends.

  • :count (Integer) — default: 20

    Number of friends to return.

Returns:

See Also:



1466
1467
1468
1469
1470
1471
1472
# File 'lib/vk/api/methods.rb', line 1466

def search(arguments = {})
  require "vk/api/friends/methods/search"
  method = Methods::Search.new(arguments)
  response = method.call(@client)
  require "vk/api/friends/responses/search_response"
  Responses::SearchResponse.new(response.deep_symbolize_keys)
end