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.

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.



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

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/ngrokapi/services/abuse_reports_client.rb', line 14

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 abuse@ngrok.com to request access

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:



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

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 abuse@ngrok.com to request access Throws an exception if API error.

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:



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

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.

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

Parameters:

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

    a resource identifier

Returns:



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

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.

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

Parameters:

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

    a resource identifier

Returns:



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

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