module Ably::Models

Public Class Methods

AuthDetails(attributes) click to toggle source

Convert auth details attributes to a {AuthDetails} object

@param attributes (see initialize)

@return [AuthDetails]

# File lib/submodules/ably-ruby/lib/ably/models/auth_details.rb, line 8
def self.AuthDetails(attributes)
  case attributes
  when AuthDetails
    return attributes
  else
    AuthDetails.new(attributes || {})
  end
end
ChannelDetails(attributes) click to toggle source

Convert token details argument to a {ChannelDetails} object

@param attributes (see initialize)

@return [ChannelDetails]

# File lib/submodules/ably-ruby/lib/ably/models/channel_details.rb, line 8
def self.ChannelDetails(attributes)
  case attributes
  when ChannelDetails
    return attributes
  else
    ChannelDetails.new(attributes)
  end
end
ChannelMetrics(attributes) click to toggle source

Convert token details argument to a {ChannelMetrics} object

@param attributes (see initialize)

@return [ChannelMetrics]

# File lib/submodules/ably-ruby/lib/ably/models/channel_metrics.rb, line 8
def self.ChannelMetrics(attributes)
  case attributes
  when ChannelMetrics
    return attributes
  else
    ChannelMetrics.new(attributes)
  end
end
ChannelOccupancy(attributes) click to toggle source

Convert token details argument to a {ChannelOccupancy} object

@param attributes (see initialize)

@return [ChannelOccupancy]

# File lib/submodules/ably-ruby/lib/ably/models/channel_occupancy.rb, line 8
def self.ChannelOccupancy(attributes)
  case attributes
  when ChannelOccupancy
    return attributes
  else
    ChannelOccupancy.new(attributes)
  end
end
ChannelOptions(attributes) click to toggle source

Convert token details argument to a {ChannelOptions} object

@param attributes (see initialize)

@return [ChannelOptions]

# File lib/submodules/ably-ruby/lib/ably/models/channel_options.rb, line 8
def self.ChannelOptions(attributes)
  case attributes
  when ChannelOptions
    return attributes
  else
    ChannelOptions.new(attributes)
  end
end
ChannelStatus(attributes) click to toggle source

Convert token details argument to a {ChannelStatus} object

@param attributes (see initialize)

@return [ChannelStatus]

# File lib/submodules/ably-ruby/lib/ably/models/channel_status.rb, line 8
def self.ChannelStatus(attributes)
  case attributes
  when ChannelStatus
    return attributes
  else
    ChannelStatus.new(attributes)
  end
end
CipherParams(attributes) click to toggle source

Convert cipher param attributes to a {CipherParams} object

@param attributes (see initialize)

@return [CipherParams]

# File lib/submodules/ably-ruby/lib/ably/models/cipher_params.rb, line 11
def self.CipherParams(attributes)
  case attributes
  when CipherParams
    return attributes
  else
    CipherParams.new(attributes || {})
  end
end
ConnectionDetails(attributes) click to toggle source

Convert connection details attributes to a {ConnectionDetails} object

@param attributes (see initialize)

@return [ConnectionDetails]

# File lib/submodules/ably-ruby/lib/ably/models/connection_details.rb, line 8
def self.ConnectionDetails(attributes)
  case attributes
  when ConnectionDetails
    return attributes
  else
    ConnectionDetails.new(attributes || {})
  end
end
Message(message, options = {}) click to toggle source

Convert messsage argument to a {Message} object and associate with a protocol message if provided

@param message [Message,Hash] A message object or Hash of message properties @param [Hash] options (see Message#initialize)

@return [Message]

# File lib/submodules/ably-ruby/lib/ably/models/message.rb, line 11
def self.Message(message, options = {})
  case message
  when Message
    message.tap do
      message.assign_to_protocol_message options[:protocol_message] if options[:protocol_message]
    end
  else
    Message.new(message, options)
  end
end
PresenceMessage(presence_message, options = {}) click to toggle source

Convert presence_messsage argument to a {PresenceMessage} object and associate with a protocol message if provided

@param presence_message [PresenceMessage,Hash] A presence message object or Hash of presence message properties @param [Hash] options (see PresenceMessage#initialize)

@return [PresenceMessage]

# File lib/submodules/ably-ruby/lib/ably/models/presence_message.rb, line 9
def self.PresenceMessage(presence_message, options = {})
  case presence_message
  when PresenceMessage
    presence_message.tap do
      presence_message.assign_to_protocol_message options[:protocol_message] if options[:protocol_message]
    end
  else
    PresenceMessage.new(presence_message, options)
  end
end
Stats(stat) click to toggle source

Convert stat argument to a {Stats} object

@param stat [Stats,Hash] A Stats object or Hash of stat properties

@return [Stats]

# File lib/submodules/ably-ruby/lib/ably/models/stats.rb, line 9
def self.Stats(stat)
  case stat
  when Stats
    stat
  else
    Stats.new(stat)
  end
end
TokenDetails(attributes) click to toggle source

Convert token details argument to a {TokenDetails} object

@param attributes (see initialize)

@return [TokenDetails]

# File lib/submodules/ably-ruby/lib/ably/models/token_details.rb, line 8
def self.TokenDetails(attributes)
  case attributes
  when TokenDetails
    return attributes
  else
    TokenDetails.new(attributes)
  end
end
TokenRequest(attributes) click to toggle source

Convert token request argument to a {TokenRequest} object

@param attributes (see initialize)

@return [TokenRequest]

# File lib/submodules/ably-ruby/lib/ably/models/token_request.rb, line 8
def self.TokenRequest(attributes)
  case attributes
  when TokenRequest
    return attributes
  else
    TokenRequest.new(attributes)
  end
end