apiaryio 0.3.4 → 0.3.5
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.
- data/lib/apiary/command/fetch.rb +4 -4
- data/lib/apiary/command/preview.rb +7 -3
- data/lib/apiary/command/publish.rb +9 -3
- data/lib/apiary/version.rb +1 -1
- metadata +2 -2
data/lib/apiary/command/fetch.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'rest-client'
|
3
3
|
require 'rack'
|
4
4
|
require 'ostruct'
|
5
5
|
require 'json'
|
@@ -21,7 +21,8 @@ module Apiary
|
|
21
21
|
@options.headers ||= {
|
22
22
|
:accept => "text/html",
|
23
23
|
:content_type => "text/plain",
|
24
|
-
:authentication => "Token #{@options.api_key}"
|
24
|
+
:authentication => "Token #{@options.api_key}",
|
25
|
+
:user_agent => "Apiary Client Gem (https://help.apiary.io/tools/apiary-cli/)"
|
25
26
|
}
|
26
27
|
end
|
27
28
|
|
@@ -61,8 +62,7 @@ module Apiary
|
|
61
62
|
response = RestClient.get url, @options.headers
|
62
63
|
rescue RestClient::Exception => e
|
63
64
|
abort "Apiary service responded with an error: #{e.message}"
|
64
|
-
end
|
65
|
-
|
65
|
+
end
|
66
66
|
JSON.parse response.body
|
67
67
|
end
|
68
68
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'rest-client'
|
3
3
|
require 'rack'
|
4
4
|
require 'ostruct'
|
5
5
|
require 'json'
|
@@ -30,11 +30,15 @@ module Apiary
|
|
30
30
|
@options = OpenStruct.new(opts)
|
31
31
|
@options.path ||= 'apiary.apib'
|
32
32
|
@options.api_host ||= 'api.apiary.io'
|
33
|
-
@options.headers ||= {:accept => 'text/html', :content_type => 'text/plain'}
|
34
33
|
@options.port ||= 8080
|
35
34
|
@options.proxy ||= ENV['http_proxy']
|
36
35
|
@options.server ||= false
|
37
|
-
|
36
|
+
@options.host ||= '127.0.0.1'
|
37
|
+
@options.headers ||= {
|
38
|
+
:accept => 'text/html',
|
39
|
+
:content_type => 'text/plain',
|
40
|
+
:user_agent => "Apiary Client Gem (https://help.apiary.io/tools/apiary-cli/)"
|
41
|
+
}
|
38
42
|
|
39
43
|
validate_apib_file
|
40
44
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'rest-client'
|
3
3
|
require 'rack'
|
4
4
|
require 'ostruct'
|
5
5
|
require 'json'
|
@@ -22,7 +22,8 @@ module Apiary
|
|
22
22
|
@options.headers ||= {
|
23
23
|
:accept => "text/html",
|
24
24
|
:content_type => "text/plain",
|
25
|
-
:authentication => "Token #{@options.api_key}"
|
25
|
+
:authentication => "Token #{@options.api_key}",
|
26
|
+
:user_agent => "Apiary Client Gem (https://help.apiary.io/tools/apiary-cli/)"
|
26
27
|
}
|
27
28
|
@options.message ||= "Saving blueprint from apiary-client"
|
28
29
|
end
|
@@ -77,7 +78,12 @@ module Apiary
|
|
77
78
|
abort "Apiary service responded with an error: #{err['message']}"
|
78
79
|
end
|
79
80
|
rescue RestClient::Exception => e
|
80
|
-
|
81
|
+
err = JSON.parse e.response
|
82
|
+
if err.has_key? 'message'
|
83
|
+
abort "Apiary service responded with an error: #{err['message']}"
|
84
|
+
else
|
85
|
+
abort "Apiary service responded with an error: #{e.message}"
|
86
|
+
end
|
81
87
|
end
|
82
88
|
end
|
83
89
|
end
|
data/lib/apiary/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiaryio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|