module Postnord
  class Response
    def initialize(data)
      @data = data
      @code = data.status
      @status = data.msg
    end

    def code
      @data.code
    end

    def status
      @data.status
    end

    def data
      JSON.parse(@data.body)
    rescue JSON::ParserError
      @data.body
    end

    def to_h
      {
        code: @code,
        status: @status,
        data: data,
      }
    end
  end
end

module Postnord
  class Response
    def initialize(data)
      @data = data
      @code = data.status
    end

    def code
      @data.code
    end

    def data
      JSON.parse(@data.body)
    rescue JSON::ParserError
      @data.body
    end

    def to_h
      {
        code: @code,
        data: data,
      }
    end
  end
end

Remove status since faraday does not provide message and it does not seem to be in use
Remove status since faraday does not provide message and it does not
seem to be in use
