Class: Fetcher::Imap::Types::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/bas/fetcher/imap/types/response.rb

Overview

Represents a response received from the Imap client. It encapsulates essential information about the response, providing a structured way to handle and analyze it’s responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bas/fetcher/imap/types/response.rb', line 13

def initialize(response)
  if response.empty?
    @status_code = 404
    @message = "no result were found"
    @results = []
  else
    @status_code = 200
    @message = "success"
    @results = response
  end
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



11
12
13
# File 'lib/bas/fetcher/imap/types/response.rb', line 11

def message
  @message
end

#resultsObject (readonly)

Returns the value of attribute results.



11
12
13
# File 'lib/bas/fetcher/imap/types/response.rb', line 11

def results
  @results
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



11
12
13
# File 'lib/bas/fetcher/imap/types/response.rb', line 11

def status_code
  @status_code
end