Class: ReqresRspec::Configuration
- Inherits:
-
Object
- Object
- ReqresRspec::Configuration
- Defined in:
- lib/reqres_rspec/configuration.rb
Constant Summary collapse
- DEFAULT_FORMATTERS =
%w(html pdf json)
Instance Attribute Summary collapse
-
#amazon_s3 ⇒ Object
Returns the value of attribute amazon_s3.
-
#formatters ⇒ Object
Returns the value of attribute formatters.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#templates_path ⇒ Object
Returns the value of attribute templates_path.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/reqres_rspec/configuration.rb', line 28 def initialize ReqresRspec.logger.level = Logger::INFO @root = if defined?(Rails) Rails.root.to_s else raise 'REQRES_RSPEC_ROOT is not defined' if ENV['REQRES_RSPEC_ROOT'].blank? ENV['REQRES_RSPEC_ROOT'] end @templates_path = File.('../templates', __FILE__) @output_path = File.join(@root, '/doc/reqres') FileUtils.mkdir_p @output_path requested_formats = (ENV['REQRES_RSPEC_FORMATTERS'].to_s).split(',') requested_formats.sort_by!{|fmt| [DEFAULT_FORMATTERS.index(fmt), fmt]} @formatters = requested_formats.empty? ? %w(html) : requested_formats @amazon_s3 = { credentials: { access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], region: (ENV['AWS_REGION'] || 'us-east-1'), }, bucket: ENV['AWS_REQRES_BUCKET'], enabled: false } @title = 'API Docs' end |
Instance Attribute Details
#amazon_s3 ⇒ Object
Returns the value of attribute amazon_s3.
63 64 65 |
# File 'lib/reqres_rspec/configuration.rb', line 63 def amazon_s3 @amazon_s3 end |
#formatters ⇒ Object
Returns the value of attribute formatters.
61 62 63 |
# File 'lib/reqres_rspec/configuration.rb', line 61 def formatters @formatters end |
#output_path ⇒ Object
Returns the value of attribute output_path.
59 60 61 |
# File 'lib/reqres_rspec/configuration.rb', line 59 def output_path @output_path end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
62 63 64 |
# File 'lib/reqres_rspec/configuration.rb', line 62 def root @root end |
#templates_path ⇒ Object
Returns the value of attribute templates_path.
58 59 60 |
# File 'lib/reqres_rspec/configuration.rb', line 58 def templates_path @templates_path end |
#title ⇒ Object
Returns the value of attribute title.
60 61 62 |
# File 'lib/reqres_rspec/configuration.rb', line 60 def title @title end |