Skip to content

Commit

Permalink
Add GroupRules module
Browse files Browse the repository at this point in the history
  • Loading branch information
ltk committed Oct 14, 2021
1 parent e1990d4 commit 542de0d
Show file tree
Hide file tree
Showing 10 changed files with 525 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/oktakit/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'oktakit/client/events'
require 'oktakit/client/factors'
require 'oktakit/client/groups'
require 'oktakit/client/group_rules'
require 'oktakit/client/identity_providers'
require 'oktakit/client/schemas'
require 'oktakit/client/templates'
Expand All @@ -17,6 +18,7 @@ class Client
include Events
include Factors
include Groups
include GroupRules
include IdentityProviders
include Schemas
include Templates
Expand Down
115 changes: 115 additions & 0 deletions lib/oktakit/client/group_rules.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
module Oktakit
class Client
module GroupRules
# Add Group Rule
#
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return [Hash<Sawyer::Resource>] The created Group Rule.
# @see https://developer.okta.com/docs/reference/api/groups/#create-group-rule
# @example
# Oktakit.add_group_rule
def add_group_rule(options = {})
post('/groups/rules', options)
end

# Get Group Rule
#
# @params id [string] Group Rule ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return [Hash<Sawyer::Resource>] Fetched Group Rule
# @see https://developer.okta.com/docs/reference/api/groups/#get-group-rule
# @example
# Oktakit.get_group_rule('id')
def get_group_rule(id, options = {})
get("/groups/rules/#{id}", options)
end

# List Group Rules
#
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return [Array<Sawyer::Resource>] Array of Group Rules
# @see https://developer.okta.com/docs/reference/api/groups/#list-group-rules
# @example
# Oktakit.list_group_rules
def list_group_rules(options = {})
get('/groups/rules', options)
end

# Update Group Rule
#
# @params id [string] Group Rule ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return [Hash<Sawyer::Resource>] Updated Group Rule
# @see https://developer.okta.com/docs/reference/api/groups/#update-group-rule
# @example
# Oktakit.update_group_rule('id')
def update_group_rule(id, options = {})
put("/groups/rules/#{id}", options)
end

# Remove Group Rule
#
# @params id [string] Group ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return HTTP 202 Accepted
# @see https://developer.okta.com/docs/reference/api/groups/#delete-a-group-rule
# @example
# Oktakit.remove_group_rule('id')
def remove_group_rule(id, options = {})
delete("/groups/rules/#{id}", options)
end

# Activate Group Rule
#
# @params id [string] Group ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return HTTP 204 No Content
# @see https://developer.okta.com/docs/reference/api/groups/#activate-a-group-rule
# @example
# Oktakit.activate_group_rule('id')
def activate_group_rule(id, options = {})
post("/groups/rules/#{id}/lifecycle/activate", options)
end

# Deactivate Group Rule
#
# @params id [string] Group ID
# @param options[:query] [Hash] Optional. Query params for request
# @param options[:headers] [Hash] Optional. Header params for the request.
# @param options[:accept] [String] Optional. The content type to accept. Default application/json
# @param options[:content_type] [String] Optional. The content type for the request. Default application/json
# @param options [Hash] Optional. Body params for request.
# @return HTTP 204 No Content
# @see https://developer.okta.com/docs/reference/api/groups/#deactivate-a-group-rule
# @example
# Oktakit.deactivate_group_rule('id')
def deactivate_group_rule(id, options = {})
post("/groups/rules/#{id}/lifecycle/deactivate", options)
end
end
end
end
40 changes: 40 additions & 0 deletions spec/cassettes/activate_group_rule.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions spec/cassettes/add_group_rule.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions spec/cassettes/deactivate_group_rule.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions spec/cassettes/get_group_rule.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions spec/cassettes/list_group_rules.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions spec/cassettes/remove_group_rule.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 542de0d

Please sign in to comment.