Class: NgrokAPI::Services::ApplicationUsersClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/services/application_users_client.rb

Overview

Constant Summary collapse

PATH =

The API path for the requests

'/app/users/%{id}'
LIST_PROPERTY =

The List Property from the resulting API for list calls

'application_users'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ApplicationUsersClient

Returns a new instance of ApplicationUsersClient.



17
18
19
# File 'lib/ngrokapi/services/application_users_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/application_users_client.rb', line 15

def client
  @client
end

Instance Method Details

#delete(id: "") ⇒ NgrokAPI::Models::Empty

Delete an application user by ID.

ngrok.com/docs/api#api-application-users-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



63
64
65
66
67
68
69
# File 'lib/ngrokapi/services/application_users_client.rb', line 63

def delete(id: "")
  path = '/app/users/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements)
end

#delete!(id: "") ⇒ NgrokAPI::Models::Empty

Delete an application user by ID. Throws an exception if API error.

ngrok.com/docs/api#api-application-users-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



79
80
81
82
83
84
85
# File 'lib/ngrokapi/services/application_users_client.rb', line 79

def delete!(id: "")
  path = '/app/users/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements, danger: true)
end

#get(id: "") ⇒ NgrokAPI::Models::ApplicationUser

Get an application user by ID.

ngrok.com/docs/api#api-application-users-get

Parameters:

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

    a resource identifier

Returns:



28
29
30
31
32
33
34
35
36
# File 'lib/ngrokapi/services/application_users_client.rb', line 28

def get(id: "")
  path = '/app/users/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::ApplicationUser.new(client: self, attrs: result)
end

#get!(id: "") ⇒ NgrokAPI::Models::ApplicationUser

Get an application user by ID. Throws an exception if API error.

ngrok.com/docs/api#api-application-users-get

Parameters:

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

    a resource identifier

Returns:



46
47
48
49
50
51
52
53
54
# File 'lib/ngrokapi/services/application_users_client.rb', line 46

def get!(id: "")
  path = '/app/users/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::ApplicationUser.new(client: self, attrs: result)
end

#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable

List all application users for this account.

ngrok.com/docs/api#api-application-users-list

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:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ngrokapi/services/application_users_client.rb', line 96

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::ApplicationUser
  )
end

#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable

List all application users for this account. Throws an exception if API error.

ngrok.com/docs/api#api-application-users-list

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:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/ngrokapi/services/application_users_client.rb', line 122

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::ApplicationUser,
    danger: true
  )
end