Sha256: c92c787f9a7f24847e0b00f886f13c2a8fc046f311ffdf58e120e287caa5c981
Contents?: true
Size: 1012 Bytes
Versions: 9
Compression:
Stored size: 1012 Bytes
Contents
class Syncano module Packets # Class representing call packets used in communication with the Sync Server class Call < Syncano::Packets::Base attr_reader :message_id, :resource_name, :method_name, :data # Constructor for Syncano::Packets::Call object # @param [Hash] attributes def initialize(attributes) super(attributes) self.resource_name = attributes[:resource_name] self.method_name = attributes[:method_name] self.data = attributes[:data] self.message_id = attributes[:message_id] || rand(10**12) end # Overwritten method for preparing hash for json serialization # @param [Hash] options # @return [Hash] def as_json(options = {}) { type: 'call', method: "#{resource_name}.#{method_name}", params: data, message_id: message_id.to_s } end private attr_writer :message_id, :resource_name, :method_name, :data end end end
Version data entries
9 entries across 9 versions & 1 rubygems