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
- #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, attrs: result) end |
#create!(description: "", metadata: "", body: "", headers: {}, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 51 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, danger: true) NgrokAPI::Models::HTTPResponseBackend.new(client: self, attrs: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
70 71 72 73 74 75 76 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 70 def delete(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
83 84 85 86 87 88 89 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 83 def delete!(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
96 97 98 99 100 101 102 103 104 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 96 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, attrs: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
111 112 113 114 115 116 117 118 119 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 111 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, attrs: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 128 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, attrs: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::HTTPResponseBackend ) end |
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 151 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, attrs: 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
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 179 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, attrs: result) end |
#update!(id: "", description: nil, metadata: nil, body: nil, headers: nil, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 204 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, attrs: result) end |