Class: WorkOS::Agents
- Inherits:
-
Object
- Object
- WorkOS::Agents
- Defined in:
- lib/workos/agents.rb
Instance Method Summary collapse
-
#create_validate(type:, credential:, audience: nil, request_options: {}) ⇒ WorkOS::AgentCredentialValidation
Validate an agent credential.
-
#get_registration(id:, request_options: {}) ⇒ WorkOS::AgentRegistration
Get an agent registration.
-
#initialize(client) ⇒ Agents
constructor
A new instance of Agents.
-
#update_attempts(type:, claim_attempt_token:, user:, organization_id: nil, request_options: {}) ⇒ WorkOS::ClaimViewResponse
Link a claim attempt to an external user.
Constructor Details
#initialize(client) ⇒ Agents
Returns a new instance of Agents.
9 10 11 |
# File 'lib/workos/agents.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#create_validate(type:, credential:, audience: nil, request_options: {}) ⇒ WorkOS::AgentCredentialValidation
Validate an agent credential
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/workos/agents.rb', line 51 def create_validate( type:, credential:, audience: nil, request_options: {} ) body = { "type" => type, "credential" => credential, "audience" => audience }.compact response = @client.request( method: :post, path: "/agents/credentials/validate", auth: true, body: body, request_options: ) result = WorkOS::AgentCredentialValidation.new(response.body) result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#get_registration(id:, request_options: {}) ⇒ WorkOS::AgentRegistration
Get an agent registration
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/workos/agents.rb', line 78 def get_registration( id:, request_options: {} ) response = @client.request( method: :get, path: "/agents/registrations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: ) result = WorkOS::AgentRegistration.new(response.body) result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#update_attempts(type:, claim_attempt_token:, user:, organization_id: nil, request_options: {}) ⇒ WorkOS::ClaimViewResponse
Link a claim attempt to an external user
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/workos/agents.rb', line 20 def update_attempts( type:, claim_attempt_token:, user:, organization_id: nil, request_options: {} ) body = { "type" => type, "claim_attempt_token" => claim_attempt_token, "user" => user, "organization_id" => organization_id }.compact response = @client.request( method: :patch, path: "/agents/claims/attempts", auth: true, body: body, request_options: ) result = WorkOS::ClaimViewResponse.new(response.body) result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |