Class: Qywx::Client::Result

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

Overview

HTTP Response result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message: '') ⇒ Result

Returns a new instance of Result.

Parameters:

  • status (Boolean)
  • message (String) (defaults to: '')

    (”)



11
12
13
14
# File 'lib/qywx/client/result.rb', line 11

def initialize(status, message: '')
  @status  = status != false
  @message = message.to_s
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/qywx/client/result.rb', line 7

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/qywx/client/result.rb', line 7

def status
  @status
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/qywx/client/result.rb', line 16

def failed?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/qywx/client/result.rb', line 20

def success?
  status
end