apiaryio 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +0,0 @@
1
- require "apiary/commands/base"
2
-
3
- # Display preview of local blueprint file
4
- #
5
- class Apiary::Command::Preview < Apiary::Command::Base
6
-
7
- # preview
8
- #
9
- # Launch web browser and display preview of local blueprint file
10
- #
11
- def index
12
-
13
- api_server = ENV['APIARY_API_HOST'] || "api.apiary.io"
14
- require 'launchy'
15
- require 'rest_client'
16
-
17
- headers = {:accept => "text/html",:content_type => "text/plain"}
18
- response = RestClient.post "https://#{api_server}/blueprint/generate", IO.read('apiary.apib'), headers
19
-
20
- aFile = File.new("/tmp/apiarypreview.html", "w")
21
- aFile.write(response)
22
- aFile.close
23
-
24
- Launchy.open("file:///tmp/apiarypreview.html")
25
- end
26
-
27
- end