Sha256: 7f6b217f4cf260aa0b25de01337290928c0e12f57e1b37332cae5e684478abf9

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

module Monday
  # Encapsulates configuration for the Monday.com API.
  #
  # Configuration options:
  #
  # token: used to authenticate the requests
  # host: defaults to https://api.monday.com/v2
  class Configuration
    DEFAULT_HOST = "https://api.monday.com/v2"
    private_constant :DEFAULT_HOST

    CONFIGURATION_FIELDS = %i[
      token
      host
    ].freeze

    attr_accessor(*CONFIGURATION_FIELDS)

    def initialize(**config_args)
      invalid_keys = config_args.keys - CONFIGURATION_FIELDS
      raise ArgumentError, "Unknown arguments: #{invalid_keys}" unless invalid_keys.empty?

      @host = DEFAULT_HOST

      config_args.each do |key, value|
        public_send("#{key}=", value)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
monday_ruby-0.1.0 lib/monday/configuration.rb