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.
17 18 19 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 17 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
15 16 17 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 15 def client @client end |
Instance Method Details
#create(description: "", metadata: "", body: "", headers: {}, status_code: nil) ⇒ NgrokAPI::Models::HTTPResponseBackend
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 30 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
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 53 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
72 73 74 75 76 77 78 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 72 def delete(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
85 86 87 88 89 90 91 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 85 def delete!(id: "") path = '/backends/http_response/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::HTTPResponseBackend
98 99 100 101 102 103 104 105 106 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 98 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
113 114 115 116 117 118 119 120 121 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 113 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
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 130 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
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 153 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
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 181 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
206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 206 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 |