Class: CpanelApi::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/panelbeater/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



4
5
6
# File 'lib/panelbeater/response.rb', line 4

def initialize(response)
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



16
17
18
# File 'lib/panelbeater/response.rb', line 16

def method_missing(method, *args)
  @response.send(method) if @response.respond_to?(method)
end

Instance Method Details

#jsonObject



12
13
14
# File 'lib/panelbeater/response.rb', line 12

def json
  JSON.parse @response.body
end

#success?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/panelbeater/response.rb', line 8

def success?
  json['result'].first['status'] == 1
end