Sha256: 745e652b51651eed83b3895afe07e3bfb826154e13fb63455a776db0411bacc0

Contents?: true

Size: 997 Bytes

Versions: 6

Compression:

Stored size: 997 Bytes

Contents

# frozen_string_literal: true

module Yoti
  module Sandbox
    module Profile
      #
      # Represents an attribute that can be used by the profile sandbox service
      #
      class Attribute
        #
        # @param [String] name
        # @param [String] value
        # @param [String] derivation
        # @param [Array<Anchor>] anchors
        #
        def initialize(
          name: '',
          value: '',
          derivation: '',
          anchors: []
        )
          @name = name
          @value = value
          @derivation = derivation
          @anchors = anchors
        end

        #
        # @return [Hash]
        #
        def as_json(*_args)
          {
            name: @name,
            value: @value,
            derivation: @derivation,
            anchors: @anchors.map(&:as_json)
          }
        end

        #
        # @return [String]
        #
        def to_json(*args)
          as_json(*args).to_json
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yoti_sandbox-1.4.0 lib/yoti_sandbox/profile/attribute.rb
yoti_sandbox-1.3.0 lib/yoti_sandbox/profile/attribute.rb
yoti_sandbox-1.2.1 lib/yoti_sandbox/profile/attribute.rb
yoti_sandbox-1.2.0 lib/yoti_sandbox/profile/attribute.rb
yoti_sandbox-1.1.0 lib/yoti_sandbox/profile/attribute.rb
yoti_sandbox-1.0.0 lib/yoti_sandbox/profile/attribute.rb