Class: NgrokAPI::Services::AbuseReportsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/services/abuse_reports_client.rb

Overview

Abuse Reports allow you to submit take-down requests for URLs hosted by ngrok that violate ngrok's terms of service.

https://ngrok.com/docs/api#api-abuse-reports

Constant Summary collapse

PATH =

The API path for the requests

'/abuse_reports'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AbuseReportsClient

Returns a new instance of AbuseReportsClient.



18
19
20
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 18

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



16
17
18
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 16

def client
  @client
end

Instance Method Details

#create(urls:, metadata: "") ⇒ NgrokAPI::Models::AbuseReport

Creates a new abuse report which will be reviewed by our system and abuse response team. This API is only available to authorized accounts. Contact [email protected] to request access

https://ngrok.com/docs/api#api-abuse-reports-create

Parameters:

  • urls (List<uri (string)>)

    a list of URLs containing suspected abusive content

  • metadata (string) (defaults to: "")

    arbitrary user-defined data about this abuse report. Optional, max 4096 bytes.

Returns:



32
33
34
35
36
37
38
39
40
41
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 32

def create(urls:, metadata: "")
  path = '/abuse_reports'
  replacements = {
  }
  data = {}
  data[:urls] = urls if urls
  data[:metadata] =  if 
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::AbuseReport.new(client: self, attrs: result)
end

#create!(urls:, metadata: "") ⇒ NgrokAPI::Models::AbuseReport

Creates a new abuse report which will be reviewed by our system and abuse response team. This API is only available to authorized accounts. Contact [email protected] to request access Throws an exception if API error.

https://ngrok.com/docs/api#api-abuse-reports-create

Parameters:

  • urls (List<uri (string)>)

    a list of URLs containing suspected abusive content

  • metadata (string) (defaults to: "")

    arbitrary user-defined data about this abuse report. Optional, max 4096 bytes.

Returns:



54
55
56
57
58
59
60
61
62
63
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 54

def create!(urls:, metadata: "")
  path = '/abuse_reports'
  replacements = {
  }
  data = {}
  data[:urls] = urls if urls
  data[:metadata] =  if 
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::AbuseReport.new(client: self, attrs: result)
end

#get(id: "") ⇒ NgrokAPI::Models::AbuseReport

Get the detailed status of abuse report by ID.

https://ngrok.com/docs/api#api-abuse-reports-get

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



72
73
74
75
76
77
78
79
80
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 72

def get(id: "")
  path = '/abuse_reports/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::AbuseReport.new(client: self, attrs: result)
end

#get!(id: "") ⇒ NgrokAPI::Models::AbuseReport

Get the detailed status of abuse report by ID. Throws an exception if API error.

https://ngrok.com/docs/api#api-abuse-reports-get

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



90
91
92
93
94
95
96
97
98
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 90

def get!(id: "")
  path = '/abuse_reports/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::AbuseReport.new(client: self, attrs: result)
end