class Bixby::JsonRequest

Wraps a JSON Request

@attr [String] operation Name of operation @attr [Array] params Array of paramters; must be valid JSON types

Attributes

operation[RW]
params[RW]

Public Class Methods

new(operation, params) click to toggle source

Create a new JsonRequest

@param [String] operation Name of operation @param [Array] params Array of parameters; must ve valid JSON types

# File lib/bixby-common/api/json_request.rb, line 19
def initialize(operation, params)
  @operation = operation
  @params = params
end

Public Instance Methods

==(other) click to toggle source

Test if this object is equal to some other object

@param [JsonRequest] other

@return [Boolean]

# File lib/bixby-common/api/json_request.rb, line 46
def ==(other)
  operation == other.operation && params == other.params
end
to_s(include_params=true) click to toggle source

Stringify, useful for debugging

@param [Boolean] include_params whether or not to include params in the output (default: true)

@return [String]

# File lib/bixby-common/api/json_request.rb, line 29
def to_s(include_params=true)
  s = []
  s << "JsonRequest:#{self.object_id}"
  s << "  operation:  #{self.operation}"
  s << "  params:     " + MultiJson.dump(self.params) if include_params
  s.join("\n")
end
to_wire() click to toggle source
# File lib/bixby-common/api/json_request.rb, line 37
def to_wire
  MultiJson.dump(self)
end