Class: NgrokAPI::Services::AbuseReportsClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::AbuseReportsClient
- 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.
Constant Summary collapse
- PATH =
The API path for the requests
'/abuse_reports'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(urls:, metadata: "") ⇒ NgrokAPI::Models::AbuseReport
Creates a new abuse report which will be reviewed by our system and abuse response team.
-
#create!(urls:, metadata: "") ⇒ NgrokAPI::Models::AbuseReport
Creates a new abuse report which will be reviewed by our system and abuse response team.
-
#get(id: "") ⇒ NgrokAPI::Models::AbuseReport
Get the detailed status of abuse report by ID.
-
#get!(id: "") ⇒ NgrokAPI::Models::AbuseReport
Get the detailed status of abuse report by ID.
-
#initialize(client:) ⇒ AbuseReportsClient
constructor
A new instance of AbuseReportsClient.
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
#client ⇒ Object (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 abuse@ngrok.com to request access
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 abuse@ngrok.com to request access Throws an exception if API error.
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.
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.
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 |