api-regulator 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/api_regulator/version.rb +1 -1
- data/lib/tasks/api_regulator_tasks.rake +9 -8
- metadata +1 -2
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc90df799ef332c90224ad7dc69c09b1382e794bd0d78cce52626ba5417cc937
|
4
|
+
data.tar.gz: 37b309941d4636af0df1db9c3434c6bb559e975d40f70976b27c3d6b928c92d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 737dd5beea6afff1a23a105ff48aa7bbc3718d292e59b5e3c91a7373bd5ec7994281472649f42969beb083027999b9f7874e6da12385a096178c6b32106891c0
|
7
|
+
data.tar.gz: c90270e1edb4a58f0397291ab072224751df8e0ff6a3ebfd3d348f9758a4e4c064177ce371f2d36c761f11ebbfbc5323d5722fe47a2cbbeac779f66033911dce
|
data/Gemfile.lock
CHANGED
@@ -86,14 +86,15 @@ namespace :api_docs do
|
|
86
86
|
|
87
87
|
# Use metadata to build the API request
|
88
88
|
slug = metadata["slug"] || File.basename(file_path, ".md").gsub("_", "-")
|
89
|
-
|
89
|
+
request_body = {
|
90
90
|
type: "basic",
|
91
91
|
categorySlug: "documentation",
|
92
|
-
hidden: false
|
92
|
+
hidden: false,
|
93
|
+
body: body
|
93
94
|
}.merge(metadata)
|
94
|
-
|
95
|
+
request_body["slug"] ||= slug
|
95
96
|
|
96
|
-
raise("Title missing in #{file_path}") unless
|
97
|
+
raise("Title missing in #{file_path}") unless request_body["title"].present?
|
97
98
|
|
98
99
|
# Build the API request
|
99
100
|
if check_if_page_exists(slug)
|
@@ -105,7 +106,7 @@ namespace :api_docs do
|
|
105
106
|
end
|
106
107
|
request["Authorization"] = "Basic #{Base64.strict_encode64(readme_api_key)}"
|
107
108
|
request["Content-Type"] = "application/json"
|
108
|
-
request.body =
|
109
|
+
request.body = request_body.compact.to_json
|
109
110
|
|
110
111
|
# Send the request
|
111
112
|
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
@@ -115,11 +116,11 @@ namespace :api_docs do
|
|
115
116
|
# Handle the response
|
116
117
|
case response.code.to_i
|
117
118
|
when 200
|
118
|
-
puts "Page '#{
|
119
|
+
puts "Page '#{request_body["title"]}' successfully updated!"
|
119
120
|
when 201
|
120
|
-
puts "Page '#{
|
121
|
+
puts "Page '#{request_body["title"]}' successfully created!"
|
121
122
|
else
|
122
|
-
puts "Failed to upload page '#{
|
123
|
+
puts "Failed to upload page '#{request_body["title"]}'!"
|
123
124
|
puts "Response Code: #{response.code}"
|
124
125
|
puts "Response Body: #{response.body}"
|
125
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-regulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Massanek
|
@@ -134,7 +134,6 @@ files:
|
|
134
134
|
- ".gitignore"
|
135
135
|
- ".rspec"
|
136
136
|
- ".ruby-version"
|
137
|
-
- ".travis.yml"
|
138
137
|
- Gemfile
|
139
138
|
- Gemfile.lock
|
140
139
|
- LICENSE.txt
|