Sha256: 6169d6558cd80ae40417c2d1ba1d906d2472498477545c0ad22b12c97e522584

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module WaCloudApi
  class Configuration
    attr_accessor :phone_number_id, :token

    MANDATORY_ATTRIBUTES = %i[phone_number_id token].freeze

    def initialize
      @missing_params = []
    end

    def valid?
      MANDATORY_ATTRIBUTES.each do |attribute|
        @missing_params << attribute unless instance_variable_defined?("@#{attribute}")
      end

      raise ArgumentError, "#{@missing_params.join(', ')} are not set in configuration" unless @missing_params.empty?

      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wa_cloud_api-0.1.1 lib/wa_cloud_api/configuration.rb