Class: Passfort::Endpoint::Profiles

Inherits:
Object
  • Object
show all
Defined in:
lib/passfort/endpoint/profiles.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Profiles

Returns a new instance of Profiles.



8
9
10
# File 'lib/passfort/endpoint/profiles.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#collected_data(id) ⇒ Object



25
26
27
28
# File 'lib/passfort/endpoint/profiles.rb', line 25

def collected_data(id)
  collected_data = @client.get("/profiles/#{id}/collected_data")
  resource_class(collected_data["entity_type"]).new(collected_data)
end

#create(role:, collected_data: {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/passfort/endpoint/profiles.rb', line 12

def create(role:, collected_data: {})
  profile = @client.post(
    "/profiles",
    body: { role: role, collected_data: collected_data },
  )
  ::Passfort::Resource::Profile.new(profile)
end

#find(id) ⇒ Object



20
21
22
23
# File 'lib/passfort/endpoint/profiles.rb', line 20

def find(id)
  profile = @client.get("/profiles/#{id}")
  ::Passfort::Resource::Profile.new(profile)
end

#update_collected_data(id, data) ⇒ Object



30
31
32
33
# File 'lib/passfort/endpoint/profiles.rb', line 30

def update_collected_data(id, data)
  collected_data = @client.post("/profiles/#{id}/collected_data", body: data)
  resource_class(collected_data["entity_type"]).new(collected_data)
end