Class: Bidu::House::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/bidu/house/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reports) ⇒ Status

Returns a new instance of Status.



6
7
8
# File 'lib/bidu/house/status.rb', line 6

def initialize(reports)
  @reports = reports
end

Instance Attribute Details

#reportsObject (readonly)

Returns the value of attribute reports.



4
5
6
# File 'lib/bidu/house/status.rb', line 4

def reports
  @reports
end

Instance Method Details

#as_jsonObject



14
15
16
17
18
# File 'lib/bidu/house/status.rb', line 14

def as_json
  {
    status: status
  }.merge(reports_jsons)
end

#statusObject



10
11
12
# File 'lib/bidu/house/status.rb', line 10

def status
  reports.any? { |r| r.error? } ? :error : :ok
end