Sha256: 50fc1efffc383d46395b15d210bab1e452f05e91dd82cf9a04bd014bc7cc6984

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

module Ably::Models
  # Convert auth details attributes to a {AuthDetails} object
  #
  # @param attributes (see #initialize)
  #
  # @return [AuthDetails]
  #
  def self.AuthDetails(attributes)
    case attributes
    when AuthDetails
      return attributes
    else
      AuthDetails.new(attributes || {})
    end
  end

  # AuthDetails are included in an +AUTH+ {Ably::Models::ProtocolMessage#auth} attribute
  # to provide the realtime service with new token authentication details following a re-auth workflow
  #
  class AuthDetails
    include Ably::Modules::ModelCommon

    # @param attributes [Hash]
    # @option attributes [String]    :access_token     token string
    #
    def initialize(attributes = {})
      @hash_object = IdiomaticRubyWrapper(attributes.clone)
      self.attributes.freeze
    end

    # The authentication token string.
    #
    # @spec AD2
    #
    # @return [String]
    #
    def access_token
      attributes[:access_token]
    end

    def attributes
      @hash_object
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ably-rest-1.2.7 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.7 lib/ably/models/auth_details.rb
ably-rest-1.2.6 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.6 lib/ably/models/auth_details.rb
ably-rest-1.2.4 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.4 lib/ably/models/auth_details.rb
ably-rest-1.2.3 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.3 lib/ably/models/auth_details.rb