Class: NgrokAPI::Services::HTTPResponseBackendsClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::HTTPResponseBackendsClient
- Defined in:
- lib/ngrokapi/services/http_response_backends_client.rb
Overview
Constant Summary collapse
- PATH =
The API path for the requests
'/backends/http_response'- LIST_PROPERTY =
The List Property from the resulting API for list calls
'backends'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create(description: "", metadata: "", body: "", headers: {}, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
- #delete(id: "") ⇒ NgrokAPI::Models::Empty
- #delete!(id: "") ⇒ NgrokAPI::Models::Empty
- #get(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
- #get!(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
-
#initialize(client:) ⇒ HTTPResponseBackendsClient
constructor
A new instance of HTTPResponseBackendsClient.
- #list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
- #list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
- #update(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
- #update!(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
Constructor Details
#initialize(client:) ⇒ HTTPResponseBackendsClient
Returns a new instance of HTTPResponseBackendsClient.
15 16 17 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 15 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 13 def client @client end |
Instance Method Details
#create(description: "", metadata: "", body: "", headers: {}, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 28 def create(description: "", metadata: "", body: "", headers: {}, status_code: nil) path = '/backends/http_response' replacements = { } data = {} data[:description] = description if description data[:metadata] = if data[:body] = body if body data[:headers] = headers if headers data[:status_code] = status_code if status_code result = @client.post(path % replacements, data: data) NgrokAPI::Models::HTTPResponseBackend.new(client: self, result: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
47 48 49 50 51 52 53 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 47 def delete(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
60 61 62 63 64 65 66 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 60 def delete!(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
73 74 75 76 77 78 79 80 81 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 73 def get(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::HTTPResponseBackend.new(client: self, result: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
88 89 90 91 92 93 94 95 96 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 88 def get!(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::HTTPResponseBackend.new(client: self, result: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 105 def list(before_id: nil, limit: nil, url: nil) result = @client.list( before_id: before_id, limit: limit, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, result: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::HTTPResponseBackend ) end |
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 129 def list!(before_id: nil, limit: nil, url: nil) result = @client.list( before_id: before_id, limit: limit, danger: true, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, result: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::HTTPResponseBackend, danger: true ) end |
#update(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 158 def update(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) path = '/backends/http_response/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if data[:body] = body if body data[:headers] = headers if headers data[:status_code] = status_code if status_code result = @client.patch(path % replacements, data: data) NgrokAPI::Models::HTTPResponseBackend.new(client: self, result: result) end |
#update!(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 183 def update!(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) path = '/backends/http_response/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if data[:body] = body if body data[:headers] = headers if headers data[:status_code] = status_code if status_code result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::HTTPResponseBackend.new(client: self, result: result) end |