Class: Vk::API::Users

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/users/user.rb,
lib/vk/api/users/career.rb,
lib/vk/api/users/school.rb,
lib/vk/api/users/military.rb,
lib/vk/api/users/personal.rb,
lib/vk/api/users/relative.rb,
lib/vk/api/users/user_lim.rb,
lib/vk/api/users/user_min.rb,
lib/vk/api/users/last_seen.rb,
lib/vk/api/users/user_full.rb,
lib/vk/api/users/crop_photo.rb,
lib/vk/api/users/occupation.rb,
lib/vk/api/users/university.rb,
lib/vk/api/users/methods/get.rb,
lib/vk/api/users/users_array.rb,
lib/vk/api/users/user_counters.rb,
lib/vk/api/users/user_xtr_type.rb,
lib/vk/api/users/methods/report.rb,
lib/vk/api/users/methods/search.rb,
lib/vk/api/users/user_broadcast.rb,
lib/vk/api/users/user_xtr_counters.rb,
lib/vk/api/users/methods/get_nearby.rb,
lib/vk/api/users/user_full_xtr_type.rb,
lib/vk/api/users/methods/is_app_user.rb,
lib/vk/api/users/methods/get_followers.rb,
lib/vk/api/users/responses/get_response.rb,
lib/vk/api/users/methods/get_subscriptions.rb,
lib/vk/api/users/responses/report_response.rb,
lib/vk/api/users/responses/search_response.rb,
lib/vk/api/users/responses/get_nearby_response.rb,
lib/vk/api/users/responses/is_app_user_response.rb,
lib/vk/api/users/responses/get_followers_response.rb,
lib/vk/api/users/responses/get_subscriptions_response.rb

Defined Under Namespace

Modules: Methods, Responses Classes: Career, CropPhoto, LastSeen, Military, Occupation, Personal, Relative, School, University, User, UserBroadcast, UserCounters, UserFull, UserFullXtrType, UserLim, UserMin, UserXtrCounters, UserXtrType, UsersArray

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

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

Returns detailed information on users.

Parameters:

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

Options Hash (arguments):

  • :user_ids (Array)

    User IDs or screen names ('screen_name'). By default, current user ID.

  • :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', 'contacts', 'education', 'online', 'counters', 'relation', 'last_seen', 'activity', 'can_write_private_message', 'can_see_all_posts', 'can_post', 'universities';

  • :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:



27
28
29
30
31
32
33
# File 'lib/vk/api/methods.rb', line 27

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

#get_followers(arguments = {}) ⇒ Vk::API::Users::Responses::GetFollowersResponse

Returns a list of IDs of followers of the user in question, sorted by date added, most recent first.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

  • :offset (Integer)

    Offset needed to return a specific subset of followers.

  • :count (Integer) — default: 100

    Number of followers to return.

  • :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)

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

Returns:

See Also:



111
112
113
114
115
116
117
# File 'lib/vk/api/methods.rb', line 111

def get_followers(arguments = {})
  require "vk/api/users/methods/get_followers"
  method = Methods::GetFollowers.new(arguments)
  response = method.call(@client)
  require "vk/api/users/responses/get_followers_response"
  Responses::GetFollowersResponse.new(response.deep_symbolize_keys)
end

#get_nearby(arguments = {}) ⇒ Vk::API::Users::Responses::GetNearbyResponse

Returns Indexes current user location and returns nearby users.

Parameters:

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

Options Hash (arguments):

  • :latitude (Number)

    geographic latitude of the place a user is located, in degrees (from -90 to 90)

  • :longitude (Number)

    geographic longitude of the place a user is located, in degrees (from -180 to 180)

  • :accuracy (Integer)

    current location accuracy in meters

  • :timeout (Integer) — default: 7200

    time when a user disappears from location search results, in seconds

  • :radius (Integer) — default: 1

    search zone radius type (1 to 4); :* 1 – 300 m;; :* 2 – 2400 m;; :* 3 – 18 km;; :* 4 – 150 km.

  • :fields (Array)

    list of additional fields to return.; Available values: sex, bdate, city, country, photo_50, photo_100, photo_200_orig, photo_200, photo_400_orig, photo_max, photo_max_orig, online, online_mobile, domain, has_mobile, contacts, connections, site, education, universities, schools, can_post, can_see_all_posts, can_see_audio, can_write_private_message, status, last_seen, common_count, relation, relatives, counters, screen_name, maiden_name, timezone, occupation

  • :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:



141
142
143
144
145
146
147
# File 'lib/vk/api/methods.rb', line 141

def get_nearby(arguments = {})
  require "vk/api/users/methods/get_nearby"
  method = Methods::GetNearby.new(arguments)
  response = method.call(@client)
  require "vk/api/users/responses/get_nearby_response"
  Responses::GetNearbyResponse.new(response.deep_symbolize_keys)
end

#get_subscriptions(arguments = {}) ⇒ Vk::API::Users::Responses::GetSubscriptionsResponse

Returns a list of IDs of users and communities followed by the user.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    User ID.

  • :extended (Boolean)

    '1' — to return a combined list of users and communities; '0' — to return separate lists of users and communities (default)

  • :offset (Integer)

    Offset needed to return a specific subset of subscriptions.

  • :count (Integer) — default: 20

    Number of users and communities to return.

  • :fields (Array)

Returns:

See Also:



96
97
98
99
100
101
102
# File 'lib/vk/api/methods.rb', line 96

def get_subscriptions(arguments = {})
  require "vk/api/users/methods/get_subscriptions"
  method = Methods::GetSubscriptions.new(arguments)
  response = method.call(@client)
  require "vk/api/users/responses/get_subscriptions_response"
  Responses::GetSubscriptionsResponse.new(response.deep_symbolize_keys)
end

#is_app_user(arguments = {}) ⇒ Vk::API::Users::Responses::IsAppUserResponse

Returns information whether a user installed the application.

Parameters:

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

Options Hash (arguments):

Returns:

See Also:



81
82
83
84
85
86
87
# File 'lib/vk/api/methods.rb', line 81

def is_app_user(arguments = {})
  require "vk/api/users/methods/is_app_user"
  method = Methods::IsAppUser.new(arguments)
  response = method.call(@client)
  require "vk/api/users/responses/is_app_user_response"
  Responses::IsAppUserResponse.new(response.deep_symbolize_keys)
end

#report(arguments = {}) ⇒ Vk::API::Users::Responses::ReportResponse

Returns Reports (submits a complain about) a user.;.

Parameters:

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

Options Hash (arguments):

  • :user_id (Integer)

    ID of the user about whom a complaint is being made.

  • :type (String)

    Type of complaint:; 'porn' – pornography; 'spam' – spamming; 'insult' – abusive behavior; 'advertisment' – disruptive advertisements

  • :comment (String)

    Comment describing the complaint.

Returns:

See Also:



124
125
126
127
128
129
130
# File 'lib/vk/api/methods.rb', line 124

def report(arguments = {})
  require "vk/api/users/methods/report"
  method = Methods::Report.new(arguments)
  response = method.call(@client)
  require "vk/api/users/responses/report_response"
  Responses::ReportResponse.new(response.deep_symbolize_keys)
end

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

Returns a list of users matching the search criteria.

Parameters:

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

Options Hash (arguments):

  • :q (String)

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

  • :sort (Integer)

    Sort order:; '1' — by date registered; '0' — by rating

  • :offset (Integer)

    Offset needed to return a specific subset of users.

  • :count (Integer) — default: 20

    Number of users to return.

  • :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';

  • :city (Integer)

    City ID.

  • :country (Integer)

    Country ID.

  • :hometown (String)

    City name in a string.

  • :university_country (Integer)

    ID of the country where the user graduated.

  • :university (Integer)

    ID of the institution of higher education.

  • :university_year (Integer)

    Year of graduation from an institution of higher education.

  • :university_faculty (Integer)

    Faculty ID.

  • :university_chair (Integer)

    Chair ID.

  • :sex (Integer)

    '1' — female; '2' — male; '0' — any (default)

  • :status (Integer)

    Relationship status:; '1' — Not married; '2' — In a relationship; '3' — Engaged; '4' — Married; '5' — It's complicated; '6' — Actively searching; '7' — In love

  • :age_from (Integer)

    Minimum age.

  • :age_to (Integer)

    Maximum age.

  • :birth_day (Integer)

    Day of birth.

  • :birth_month (Integer)

    Month of birth.

  • :birth_year (Integer)

    Year of birth.

  • :online (Boolean)

    '1' — online only; '0' — all users

  • :has_photo (Boolean)

    '1' — with photo only; '0' — all users

  • :school_country (Integer)

    ID of the country where users finished school.

  • :school_city (Integer)

    ID of the city where users finished school.

  • :school_class (Integer)
  • :school (Integer)

    ID of the school.

  • :school_year (Integer)

    School graduation year.

  • :religion (String)

    Users' religious affiliation.

  • :interests (String)

    Users' interests.

  • :company (String)

    Name of the company where users work.

  • :position (String)

    Job position.

  • :group_id (Integer)

    ID of a community to search in communities.

  • :from_list (Array)

Returns:

See Also:



70
71
72
73
74
75
76
# File 'lib/vk/api/methods.rb', line 70

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