Sha256: add3d46d33f846f8c49f487188ed9eca08e16fb303d0d6e82f7b0eceb1b99f32

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

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

  # ChannelDetails is a type that represents information for a channel including channelId, name, status and occupancy (CHD1)
  #
  class ChannelDetails
    extend Ably::Modules::Enum
    extend Forwardable
    include Ably::Modules::ModelCommon

    # The attributes of ChannelDetails (CHD2)
    #
    attr_reader :attributes

    alias_method :to_h, :attributes

    # Initialize a new ChannelDetails
    #
    def initialize(attrs)
      @attributes = IdiomaticRubyWrapper(attrs.clone)
    end

    # The identifier of the channel (CHD2a)
    #
    # @return [String]
    #
    def channel_id
      attributes[:channel_id]
    end

    # The identifier of the channel (CHD2a)
    #
    # @return [String]
    #
    def name
      attributes[:name]
    end

    # The status of the channel (CHD2b)
    #
    # @return [Ably::Models::ChannelStatus, nil]
    #
    def status
      Ably::Models::ChannelStatus(attributes[:status])
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ably-rest-1.2.2 lib/submodules/ably-ruby/lib/ably/models/channel_details.rb
ably-1.2.2 lib/ably/models/channel_details.rb