Class: Plagscan::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/plagscan/users.rb

Overview

PlagScan users API

Class Method Summary collapse

Class Method Details

.get(access_token:, user_id:) ⇒ Hash

User get REST API For more details, see api.plagscan.com/v3docs/#api-User-GetUser

Parameters:

  • user_id (Number)

    PlagScan user ID

Returns:

  • (Hash)

    containing data from a User



32
33
34
35
36
37
# File 'lib/plagscan/users.rb', line 32

def self.get(access_token:, user_id:)
  Plagscan::Request.json_request(
    "users/#{user_id}",
    access_token: access_token
  )&.[](:data)
end

.list(access_token:, **options) ⇒ Array

User get REST API For more details, see api.plagscan.com/v3docs/#api-User-ListUser

Parameters:

  • start (Number)

    The start position of the list (optional)

  • limit (Number)

    The limit of results returned (optional)

Returns:

  • (Array)

    containing array of data for Users



16
17
18
19
20
21
22
23
# File 'lib/plagscan/users.rb', line 16

def self.list(access_token:, **options)
  list_props = options.delete_if { |k, _| !%i[start limit].include? k }

  Plagscan::Request.json_request(
    'users',
    access_token: access_token, body: list_props
  )&.[](:data)
end