Class: Fetcher::Notion::Types::Response

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

Overview

Represents a response received from the Notion API. 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.



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

def initialize(response)
  if response["results"].nil?
    @status_code = response["status"]
    @message = response["message"]
    @results = []
  else
    @status_code = 200
    @message = "success"
    @results = response["results"]
  end
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#resultsObject (readonly)

Returns the value of attribute results.



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

def results
  @results
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



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

def status_code
  @status_code
end