Exception: Fanforce::Error::WebhookFailed

Inherits:
Fanforce::Error show all
Defined in:
lib/fanforce/errors/errors.rb

Overview

Parameters were valid but request failed for another reason

Instance Attribute Summary collapse

Attributes inherited from Fanforce::Error

#env, #public_errors

Instance Method Summary collapse

Methods inherited from Fanforce::Error

#curl_command, #for, #format_error, #format_errors

Constructor Details

#initialize(hash) ⇒ WebhookFailed

Returns a new instance of WebhookFailed.



96
97
98
99
100
101
102
103
# File 'lib/fanforce/errors/errors.rb', line 96

def initialize(hash)
  @request_url = hash[:request_url]
  @request_params = hash[:request_params]
  @response_code = hash[:response_code]
  @response_body = hash[:response_body]
  @request_curl_command = "curl -X POST -d \"#{@request_params.to_param}\" #{@request_url}"
  super("Callback returned an HTTP response code of #{@response_code} when only 200 and 201 are allowed.")
end

Instance Attribute Details

#request_curl_commandObject (readonly)

Returns the value of attribute request_curl_command.



90
91
92
# File 'lib/fanforce/errors/errors.rb', line 90

def request_curl_command
  @request_curl_command
end

#request_paramsObject (readonly)

Returns the value of attribute request_params.



90
91
92
# File 'lib/fanforce/errors/errors.rb', line 90

def request_params
  @request_params
end

#request_urlObject (readonly)

Returns the value of attribute request_url.



90
91
92
# File 'lib/fanforce/errors/errors.rb', line 90

def request_url
  @request_url
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



90
91
92
# File 'lib/fanforce/errors/errors.rb', line 90

def response_body
  @response_body
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



90
91
92
# File 'lib/fanforce/errors/errors.rb', line 90

def response_code
  @response_code
end

Instance Method Details

#codeObject



91
# File 'lib/fanforce/errors/errors.rb', line 91

def code; 500 end

#default_error_codeObject



94
# File 'lib/fanforce/errors/errors.rb', line 94

def default_error_code; :unknown end

#default_messageObject



92
# File 'lib/fanforce/errors/errors.rb', line 92

def default_message; 'Webhook Failed' end

#valid_error_codesObject



93
# File 'lib/fanforce/errors/errors.rb', line 93

def valid_error_codes; [:third_party_error] end