Class: Rpdoc::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rpdoc/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rpdoc/configuration.rb', line 25

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

Instance Attribute Details

#collection_nameObject

Returns the value of attribute collection_name.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def collection_name
  @collection_name
end

#collection_schemaObject (readonly)

Returns the value of attribute collection_schema.



5
6
7
# File 'lib/rpdoc/configuration.rb', line 5

def collection_schema
  @collection_schema
end

#collection_uidObject

Returns the value of attribute collection_uid.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def collection_uid
  @collection_uid
end

#collection_workspaceObject

Returns the value of attribute collection_workspace.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def collection_workspace
  @collection_workspace
end

#postman_apikeyObject

Returns the value of attribute postman_apikey.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def postman_apikey
  @postman_apikey
end

#postman_collection_pathObject (readonly)

Returns the value of attribute postman_collection_path.



5
6
7
# File 'lib/rpdoc/configuration.rb', line 5

def postman_collection_path
  @postman_collection_path
end

#postman_hostObject (readonly)

Returns the value of attribute postman_host.



5
6
7
# File 'lib/rpdoc/configuration.rb', line 5

def postman_host
  @postman_host
end

#rpdoc_auto_pushObject

Returns the value of attribute rpdoc_auto_push.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_auto_push
  @rpdoc_auto_push
end

#rpdoc_auto_push_strategyObject

Returns the value of attribute rpdoc_auto_push_strategy.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_auto_push_strategy
  @rpdoc_auto_push_strategy
end

#rpdoc_collection_filenameObject

Returns the value of attribute rpdoc_collection_filename.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_collection_filename
  @rpdoc_collection_filename
end

#rpdoc_description_filenameObject

Returns the value of attribute rpdoc_description_filename.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_description_filename
  @rpdoc_description_filename
end

#rpdoc_enableObject

Returns the value of attribute rpdoc_enable.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_enable
  @rpdoc_enable
end

#rpdoc_request_filenameObject

Returns the value of attribute rpdoc_request_filename.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_request_filename
  @rpdoc_request_filename
end

#rpdoc_rootObject

Returns the value of attribute rpdoc_root.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rpdoc_root
  @rpdoc_root
end

#rspec_request_allow_headersObject

Returns the value of attribute rspec_request_allow_headers.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rspec_request_allow_headers
  @rspec_request_allow_headers
end

#rspec_server_hostObject

Returns the value of attribute rspec_server_host.



10
11
12
# File 'lib/rpdoc/configuration.rb', line 10

def rspec_server_host
  @rspec_server_host
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
# File 'lib/rpdoc/configuration.rb', line 48

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