Sha256: 2b6144dde900e83d1a5acb96630e9c7cd02b89020e93718b7b3a43bfda6dc3aa

Contents?: true

Size: 860 Bytes

Versions: 9

Compression:

Stored size: 860 Bytes

Contents

class Syncano
  module Packets
    # Class representing call response packets used in communication with the Sync Server
    class CallResponse < Syncano::Packets::Base
      attr_reader :message_id, :data, :result

      # Constructor for Syncano::Packets::CallResponse object
      # @param [Hash] attributes
      def initialize(attributes)
        super(attributes)
        self.message_id = attributes[:message_id]
        self.data = attributes[:data]
        self.result = attributes[:result]
      end

      # Prepares hash in response format
      # @return [Hash]
      def to_response
        data.merge(result: result)
      end

      # Returns true if is a call response packet
      # @return [TrueClass, FalseClass]
      def call_response?
        true
      end

      private

      attr_writer :message_id, :data, :result
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
syncano-3.1.4 lib/syncano/packets/call_response.rb
syncano-3.1.3 lib/syncano/packets/call_response.rb
syncano-3.1.2 lib/syncano/packets/call_response.rb
syncano-3.1.1 lib/syncano/packets/call_response.rb
syncano-3.1.1.beta5 lib/syncano/packets/call_response.rb
syncano-3.1.1.beta4 lib/syncano/packets/call_response.rb
syncano-3.1.1.beta3 lib/syncano/packets/call_response.rb
syncano-3.1.1.beta2 lib/syncano/packets/call_response.rb
syncano-3.1.1.beta lib/syncano/packets/call_response.rb