Sha256: f90531476b43444b999ecacfa1d6e52209a263c9699fabe069581c1605c29627

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module Payture::Cheques
  class Config
    # required
    attr_reader :host
    attr_reader :merchant_id
    attr_reader :password

    # optional
    attr_reader :logger
    attr_reader :timeout
    attr_reader :open_timeout

    def initialize(**options)
      @host = options[:host]
      @merchant_id = options[:merchant_id]
      @password = options[:password]
      @logger = options[:logger]
      @timeout = options[:timeout]
      @open_timeout = options[:open_timeout]

      check_required_fields!
    end

    def base_url
      "https://#{host}/apicheque"
    end

    private

    def check_required_fields!
      unless host && merchant_id && password
        raise ArgumentError,
          'Required options: host, merchant_id, password'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
payture-cheques-0.1.5 lib/payture/cheques/config.rb
payture-cheques-0.1.4 lib/payture/cheques/config.rb
payture-cheques-0.1.3 lib/payture/cheques/config.rb
payture-cheques-0.1.2 lib/payture/cheques/config.rb
payture-cheques-0.1.0 lib/payture/cheques/config.rb