Class: Express::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Result

Returns a new instance of Result.



6
7
8
9
# File 'lib/express/result.rb', line 6

def initialize(json)
  self.status = json['status']
  self.data = json['data']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/express/result.rb', line 4

def data
  @data
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/express/result.rb', line 4

def status
  @status
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/express/result.rb', line 11

def success?
  status == '3'
end

#to_sObject



15
16
17
# File 'lib/express/result.rb', line 15

def to_s
  {success: self.success?, data: self.data}.to_s
end