Class: NgrokAPI::Services::ApplicationSessionsClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::ApplicationSessionsClient
- Defined in:
- lib/ngrokapi/services/application_sessions_client.rb
Overview
Constant Summary collapse
- PATH =
The API path for the requests
'/app/sessions/%{id}'
- LIST_PROPERTY =
The List Property from the resulting API for list calls
'application_sessions'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an application session by ID.
-
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an application session by ID.
-
#get(id: "") ⇒ NgrokAPI::Models::ApplicationSession
Get an application session by ID.
-
#get!(id: "") ⇒ NgrokAPI::Models::ApplicationSession
Get an application session by ID.
-
#initialize(client:) ⇒ ApplicationSessionsClient
constructor
A new instance of ApplicationSessionsClient.
-
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all application sessions for this account.
-
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all application sessions for this account.
Constructor Details
#initialize(client:) ⇒ ApplicationSessionsClient
Returns a new instance of ApplicationSessionsClient.
17 18 19 |
# File 'lib/ngrokapi/services/application_sessions_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/application_sessions_client.rb', line 15 def client @client end |
Instance Method Details
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an application session by ID.
63 64 65 66 67 68 69 |
# File 'lib/ngrokapi/services/application_sessions_client.rb', line 63 def delete(id: "") path = '/app/sessions/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an application session by ID. Throws an exception if API error.
79 80 81 82 83 84 85 |
# File 'lib/ngrokapi/services/application_sessions_client.rb', line 79 def delete!(id: "") path = '/app/sessions/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::ApplicationSession
Get an application session by ID.
28 29 30 31 32 33 34 35 36 |
# File 'lib/ngrokapi/services/application_sessions_client.rb', line 28 def get(id: "") path = '/app/sessions/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::ApplicationSession.new(client: self, attrs: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::ApplicationSession
Get an application session by ID. Throws an exception if API error.
46 47 48 49 50 51 52 53 54 |
# File 'lib/ngrokapi/services/application_sessions_client.rb', line 46 def get!(id: "") path = '/app/sessions/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::ApplicationSession.new(client: self, attrs: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all application sessions for this account.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ngrokapi/services/application_sessions_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::ApplicationSession ) end |
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all application sessions for this account. Throws an exception if API error.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/ngrokapi/services/application_sessions_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::ApplicationSession, danger: true ) end |