Sha256: 5b2453fc23fcd526144186d67a58d1943f8d2e3688db6762a1b6cc585a88ce38

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

module Citrix
  module Training
    module Resource
      class Registrant
        include Helpers::Initializer

        # Set the first name of the user.
        attr_accessor :first_name

        # Set the last name of the user.
        attr_accessor :last_name

        # Set the e-mail.
        attr_accessor :email

        # Set the join url.
        attr_accessor :join_url

        # Set the confirmation url.
        attr_accessor :confirmation_url

        # Set the registrant key.
        attr_accessor :key

        # Set the status.
        attr_accessor :status

        ATTRIBUTES = %i[
          first_name
          last_name
          email
        ]

        # Convert `attributes` into parameters that
        # Citrix API can understand.
        def self.serialize(attributes)
          Serializer::Registrant.new(attributes: attributes).serialize
        end

        # Convert `attributes` into parameters that
        # Citrix::Training::Resource::Registrant can understand.
        def self.deserialize(attributes)
          Serializer::Registrant.new(attributes: attributes).deserialize
        end

        # Return a hash containing all attributes.
        def attributes
          ATTRIBUTES.each_with_object({}) do |name, buffer|
            buffer[name] = public_send(name)
          end
        end

        # Serialize the attributes.
        def serialize
          self.class.serialize(attributes)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
citrix-0.2.2 lib/citrix/training/resource/registrant.rb
citrix-0.2.1 lib/citrix/training/resource/registrant.rb
citrix-0.2.0 lib/citrix/training/resource/registrant.rb
citrix-0.1.0 lib/citrix/training/resource/registrant.rb