Sha256: 34ddd3426e489868414f9e4cde32e001dfd5388f13353295a61172c0dc60f236

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true
module Notion
  module Config
    extend self

    ATTRIBUTES = %i[
      proxy
      user_agent
      ca_path
      ca_file
      logger
      endpoint
      token
      timeout
      open_timeout
      default_page_size
      default_max_retries
      adapter
    ].freeze

    attr_accessor(*Config::ATTRIBUTES)

    def reset
      self.endpoint = 'https://api.notion.com/v1'
      self.user_agent = "Notion Ruby Client/#{Notion::VERSION}"
      self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
      self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
      self.token = nil
      self.proxy = nil
      self.logger = nil
      self.timeout = nil
      self.open_timeout = nil
      self.default_page_size = 100
      self.default_max_retries = 100
      self.adapter = ::Faraday.default_adapter
    end

    reset
  end

  class << self
    def configure
      block_given? ? yield(Config) : Config
    end

    def config
      Config
    end
  end
end

Notion::Config.reset

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notion-ruby-client-0.0.8 lib/notion/config.rb
notion-ruby-client-0.0.7 lib/notion/config.rb
notion-ruby-client-0.0.6 lib/notion/config.rb
notion-ruby-client-0.0.5 lib/notion/config.rb
notion-ruby-client-0.0.4 lib/notion/config.rb