Sha256: a22e5b0b8ac6b7830ab4dd9f501edb6e34f39ab43031b860d9b6c35bf82e0d58

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module RubySky
  module Raw # :nodoc:
    class Session # :nodoc:
      attr_reader :refresh_jwt, :access_jwt, :did_doc, :handle, :email,
                  :email_confirmed, :email_auth_factor, :active, :status

      def initialize(refresh_jwt:, access_jwt:, did_doc:, handle:, email:,
                     email_confirmed:, email_auth_factor:, active:, status:)
        @refresh_jwt = refresh_jwt
        @access_jwt = access_jwt
        @did_doc = did_doc
        @handle = handle
        @email = email
        @email_confirmed = email_confirmed
        @email_auth_factor = email_auth_factor
        @active = active
        @status = status
      end

      def self.from_hash(hash)
        allocate.tap do |this|
          this.update_by_hash hash
        end
      end

      def update_by_hash(hash)
        @refresh_jwt = hash["refreshJwt"]
        @access_jwt = hash["accessJwt"]
        @did_doc = DIDDoc.new(did: hash["did"], did_doc: hash["didDoc"])
        @handle = hash["handle"]
        @email = hash["email"]
        @email_confirmed = hash["emailConfirmed"]
        @email_auth_factor = hash["emailAuthFactor"]
        @active = hash["active"]
        @status = hash["status"]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysky-0.5.0 lib/rubysky/raw/session.rb
rubysky-0.4.0 lib/rubysky/raw/session.rb
rubysky-0.3.0 lib/rubysky/raw/session.rb
rubysky-0.2.1 lib/rubysky/raw/session.rb
rubysky-0.2.0 lib/rubysky/raw/session.rb