Exception: PawClient::Client::ClientError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/paw_client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ClientError

Returns a new instance of ClientError.



11
12
13
14
15
16
# File 'lib/paw_client/client.rb', line 11

def initialize(response)
  super(message)
  @response = response
  message=to_json.success rescue 'Error while call plugandwork API, Unparsable response'
  super(message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/paw_client/client.rb', line 9

def response
  @response
end

Instance Method Details

#infoObject



18
19
20
# File 'lib/paw_client/client.rb', line 18

def info
  to_json.info
end

#requestObject



26
27
28
# File 'lib/paw_client/client.rb', line 26

def request
  self.response.request
end

#to_jsonObject



22
23
24
# File 'lib/paw_client/client.rb', line 22

def to_json
  JSON.parse(self.response.to_s)
end