class PosthavenTheme::APIError
Attributes
response[RW]
Public Class Methods
new(response)
click to toggle source
# File lib/posthaven_theme.rb, line 14 def initialize(response) @response = response end
Public Instance Methods
message()
click to toggle source
# File lib/posthaven_theme.rb, line 18 def message "#{response_message} – #{response_error_message(response)}" end
Private Instance Methods
response_error_message(response)
click to toggle source
# File lib/posthaven_theme.rb, line 32 def response_error_message(response) errors = @response.parsed_response ? @response.parsed_response["errors"] : @response.body case errors when NilClass '' when String errors.strip when Array errors.join(", ") end end
response_message()
click to toggle source
# File lib/posthaven_theme.rb, line 24 def response_message if @response.response && @response.response.message && @response.response.message.size > 0 @response.response.message else @response.code end end