Class: NotionRb::Api::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/notion_rb/api/base.rb

Direct Known Subclasses

Create, Destroy, Get, Restore, Update

Constant Summary collapse

BASE_URL =
'https://www.notion.so/'
API_BASE_URL =
BASE_URL + 'api/v3/'
SIGNED_URL_PREFIX =
'https://www.notion.so/signed/'
S3_URL_PREFIX =
'https://s3-us-west-2.amazonaws.com/secure.notion-static.com/'
S3_URL_PREFIX_ENCODED =
'https://s3.us-west-2.amazonaws.com/secure.notion-static.com/'
REDEFINE_EXCEPTION =
'Define methods on subclass'

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
# File 'lib/notion_rb/api/base.rb', line 13

def initialize(params)
  @notion_id = params[:notion_id]
  @token_v2 = NotionRb.config[:token_v2]
  @converter = NotionRb::Utils::Converter.new
end

Instance Method Details

#callObject



19
20
21
# File 'lib/notion_rb/api/base.rb', line 19

def call
  response
end

#success?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/notion_rb/api/base.rb', line 23

def success?
  response.code == '200'
rescue Mechanize::ResponseCodeError
  false
end