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.



15
16
17
# File 'lib/ngrokapi/services/http_response_backends_client.rb', line 15

def initialize(client:)
  @client = client
end

Instance Attribute Details

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

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:



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

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:



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

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

Parameters:

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

    a resource identifier

Returns:



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

Parameters:

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

    a resource identifier

Returns:



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

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:



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

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:



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

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:



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

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:



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