class Firstclasspostcodes::ResponseError

Attributes

doc_url[R]
type[R]

Public Class Methods

new(obj, type = nil) click to toggle source
Calls superclass method
# File lib/firstclasspostcodes/response_error.rb, line 9
def initialize(obj, type = nil)
  if obj.is_a?(Hash)
    super(obj[:message])
    @doc_url = obj[:docUrl]
    @type = obj[:type]
    return
  end
  super(obj)
  @doc_url = "#{DOC_URL}/#{type}"
  @type = type
end

Public Instance Methods

message() click to toggle source
# File lib/firstclasspostcodes/response_error.rb, line 21
    def message
      <<-MSG
        The following "#{type}" error was encountered:
          #{super}
        => See: #{doc_url}
      MSG
    end