Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
# http://shopify.github.io/ruby-style-guide/

AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.6

# Allow .ruby-version and spec.required_ruby_version to differ
# to run a newer Ruby version for Rubocop, but don't force users to upgrade
Gemspec/RequiredRubyVersion:
Enabled: false

Rails:
Enabled: false
Expand All @@ -19,7 +24,7 @@ Layout/MultilineOperationIndentation:
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation

Layout/FirstParameterIndentation:
Layout/IndentFirstArgument:
EnforcedStyle: consistent

Style/TrailingCommaInArrayLiteral:
Expand All @@ -34,7 +39,7 @@ Style/NumericLiterals:
Layout/CaseIndentation:
EnforcedStyle: end

Layout/IndentHash:
Layout/IndentFirstHashElement:
EnforcedStyle: consistent

Style/WordArray:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.0
2 changes: 2 additions & 0 deletions lib/oktakit/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'oktakit/client/groups'
require 'oktakit/client/identity_providers'
require 'oktakit/client/schemas'
require 'oktakit/client/system_log'
require 'oktakit/client/templates'
require 'oktakit/client/users'

Expand All @@ -19,6 +20,7 @@ class Client
include Groups
include IdentityProviders
include Schemas
include SystemLog
include Templates
include Users

Expand Down
20 changes: 20 additions & 0 deletions lib/oktakit/client/system_log.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Oktakit
class Client
module SystemLog
# List logs
#
# @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 logs
# @see https://developer.okta.com/docs/reference/api/system-log/#list-events
# @example
# Oktakit.list_logs(paginate: true, query: { since: "2019-06-27T00:00:00Z", until: "2019-06-28T00:00:00Z" })
def list_logs(options = {})
get('/logs', options)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/oktakit/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(response = nil)
# Array of validation errors
# @return [Array<Hash>] Error info
def errors
if data && data.is_a?(Hash)
if data&.is_a?(Hash)
data[:errors] || []
else
[]
Expand Down
2 changes: 1 addition & 1 deletion lib/oktakit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Oktakit
VERSION = '0.2.0'.freeze
VERSION = '0.3.0'.freeze
end
83 changes: 83 additions & 0 deletions spec/cassettes/list_logs.yml

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

32 changes: 17 additions & 15 deletions spec/client/apps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
it 'returns updated application' do
VCR.use_cassette 'update_application', record: :new_episodes do
resp, = client.update_application(APPS_APP_ID,
id: APPS_APP_ID,
signOnMode: "SAML_2_0")
id: APPS_APP_ID,
signOnMode: "SAML_2_0")
expect(resp.id).to be == APPS_APP_ID
end
end
Expand Down Expand Up @@ -81,11 +81,11 @@
it 'returns application user' do
VCR.use_cassette 'assign_user_to_application_for_sso' do
resp, status = client.assign_user_to_application_for_sso(APPS_APP_ID,
id: APPS_USER_ID,
scope: "USER",
credentials: {
userName: "user@example.com"
})
id: APPS_USER_ID,
scope: "USER",
credentials: {
userName: "user@example.com"
})
expect(status).to be(200)
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
Expand All @@ -95,11 +95,13 @@
describe '#assign_user_to_application_for_sso_provisioning' do
it 'returns application user with user profile mappings applied' do
VCR.use_cassette 'assign_user_to_application_for_sso_provisioning', record: :new_episodes do
resp, status = client.assign_user_to_application_for_sso_provisioning(APPS_APP_ID,
resp, status = client.assign_user_to_application_for_sso_provisioning(
APPS_APP_ID,
id: APPS_USER_ID,
scope: "USER",
credentials: { userName: "user@example.com" },
profile: {})
profile: {}
)
expect(status).to be(200)
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
Expand Down Expand Up @@ -128,12 +130,12 @@
it 'returns application user' do
VCR.use_cassette 'update_application_credentials_for_assigned_user', record: :new_episodes do
resp, = client.update_application_credentials_for_assigned_user(APPS_APP_ID, APPS_USER_ID,
credentials: {
userName: "user@example.com",
password: {
value: "newPassword"
}
})
credentials: {
userName: "user@example.com",
password: {
value: "newPassword"
}
})
expect(resp.id).to be == '00u6nm9ytbmwHeunx0h7'
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/client/factors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
it 'returns all responses return the enrolled factor with a status of either pending_activation or active.' do
VCR.use_cassette 'enroll_factor', record: :new_episodes do
resp, = client.enroll_factor(FACTORS_USER_ID,
factorType: "sms",
provider: "OKTA",
profile: {
phoneNumber: "+1-613-456-1234"
})
factorType: "sms",
provider: "OKTA",
profile: {
phoneNumber: "+1-613-456-1234"
})
expect(resp.id).not_to be_nil
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/client/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
it 'returns updated group' do
VCR.use_cassette 'update_group' do
resp, = client.update_group(GROUPS_GROUP_ID,
profile: {
name: "New Name for the Group",
description: "New Name for the Group"
})
profile: {
name: "New Name for the Group",
description: "New Name for the Group"
})
expect(resp.profile.name).to be == "New Name for the Group"
end
end
Expand Down
12 changes: 7 additions & 5 deletions spec/client/identity_providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
describe '#update_identity_provider' do
it 'returns updated identity provider' do
VCR.use_cassette 'update_identity_provider', record: :new_episodes do
_, status = client.update_identity_provider(IDENTITY_PROVIDERS_IDENTITY_ID,
_, status = client.update_identity_provider(
IDENTITY_PROVIDERS_IDENTITY_ID,
id: "0oa62bfdjnK55Z5x80h7",
type: "SAML2",
name: "Example IdP",
Expand Down Expand Up @@ -158,7 +159,8 @@
matchType: "USERNAME"
},
maxClockSkew: 120000
})
}
)
expect(status).to be(200)
end
end
Expand Down Expand Up @@ -240,9 +242,9 @@
it 'returns identity provider transaction' do
VCR.use_cassette 'link_idp_user', record: :new_episodes do
resp, = client.link_idp_user(IDENTITY_PROVIDERS_TRANSACTION_ID, IDENTITY_PROVIDERS_USER_ID,
profile: {
userType: "Social"
})
profile: {
userType: "Social"
})
expect(resp.id).not_to be_nil
end
end
Expand Down
12 changes: 12 additions & 0 deletions spec/client/system_log_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe Oktakit::Client::SystemLog do
describe '#list_logs' do
it 'returns array of logs' do
VCR.use_cassette 'list_logs' do
resp, = client.list_logs
expect(resp).to be_a(Array)
end
end
end
end
24 changes: 12 additions & 12 deletions spec/client/templates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
it 'returns updated sms template' do
VCR.use_cassette 'update_sms_template' do
_, status = client.update_sms_template(TEMPLATES_TEMPLATE_ID,
name: "Custom",
type: "SMS_VERIFY_CODE",
template: "Your ${org.name} code is: ${code}",
translations:
{
es: "${org.name}: ${code}.",
fr: "${org.name}: ${code}.",
it: "${org.name}: ${code}."
})
name: "Custom",
type: "SMS_VERIFY_CODE",
template: "Your ${org.name} code is: ${code}",
translations:
{
es: "${org.name}: ${code}.",
fr: "${org.name}: ${code}.",
it: "${org.name}: ${code}."
})
expect(status).to be(200)
end
end
Expand All @@ -62,9 +62,9 @@
it 'returns updated sms template' do
VCR.use_cassette 'partial_sms_template_update' do
resp, = client.partial_sms_template_update(TEMPLATES_TEMPLATE_ID,
translations: {
de: "${org.name}: ihre bestätigungscode ist ${code}."
})
translations: {
de: "${org.name}: ihre bestätigungscode ist ${code}."
})
expect(resp.translations.de).to be == '${org.name}: ihre bestätigungscode ist ${code}.'
end
end
Expand Down
Loading