Sha256: 56872c84cbc6737f2701ebc77662488e4d346e8b9e6431a45225434365de2e17

Contents?: true

Size: 946 Bytes

Versions: 1

Compression:

Stored size: 946 Bytes

Contents

module RubyIsds
  class Configuration
    attr_writer :data_box, :username, :password, :env, :api_url

    def initialize
      @username = nil
      @password = nil
      @data_box = nil
      @env = nil
    end

    def data_box
      raise ConfigNotSet, 'data_box' unless @data_box
      @data_box
    end

    def username
      raise ConfigNotSet, 'username' unless @username
      @username
    end

    def password
      raise ConfigNotSet, 'password' unless @password
      @password
    end

    ##
    # env values:
    #   :development (default)
    #   :production
    #
    def env
      return :development unless @env
      @env
    end

    def api_domain
      case @env
      when :production then 'https://ws1.mojedatovaschranka.cz'
      else 'https://ws1.czebox.cz'
      end
    end

    def xml_url
      case @env
      when :production then 'mojedatovaschranka.cz'
      else 'czechpoint.cz'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_isds-0.11.0 lib/ruby_isds/configuration.rb