Sha256: fcd504877c9f882e28e0ddcc5056fba5f56bed0263a21952819b487885722d7e

Contents?: true

Size: 1.1 KB

Versions: 37

Compression:

Stored size: 1.1 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

    %w(access_token).each do |attribute|
      define_method attribute do
        attributes[attribute.to_sym]
      end
    end

    # @!attribute [r] attributes
    # @return [Hash] Access the token details Hash object ruby'fied to use symbolized keys
    def attributes
      @hash_object
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
ably-rest-1.2.2 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.2 lib/ably/models/auth_details.rb
ably-rest-1.2.1 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.1 lib/ably/models/auth_details.rb
ably-rest-1.2.0 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.2.0 lib/ably/models/auth_details.rb
ably-rest-1.1.8 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.8 lib/ably/models/auth_details.rb
ably-rest-1.1.7 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.7 lib/ably/models/auth_details.rb
ably-rest-1.1.6 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.6 lib/ably/models/auth_details.rb
ably-rest-1.1.5 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.5 lib/ably/models/auth_details.rb
ably-rest-1.1.4 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.4 lib/ably/models/auth_details.rb
ably-rest-1.1.4.rc lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.4.rc lib/ably/models/auth_details.rb
ably-rest-1.1.3 lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
ably-1.1.3 lib/ably/models/auth_details.rb