Class: NgrokAPI::Services::HTTPResponseBackendsClient

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#clientObject (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

Parameters:

  • description (string) (defaults to: "")

    human-readable description of this backend. Optional

  • metadata (string) (defaults to: "")

    arbitrary user-defined machine-readable data of this backend. Optional

  • body (string) (defaults to: "")

    body to return as fixed content

  • headers (Map<string, string>) (defaults to: {})

    headers to return

  • status_code (int32) (defaults to: nil)

    status code to return

Returns:



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

Parameters:

  • description (string) (defaults to: "")

    human-readable description of this backend. Optional

  • metadata (string) (defaults to: "")

    arbitrary user-defined machine-readable data of this backend. Optional

  • body (string) (defaults to: "")

    body to return as fixed content

  • headers (Map<string, string>) (defaults to: {})

    headers to return

  • status_code (int32) (defaults to: nil)

    status code to return

Returns:



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

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



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

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



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

Parameters:

  • before_id (string) (defaults to: nil)
  • limit (string) (defaults to: nil)
  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



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

Parameters:

  • before_id (string) (defaults to: nil)
  • limit (string) (defaults to: nil)
  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



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

Parameters:

  • id (string) (defaults to: "")
  • description (string) (defaults to: nil)

    human-readable description of this backend. Optional

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this backend. Optional

  • body (string) (defaults to: nil)

    body to return as fixed content

  • headers (Map<string, string>) (defaults to: nil)

    headers to return

  • status_code (int32) (defaults to: nil)

    status code to return

Returns:



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

Parameters:

  • id (string) (defaults to: "")
  • description (string) (defaults to: nil)

    human-readable description of this backend. Optional

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this backend. Optional

  • body (string) (defaults to: nil)

    body to return as fixed content

  • headers (Map<string, string>) (defaults to: nil)

    headers to return

  • status_code (int32) (defaults to: nil)

    status code to return

Returns:



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