Class: Fetcher::Postgres::Types::Response

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

Overview

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

Constant Summary collapse

SUCCESS_STATUS =
"PGRES_TUPLES_OK"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



14
15
16
17
18
19
20
# File 'lib/bas/fetcher/postgres/types/response.rb', line 14

def initialize(response)
  if response.res_status == SUCCESS_STATUS
    success_response(response)
  else
    failure_response(response)
  end
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



10
11
12
# File 'lib/bas/fetcher/postgres/types/response.rb', line 10

def fields
  @fields
end

#messageObject (readonly)

Returns the value of attribute message.



10
11
12
# File 'lib/bas/fetcher/postgres/types/response.rb', line 10

def message
  @message
end

#recordsObject (readonly)

Returns the value of attribute records.



10
11
12
# File 'lib/bas/fetcher/postgres/types/response.rb', line 10

def records
  @records
end

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/bas/fetcher/postgres/types/response.rb', line 10

def response
  @response
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/bas/fetcher/postgres/types/response.rb', line 10

def status
  @status
end