class Syncano::Packets::Call
Class representing call packets used in communication with the Sync Server
Attributes
data[RW]
message_id[RW]
method_name[RW]
resource_name[RW]
Public Class Methods
new(attributes)
click to toggle source
Constructor for Syncano::Packets::Call
object @param [Hash] attributes
Calls superclass method
Syncano::Packets::Base::new
# File lib/syncano/packets/call.rb, line 9 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
Public Instance Methods
as_json(options = {})
click to toggle source
Overwritten method for preparing hash for json serialization @param [Hash] options @return [Hash]
# File lib/syncano/packets/call.rb, line 20 def as_json(options = {}) { type: 'call', method: "#{resource_name}.#{method_name}", params: data, message_id: message_id.to_s } end