Module: Simpleokta::Client::Apps

Included in:
Simpleokta::Client
Defined in:
lib/simpleokta/apps.rb

Instance Method Summary collapse

Instance Method Details

#activate_app(app_id) ⇒ Object

Activate an application by id

Parameters:

  • app_id (String)

    the unique id of the application

Returns:

  • {}

See Also:



81
82
83
84
# 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) ⇒ Hash<Application Object>

Return a specific application in the okta instance.

Parameters:

  • app_id (String)

    the unique id of the application

Returns:

  • (Hash<Application Object>)

See Also:



20
21
22
23
# 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

#appsArray<Application Object>

Returns a list of all applications in the okta instance.

Returns:

  • (Array<Application Object>)

See Also:



11
12
13
14
# 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) ⇒ Hash<Application Object>

Creates an application in Okta.

Examples:

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"
      }
    }
  }

Parameters:

  • app_data (Hash)

    The hash of data you want the application to contain.

Returns:

  • (Hash<Application Object>)

See Also:



52
53
54
55
# 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) ⇒ Object

Deactivate an application by id

Parameters:

  • app_id (String)

    the unique id of the application

Returns:

  • {}

See Also:



90
91
92
93
# 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) ⇒ Object

Delete an application by id

Parameters:

  • app_id (String)

    the unique id of the application

Returns:

  • 204 No Content



72
73
74
75
# 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) ⇒ Hash<Application Object>

Update an application

Parameters:

  • app_id (String)

    the unique id of the application

  • 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.

Returns:

  • (Hash<Application Object>)

    The updated app

See Also:



64
65
66
67
# 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) ⇒ Array<User Object>

Returns all users currently assigned to the application

Parameters:

  • app_id (String)

    the unique id of the application

Returns:

  • (Array<User Object>)

See Also:



29
30
31
32
# 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