Class: Onlyfans::Resources::Users::Restrict

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/users/restrict.rb

Overview

APIs for fetching OnlyFans users

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Restrict

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Restrict.

Parameters:



66
67
68
# File 'lib/onlyfans/resources/users/restrict.rb', line 66

def initialize(client:)
  @client = client
end

Instance Method Details

#create(user_id, account:, request_options: {}) ⇒ Onlyfans::Models::Users::RestrictCreateResponse

Restrict a user. You will not see messages or comments from this them.

Parameters:

  • user_id (String)

    The OnlyFans ID of the user to restrict.

  • account (String)

    The Account ID

  • request_options (Onlyfans::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/onlyfans/resources/users/restrict.rb', line 21

def create(user_id, params)
  parsed, options = Onlyfans::Users::RestrictCreateParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["api/%1$s/users/%2$s/restrict", , user_id],
    model: Onlyfans::Models::Users::RestrictCreateResponse,
    options: options
  )
end

#delete(user_id, account:, request_options: {}) ⇒ Onlyfans::Models::Users::RestrictDeleteResponse

Unrestrict a previously restricted user. You will start seeing messages and comments from them again.

Parameters:

  • user_id (String)

    The OnlyFans ID of the user to restrict.

  • account (String)

    The Account ID

  • request_options (Onlyfans::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/onlyfans/resources/users/restrict.rb', line 49

def delete(user_id, params)
  parsed, options = Onlyfans::Users::RestrictDeleteParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/%1$s/users/%2$s/restrict", , user_id],
    model: Onlyfans::Models::Users::RestrictDeleteResponse,
    options: options
  )
end