Skip to content

Commit b1dbdee

Browse files
committed
Configure the protocol used in IODocs output
1 parent b036600 commit b1dbdee

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ RspecApiDocumentation.configure do |config|
104104
# Redefine what method the DSL thinks is the client
105105
# This is useful if you need to `let` your own client, most likely a model.
106106
config.client_method = :client
107+
108+
# Change the IODocs writer protocol
109+
config.io_docs_protocol = "http"
107110

108111
# You can define documentation groups as well. A group allows you generate multiple
109112
# sets of documentation.

features/json_iodocs.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Feature: Json Iodocs
2525
config.app = App
2626
config.api_name = "app"
2727
config.format = :json_iodocs
28+
config.io_docs_protocol = "https"
2829
end
2930
3031
resource "Greetings" do
@@ -64,6 +65,17 @@ Feature: Json Iodocs
6465
And the exit status should be 0
6566

6667
Scenario: File should look like we expect
68+
Then the file "doc/api/apiconfig.json" should contain JSON exactly like:
69+
"""
70+
{
71+
"app" : {
72+
"name" : "app",
73+
"protocol" : "https",
74+
"publicPath" : "",
75+
"baseURL" : null
76+
}
77+
}
78+
"""
6779
Then the file "doc/api/app.json" should contain JSON exactly like:
6880
"""
6981
{

lib/rspec_api_documentation/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def self.add_setting(name, opts = {})
5757
add_setting :curl_host, :default => nil
5858
add_setting :keep_source_order, :default => false
5959
add_setting :api_name, :default => "API Documentation"
60+
add_setting :io_docs_protocol, :default => "http"
6061

6162
def client_method=(new_client_method)
6263
RspecApiDocumentation::DSL::Resource.module_eval <<-RUBY

lib/rspec_api_documentation/writers/json_iodocs_writer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def as_json(opts = nil)
100100
{
101101
@api_key.to_sym => {
102102
:name => @configuration.api_name,
103-
:protocol => "http",
103+
:protocol => @configuration.io_docs_protocol,
104104
:publicPath => "",
105105
:baseURL => @configuration.curl_host
106106
}

spec/configuration_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
its(:keep_source_order) { should be_false }
5353
its(:api_name) { should == "API Documentation" }
5454
its(:client_method) { should == :client }
55+
its(:io_docs_protocol) { should == "http" }
5556
end
5657

5758
describe "#define_groups" do

0 commit comments

Comments
 (0)