Sha256: 78e41d8ac51d5d0edbc4111a93094c2971b5b2587b14a7639fb08dbf082dc90c

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

require "values"

module Tsclient
  class Profile < Value.new(:identifier, :name, :profile_pic_url, :human)
    def self.from(data)
      with(
        identifier: data.dig("UserProfile", "LoginName"),
        name: data.dig("UserProfile", "DisplayName"),
        profile_pic_url: data.dig("UserProfile", "ProfilePicURL"),
        # We assume anyone with an email address as their SSO identifier is human
        human: data.dig("UserProfile", "LoginName").include?("@")
      )
    end

    def human?
      human
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tsclient-0.1.1 lib/tsclient/profile.rb
tsclient-0.1.0 lib/tsclient/profile.rb