Exception: ClientException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, params = {}) ⇒ ClientException

Returns a new instance of ClientException.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/client.rb', line 7

def initialize(msg, params={})
  @msg     = msg
  @scheme  = params[:http_scheme]
  @host    = params[:http_host]
  @port    = params[:http_port]
  @path    = params[:http_path]
  @query   = params[:http_query]
  @status  = params[:http_status]
  @reason  = params[:http_reason]
  @device  = params[:http_device]
end

Instance Attribute Details

#devicesObject (readonly)

Returns the value of attribute devices.



6
7
8
# File 'lib/client.rb', line 6

def devices
  @devices
end

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/client.rb', line 6

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/client.rb', line 6

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



6
7
8
# File 'lib/client.rb', line 6

def port
  @port
end

#queryObject (readonly)

Returns the value of attribute query.



6
7
8
# File 'lib/client.rb', line 6

def query
  @query
end

#reasonObject (readonly)

Returns the value of attribute reason.



6
7
8
# File 'lib/client.rb', line 6

def reason
  @reason
end

#schemeObject (readonly)

Returns the value of attribute scheme.



6
7
8
# File 'lib/client.rb', line 6

def scheme
  @scheme
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/client.rb', line 6

def status
  @status
end

Instance Method Details

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/client.rb', line 19

def to_s
  a = @msg
  b = ''
  b += "#{@scheme}://" if @scheme
  b += @host if @host
  b +=  ":#{@port}" if @port
  b += @path if @path
  b += "?#{@query}" if @query
  b ? b = "#{b} #{@status}" : b = @status.to_s if @status
  b ? b = "#{b} #{@reason}" : b = "- #{@reason}" if @reason
  b ? b = "#{b}: device #{@device}" : b = "device #{@device}" if @device
  b ? "#{a} #{b}" : a
end