Sha256: 0c4cb098bb233e48f450061345b53e355e9f9f02de111b2045359e65f7d054db

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

module Rpdoc
  class Configuration
    attr_reader \
      :postman_host,
      :postman_collection_path,
      :collection_schema

    attr_accessor \
      :rpdoc_enable,
      :postman_apikey,
      :collection_workspace,
      :collection_uid,
      :collection_name,
      :rspec_server_host,
      :rspec_request_allow_headers,
      :rpdoc_root,
      :rpdoc_request_filename,
      :rpdoc_description_filename,
      :rpdoc_collection_filename,
      :rpdoc_auto_push,
      :rpdoc_auto_push_strategy

    def initialize
      @rpdoc_enable = ENV['RPDOC_ENABLE'] != 'false'

      @postman_host = 'https://api.getpostman.com'
      @postman_collection_path = "/collections"
      @postman_apikey = nil

      @collection_workspace = nil
      @collection_uid = nil
      @collection_name = 'Rpdoc'
      @collection_schema = 'https://schema.getpostman.com/json/collection/v2.1.0/collection.json'

      @rspec_server_host = '{{server_host}}'
      @rspec_request_allow_headers = ['User-Agent', 'Content-Type', 'Authorization']

      @rpdoc_root = 'rpdoc'
      @rpdoc_request_filename = 'request.json'
      @rpdoc_description_filename = 'description.md'
      @rpdoc_collection_filename = 'collection.json'
      @rpdoc_auto_push = false
      @rpdoc_auto_push_strategy = :push_and_create # or :push_and_update
    end
  
    def valid?
      return true unless @rpdoc_enable && @rpdoc_auto_push
      return false if @postman_apikey.nil?
      return false if @rpdoc_auto_push_strategy == :push_and_update && @collection_uid.nil?
      true
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rpdoc-0.1.12 lib/rpdoc/configuration.rb
rpdoc-0.1.11 lib/rpdoc/configuration.rb
rpdoc-0.1.10 lib/rpdoc/configuration.rb
rpdoc-0.1.9 lib/rpdoc/configuration.rb
rpdoc-0.1.8 lib/rpdoc/configuration.rb
rpdoc-0.1.7 lib/rpdoc/configuration.rb
rpdoc-0.1.6 lib/rpdoc/configuration.rb
rpdoc-0.1.5 lib/rpdoc/configuration.rb
rpdoc-0.1.4 lib/rpdoc/configuration.rb
rpdoc-0.1.3 lib/rpdoc/configuration.rb
rpdoc-0.1.2 lib/rpdoc/configuration.rb