Class: Sappy::Responses::AddMonitor

Inherits:
Sappy::Response show all
Defined in:
lib/sappy/responses/add_monitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Sappy::Response

#initialize, parse, #parse

Constructor Details

This class inherits a constructor from Sappy::Response

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sappy/responses/add_monitor.rb', line 4

def id
  @id
end

Instance Method Details

#failure(code, message) ⇒ Object



9
10
11
12
13
14
# File 'lib/sappy/responses/add_monitor.rb', line 9

def failure(code, message)
  case code
  when "WRONG_DATA"
    raise ArgumentError, "You didn't provide the correct data: #{message}"
  end
end

#success(hash) ⇒ Object



5
6
7
# File 'lib/sappy/responses/add_monitor.rb', line 5

def success(hash)
  @id = hash["monitor"].first["id"]
end