module Simpleokta::Client::Apps

Public Instance Methods

activate_app(app_id) click to toggle source

Activate an application by id @param app_id [String] the unique id of the application @see developer.okta.com/docs/reference/api/apps/#activate-application Activate Application @return {}

# File lib/simpleokta/apps.rb, line 81
def activate_app(app_id)
  response = call_with_token('post', "#{Constants::APP_API_BASE_PATH}/#{app_id}/lifecycle/activate")
  "Application with id: #{app_id} activated"
end
app(app_id) click to toggle source

Return a specific application in the okta instance. @param app_id [String] the unique id of the application @return [Hash<Application Object>] @see developer.okta.com/docs/reference/api/apps/#application-object Application Object

# File lib/simpleokta/apps.rb, line 20
def app(app_id)
  response = call_with_token('get', "#{Constants::APP_API_BASE_PATH}/#{app_id}")
  JSON.parse(response.body)
end
apps() click to toggle source

Returns a list of all applications in the okta instance. @return [Array<Application Object>] @see developer.okta.com/docs/reference/api/apps/#application-object Application Object

# File lib/simpleokta/apps.rb, line 11
def apps
  response = call_with_token('get', Constants::APP_API_BASE_PATH)
  JSON.parse(response.body)
end
create_app(app_data) click to toggle source

Creates an application in Okta. @param app_data [Hash] The hash of data you want the application to contain. @see developer.okta.com/docs/reference/api/apps/#add-application Add application data. @example

Creating a Basic Auth App
  app_data = {
    "name": "template_basic_auth",
    "label": "Sample Basic Auth App",
    "signOnMode": "BASIC_AUTH",
    "settings": {
      "app": {
        "url": "https://example.com/login.html",
        "authURL": "https://example.com/auth.html"
      }
    }
  }

@return [Hash<Application Object>] @see developer.okta.com/docs/reference/api/apps/#application-object Application Object

# File lib/simpleokta/apps.rb, line 52
def create_app(app_data)
  response = call_with_token('post', Constants::APP_API_BASE_PATH, app_data)
  JSON.parse(response.body)
end
deactivate_app(app_id) click to toggle source

Deactivate an application by id @param app_id [String] the unique id of the application @see developer.okta.com/docs/reference/api/apps/#deactivate-application Deactivate Application @return {}

# File lib/simpleokta/apps.rb, line 90
def deactivate_app(app_id)
  response = call_with_token('post', "#{Constants::APP_API_BASE_PATH}/#{app_id}/lifecycle/deactivate")
  "Application with id: #{app_id} deactivated"
end
delete_app(app_id) click to toggle source

Delete an application by id @param app_id [String] the unique id of the application @return 204 No Content

# File lib/simpleokta/apps.rb, line 72
def delete_app(app_id)
  response = call_with_token('delete', "#{Constants::APP_API_BASE_PATH}/#{app_id}")
  response
end
update_app(app_id, app_data) click to toggle source

Update an application @param app_id [String] the unique id of the application @param app_data [Hash] The hash of data you want the application to contain.

Pass in all required fields, anything you leave out will be removed from the application on update.

@return [Hash<Application Object>] The updated app @see developer.okta.com/docs/reference/api/apps/#update-application Update Application @see developer.okta.com/docs/reference/api/apps/#application-object Application Object

# File lib/simpleokta/apps.rb, line 64
def update_app(app_id, app_data)
  response = call_with_token('put', "#{Constants::APP_API_BASE_PATH}/#{app_id}", app_data)
  JSON.parse(response.body)
end
users_assigned_to_application(app_id) click to toggle source

Returns all users currently assigned to the application @param app_id [String] the unique id of the application @return [Array<User Object>] @see developer.okta.com/docs/reference/api/apps/#application-user-object User Object

# File lib/simpleokta/apps.rb, line 29
def users_assigned_to_application(app_id)
  response = call_with_token('get', "#{Constants::APP_API_BASE_PATH}/#{app_id}/users")
  JSON.parse(response.body)
end