ngrok-api 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +21 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +28 -0
- data/.rubocop_airbnb.yml +2 -0
- data/.simplecov +1 -0
- data/Gemfile +33 -0
- data/Guardfile +16 -0
- data/README.md +61 -0
- data/Rakefile +7 -0
- data/doc/NgrokAPI/Client.html +542 -0
- data/doc/NgrokAPI/Error.html +305 -0
- data/doc/NgrokAPI/Errors/NotFoundError.html +309 -0
- data/doc/NgrokAPI/Errors.html +115 -0
- data/doc/NgrokAPI/HttpClient.html +1104 -0
- data/doc/NgrokAPI/Models/ApiKey.html +1138 -0
- data/doc/NgrokAPI/Models/EndpointConfiguration.html +1366 -0
- data/doc/NgrokAPI/Models/Listable.html +934 -0
- data/doc/NgrokAPI/Models/ReservedDomain.html +2498 -0
- data/doc/NgrokAPI/Models/TlsCertificate.html +1064 -0
- data/doc/NgrokAPI/Models.html +117 -0
- data/doc/NgrokAPI/PagedIterator.html +631 -0
- data/doc/NgrokAPI/Services/ApiKeysClient.html +1333 -0
- data/doc/NgrokAPI/Services/EndpointConfigurationsClient.html +2201 -0
- data/doc/NgrokAPI/Services/ReservedDomainsClient.html +2541 -0
- data/doc/NgrokAPI/Services/TlsCertificatesClient.html +1417 -0
- data/doc/NgrokAPI/Services.html +117 -0
- data/doc/NgrokAPI.html +157 -0
- data/doc/_index.html +309 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +126 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +126 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1227 -0
- data/doc/top-level-namespace.html +110 -0
- data/docs/NgrokAPI/Client.html +542 -0
- data/docs/NgrokAPI/Error.html +305 -0
- data/docs/NgrokAPI/Errors/NotFoundError.html +309 -0
- data/docs/NgrokAPI/Errors.html +115 -0
- data/docs/NgrokAPI/HttpClient.html +1104 -0
- data/docs/NgrokAPI/Models/ApiKey.html +1138 -0
- data/docs/NgrokAPI/Models/EndpointConfiguration.html +1366 -0
- data/docs/NgrokAPI/Models/Listable.html +934 -0
- data/docs/NgrokAPI/Models/ReservedDomain.html +2498 -0
- data/docs/NgrokAPI/Models/TlsCertificate.html +1064 -0
- data/docs/NgrokAPI/Models.html +117 -0
- data/docs/NgrokAPI/PagedIterator.html +631 -0
- data/docs/NgrokAPI/Services/ApiKeysClient.html +1333 -0
- data/docs/NgrokAPI/Services/EndpointConfigurationsClient.html +2201 -0
- data/docs/NgrokAPI/Services/ReservedDomainsClient.html +2541 -0
- data/docs/NgrokAPI/Services/TlsCertificatesClient.html +1417 -0
- data/docs/NgrokAPI/Services.html +117 -0
- data/docs/NgrokAPI.html +157 -0
- data/docs/_index.html +309 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +126 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +126 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1227 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/ngrokapi/client.rb +49 -0
- data/lib/ngrokapi/error.rb +14 -0
- data/lib/ngrokapi/errors/not_found_error.rb +16 -0
- data/lib/ngrokapi/http_client.rb +132 -0
- data/lib/ngrokapi/models/api_key.rb +64 -0
- data/lib/ngrokapi/models/endpoint_configuration.rb +119 -0
- data/lib/ngrokapi/models/listable.rb +42 -0
- data/lib/ngrokapi/models/reserved_domain.rb +211 -0
- data/lib/ngrokapi/models/tls_certificate.rb +62 -0
- data/lib/ngrokapi/paged_iterator.rb +40 -0
- data/lib/ngrokapi/services/api_keys_client.rb +144 -0
- data/lib/ngrokapi/services/endpoint_configurations_client.rb +313 -0
- data/lib/ngrokapi/services/reserved_domains_client.rb +313 -0
- data/lib/ngrokapi/services/tls_certificates_client.rb +161 -0
- data/lib/ngrokapi/version.rb +7 -0
- data/lib/ngrokapi.rb +13 -0
- data/ngrok-api.gemspec +27 -0
- data/spec/ngrokapi/client_spec.rb +33 -0
- data/spec/ngrokapi/http_client_spec.rb +75 -0
- data/spec/ngrokapi/models/api_key_spec.rb +43 -0
- data/spec/ngrokapi/models/listable_spec.rb +43 -0
- data/spec/ngrokapi/models/reserved_domain_spec.rb +100 -0
- data/spec/ngrokapi/paged_iterator_spec.rb +84 -0
- data/spec/ngrokapi/services/api_keys_client_spec.rb +127 -0
- data/spec/spec_helper.rb +80 -0
- metadata +144 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Top Level Namespace
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.26
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
pathId = "";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">Top Level Namespace</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<h2>Defined Under Namespace</h2>
|
|
82
|
+
<p class="children">
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="NgrokAPI.html" title="NgrokAPI (module)">NgrokAPI</a></span>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div id="footer">
|
|
103
|
+
Generated on Fri Sep 24 19:20:29 2021 by
|
|
104
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
105
|
+
0.9.26 (ruby-3.0.1).
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</body>
|
|
110
|
+
</html>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
##
|
|
5
|
+
# Low-level api client for communicating with Ngrok's HTTP API.
|
|
6
|
+
# Use this object to instantiate your clients.
|
|
7
|
+
class Client
|
|
8
|
+
def initialize(
|
|
9
|
+
api_key:,
|
|
10
|
+
base_url: 'https://api.ngrok.com'
|
|
11
|
+
)
|
|
12
|
+
@client = NgrokAPI::HttpClient.new(api_key: api_key, base_url: base_url)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Creates and returns an instance of a NgrokAPI::Services::ApiKeysClient
|
|
17
|
+
#
|
|
18
|
+
# @return [NgrokAPI::Services::ApiKeysClient]
|
|
19
|
+
def api_keys
|
|
20
|
+
@_api_keys ||= NgrokAPI::Services::ApiKeysClient.new(client: @client)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
# Creates and returns an instance of a NgrokAPI::Services::EndpointConfigurationsClient
|
|
25
|
+
#
|
|
26
|
+
# @return [NgrokAPI::Services::EndpointConfigurationsClient]
|
|
27
|
+
def endpoint_configurations
|
|
28
|
+
@_endpoint_configurations ||= NgrokAPI::Services::EndpointConfigurationsClient.new(
|
|
29
|
+
client: @client
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Creates and returns an instance of a NgrokAPI::Services::ReservedDomainsClient
|
|
35
|
+
#
|
|
36
|
+
# @return [NgrokAPI::Services::ReservedDomainsClient]
|
|
37
|
+
def reserved_domains
|
|
38
|
+
@_reserved_domains ||= NgrokAPI::Services::ReservedDomainsClient.new(client: @client)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
# Creates and returns an instance of a NgrokAPI::Services::TlsCertificatesClient
|
|
43
|
+
#
|
|
44
|
+
# @return [NgrokAPI::Services::TlsCertificatesClient]
|
|
45
|
+
def tls_certificates
|
|
46
|
+
@_tls_certificates ||= NgrokAPI::Services::TlsCertificatesClient.new(client: @client)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
##
|
|
5
|
+
# Base Error class for all Ngrok Errors
|
|
6
|
+
class Error < StandardError
|
|
7
|
+
attr_reader :response
|
|
8
|
+
|
|
9
|
+
def initialize(msg: "An error occurred with the NgrokAPI", response: nil)
|
|
10
|
+
@response = response
|
|
11
|
+
super(msg)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
module Errors
|
|
5
|
+
##
|
|
6
|
+
# Error representing a 404 not found
|
|
7
|
+
class NotFoundError < NgrokAPI::Error
|
|
8
|
+
attr_reader :response
|
|
9
|
+
|
|
10
|
+
def initialize(msg: "Resource not found", response: nil)
|
|
11
|
+
@response = response
|
|
12
|
+
super(msg: msg, response: response)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
##
|
|
5
|
+
# Low-level api client for communicating with Ngrok's HTTP API using HTTP. You should not have
|
|
6
|
+
# to use this class directly, but use the individual clients to make your API calls.
|
|
7
|
+
class HttpClient
|
|
8
|
+
attr_reader :api_key,
|
|
9
|
+
:base_url
|
|
10
|
+
|
|
11
|
+
def initialize(
|
|
12
|
+
api_key:,
|
|
13
|
+
base_url: 'https://api.ngrok.com'
|
|
14
|
+
)
|
|
15
|
+
@api_key = api_key
|
|
16
|
+
@base_url = base_url
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# Make a DELETE request to a given URI
|
|
21
|
+
#
|
|
22
|
+
# @param [string] path URL resource path.
|
|
23
|
+
# @param [boolean] danger determine if we should throw an exception on 404 or not
|
|
24
|
+
# @return [nil]
|
|
25
|
+
def delete(path, danger: false)
|
|
26
|
+
uri = get_uri(path)
|
|
27
|
+
req = Net::HTTP::Delete.new(uri, headers)
|
|
28
|
+
json_do(uri, req, danger: danger)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Make a GET request to a given URI with optional data
|
|
33
|
+
#
|
|
34
|
+
# @param [string] path URL resource path
|
|
35
|
+
# @param [boolean] danger determine if we should throw an exception on 404 or not
|
|
36
|
+
# @param [hash] data hash which will be converted to query parameters or form data
|
|
37
|
+
# @return [json] response body
|
|
38
|
+
def get(path, danger: false, data: {})
|
|
39
|
+
uri = get_uri(path, data: data)
|
|
40
|
+
req = Net::HTTP::Get.new(uri, headers)
|
|
41
|
+
json_do(uri, req, danger: danger)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
# Make a GET request
|
|
46
|
+
#
|
|
47
|
+
# @param [string] before_id URL resource path
|
|
48
|
+
# @param [integer] limit URL resource path
|
|
49
|
+
# @param [string] path resource path, mutually exclusive with url
|
|
50
|
+
# @param [string] url Full URL of the resource, mutually exclusive with path
|
|
51
|
+
# @return [json] response body
|
|
52
|
+
def list(before_id: nil, limit: nil, path: nil, url: nil)
|
|
53
|
+
if url
|
|
54
|
+
get(url)
|
|
55
|
+
else
|
|
56
|
+
data = {}
|
|
57
|
+
data[:before_id] = before_id if before_id
|
|
58
|
+
data[:limit] = limit if limit
|
|
59
|
+
get(path, data: data)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
##
|
|
64
|
+
# Make a PATCH request to a given URI with optional data
|
|
65
|
+
#
|
|
66
|
+
# @param [string] path URL resource path
|
|
67
|
+
# @param [boolean] danger determine if we should throw an exception on 404 or not
|
|
68
|
+
# @param [hash] data hash which will be converted to query parameters or form data
|
|
69
|
+
# @return [json] response body
|
|
70
|
+
def patch(path, danger: false, data: {})
|
|
71
|
+
uri = get_uri(path)
|
|
72
|
+
req = Net::HTTP::Patch.new(uri, headers_with_json)
|
|
73
|
+
json_do(uri, req, danger: danger, data: data.to_json)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
# Make a POST request to a given URI with optional data
|
|
78
|
+
#
|
|
79
|
+
# @param [string] path URL resource path
|
|
80
|
+
# @param [boolean] danger determine if we should throw an exception on 404 or not
|
|
81
|
+
# @param [hash] data hash which will be converted to query parameters or form data
|
|
82
|
+
# @return [json] response body
|
|
83
|
+
def post(path, danger: false, data: {})
|
|
84
|
+
uri = get_uri(path)
|
|
85
|
+
req = Net::HTTP::Post.new(uri, headers_with_json)
|
|
86
|
+
json_do(uri, req, danger: danger, data: data.to_json)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
private
|
|
90
|
+
|
|
91
|
+
def headers
|
|
92
|
+
{
|
|
93
|
+
'Authorization': "Bearer #{@api_key}",
|
|
94
|
+
'Ngrok-Version': '2',
|
|
95
|
+
}
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def headers_with_json
|
|
99
|
+
headers.merge({ 'Content-Type': 'application/json' })
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def json_do(uri, req, danger: false, data: nil)
|
|
103
|
+
resp = Net::HTTP.start(uri.hostname, uri.port, req_options(uri)) do |http|
|
|
104
|
+
http.request(req, data)
|
|
105
|
+
end
|
|
106
|
+
if danger
|
|
107
|
+
if resp.code.to_i == 404
|
|
108
|
+
raise NgrokAPI::Errors::NotFoundError.new(response: resp)
|
|
109
|
+
elsif resp.code.to_i >= 400
|
|
110
|
+
raise NgrokAPI::Error.new(response: resp)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
if resp.body && resp.body != ''
|
|
114
|
+
JSON.parse(resp.body)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def req_options(uri)
|
|
119
|
+
{ use_ssl: uri.scheme == 'https' }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def get_uri(path, data: nil)
|
|
123
|
+
data = (!data.nil? && data != {}) ? "?#{URI.encode_www_form(data)}" : ""
|
|
124
|
+
URI("#{url(path)}#{data}")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def url(path)
|
|
128
|
+
path = path.delete_prefix(@base_url)
|
|
129
|
+
"#{@base_url}#{path}"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
module Models
|
|
5
|
+
##
|
|
6
|
+
# A resource representing data from the api_keys API
|
|
7
|
+
class ApiKey
|
|
8
|
+
attr_reader :id,
|
|
9
|
+
:client,
|
|
10
|
+
:created_at,
|
|
11
|
+
:description,
|
|
12
|
+
:metadata,
|
|
13
|
+
:result,
|
|
14
|
+
:token,
|
|
15
|
+
:uri
|
|
16
|
+
|
|
17
|
+
def initialize(client:, result:)
|
|
18
|
+
@client = client
|
|
19
|
+
@result = result
|
|
20
|
+
@created_at = @result['created_at']
|
|
21
|
+
@id = @result['id']
|
|
22
|
+
@description = @result['description']
|
|
23
|
+
@metadata = @result['metadata']
|
|
24
|
+
@token = @result['token']
|
|
25
|
+
@uri = @result['uri']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def ==(other)
|
|
29
|
+
@result == other.result
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_s
|
|
33
|
+
@result.to_s
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Delete this API key.
|
|
38
|
+
#
|
|
39
|
+
# @return [nil] result from delete request
|
|
40
|
+
#
|
|
41
|
+
# https://ngrok.com/docs/api#api-api-keys-delete
|
|
42
|
+
def delete
|
|
43
|
+
@client.delete(id: @id)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# rubocop:disable LineLength
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Update the attributes of this API key.
|
|
50
|
+
#
|
|
51
|
+
# @param [string] description human-readable description of what uses the API key to authenticate. optional, max 255 bytes.
|
|
52
|
+
# @param [string] metadata arbitrary user-defined data of this API key. optional, max 4096 bytes
|
|
53
|
+
# @return [NgrokAPI::Models::ApiKey] result from update request
|
|
54
|
+
#
|
|
55
|
+
# https://ngrok.com/docs/api#api-api-keys-update
|
|
56
|
+
def update(description: nil, metadata: nil)
|
|
57
|
+
@description = description if description
|
|
58
|
+
@metadata = metadata if metadata
|
|
59
|
+
@client.update(id: @id, description: description, metadata: metadata)
|
|
60
|
+
end
|
|
61
|
+
# rubocop:enable LineLength
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
module Models
|
|
5
|
+
##
|
|
6
|
+
# A resource representing data from the endpoint_configuration API
|
|
7
|
+
class EndpointConfiguration
|
|
8
|
+
attr_reader :id,
|
|
9
|
+
:client,
|
|
10
|
+
:created_at,
|
|
11
|
+
:description,
|
|
12
|
+
:metadata,
|
|
13
|
+
:result,
|
|
14
|
+
:uri
|
|
15
|
+
|
|
16
|
+
def initialize(client:, result:)
|
|
17
|
+
@client = client
|
|
18
|
+
@result = result
|
|
19
|
+
@created_at = @result['created_at']
|
|
20
|
+
@id = @result['id']
|
|
21
|
+
@description = @result['description']
|
|
22
|
+
@metadata = @result['metadata']
|
|
23
|
+
@uri = @result['uri']
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def ==(other)
|
|
27
|
+
@result == other.result
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def to_s
|
|
31
|
+
@result.to_s
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# Delete this endpoint configuration.
|
|
36
|
+
#
|
|
37
|
+
# @return [nil] result from delete request
|
|
38
|
+
#
|
|
39
|
+
# https://ngrok.com/docs/api#api-endpoint-configurations-delete
|
|
40
|
+
def delete
|
|
41
|
+
@client.delete(id: @id)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# rubocop:disable LineLength
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Update this endpoint configuration. If a module is not specified in the update, it will not be modified.
|
|
48
|
+
# However, each module configuration that is specified will completely replace the existing value.
|
|
49
|
+
# There is no way to delete an existing module via this API, instead use the delete module API.
|
|
50
|
+
#
|
|
51
|
+
# @param [string] description human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes
|
|
52
|
+
# @param [string] metadata arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.
|
|
53
|
+
# @param [string] circuit_breaker circuit breaker module configuration
|
|
54
|
+
# @param [string] compression compression module configuration
|
|
55
|
+
# @param [string] request_headers request headers module configuration
|
|
56
|
+
# @param [string] response_headers response headers module configuration
|
|
57
|
+
# @param [string] ip_policy ip policy module configuration
|
|
58
|
+
# @param [string] mutual_tls mutual TLS module configuration
|
|
59
|
+
# @param [string] tls_termination TLS termination module configuration
|
|
60
|
+
# @param [string] webhook_validation webhook validation module configuration
|
|
61
|
+
# @param [string] oauth oauth module configuration
|
|
62
|
+
# @param [string] logging logging module configuration
|
|
63
|
+
# @param [string] saml saml module configuration
|
|
64
|
+
# @param [string] oidc oidc module configuration
|
|
65
|
+
# @return [NgrokAPI::Models::EndpointConfiguration] result from update request
|
|
66
|
+
#
|
|
67
|
+
# https://ngrok.com/docs/api#api-endpoint-configurations-update
|
|
68
|
+
def update(
|
|
69
|
+
description: nil,
|
|
70
|
+
metadata: nil,
|
|
71
|
+
circuit_breaker: nil,
|
|
72
|
+
compression: nil,
|
|
73
|
+
request_headers: nil,
|
|
74
|
+
response_headers: nil,
|
|
75
|
+
ip_policy: nil,
|
|
76
|
+
mutual_tls: nil,
|
|
77
|
+
tls_termination: nil,
|
|
78
|
+
webhook_validation: nil,
|
|
79
|
+
oauth: nil,
|
|
80
|
+
logging: nil,
|
|
81
|
+
saml: nil,
|
|
82
|
+
oidc: nil
|
|
83
|
+
)
|
|
84
|
+
@description = description if description
|
|
85
|
+
@metadata = metadata if metadata
|
|
86
|
+
@circuit_breaker = circuit_breaker if circuit_breaker
|
|
87
|
+
@compression = compression if compression
|
|
88
|
+
@request_headers = request_headers if request_headers
|
|
89
|
+
@response_headers = response_headers if response_headers
|
|
90
|
+
@ip_policy = ip_policy if ip_policy
|
|
91
|
+
@mutual_tls = mutual_tls if mutual_tls
|
|
92
|
+
@tls_termination = tls_termination if tls_termination
|
|
93
|
+
@webhook_validation = webhook_validation if webhook_validation
|
|
94
|
+
@oauth = oauth if oauth
|
|
95
|
+
@logging = logging if logging
|
|
96
|
+
@saml = saml if saml
|
|
97
|
+
@oidc = oidc if oidc
|
|
98
|
+
@client.update(
|
|
99
|
+
id: @id,
|
|
100
|
+
description: description,
|
|
101
|
+
metadata: metadata,
|
|
102
|
+
circuit_breaker: circuit_breaker,
|
|
103
|
+
compression: compression,
|
|
104
|
+
request_headers: request_headers,
|
|
105
|
+
response_headers: response_headers,
|
|
106
|
+
ip_policy: ip_policy,
|
|
107
|
+
mutual_tls: mutual_tls,
|
|
108
|
+
tls_termination: tls_termination,
|
|
109
|
+
webhook_validation: webhook_validation,
|
|
110
|
+
oauth: oauth,
|
|
111
|
+
logging: logging,
|
|
112
|
+
saml: saml,
|
|
113
|
+
oidc: oidc
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
# rubocop:enable LineLength
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NgrokAPI
|
|
4
|
+
module Models
|
|
5
|
+
##
|
|
6
|
+
# A resource representing multiple instances from a given "list" API call
|
|
7
|
+
class Listable
|
|
8
|
+
attr_reader :client,
|
|
9
|
+
:klass,
|
|
10
|
+
:iter,
|
|
11
|
+
:items,
|
|
12
|
+
:list_property,
|
|
13
|
+
:next_page_uri,
|
|
14
|
+
:result,
|
|
15
|
+
:uri
|
|
16
|
+
|
|
17
|
+
def initialize(client:, result:, list_property:, klass:)
|
|
18
|
+
@client = client
|
|
19
|
+
@result = result
|
|
20
|
+
@list_property = list_property
|
|
21
|
+
@next_page_uri = @result['next_page_uri']
|
|
22
|
+
@uri = @result['uri']
|
|
23
|
+
@items = @result[list_property].map do |item|
|
|
24
|
+
klass.new(client: client, result: item)
|
|
25
|
+
end
|
|
26
|
+
@iter = NgrokAPI::PagedIterator.new(
|
|
27
|
+
client: client,
|
|
28
|
+
page: self,
|
|
29
|
+
list_property: list_property
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def ==(other)
|
|
34
|
+
@result == other.result
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def to_s
|
|
38
|
+
@result.to_s
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|