apiaryio 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +1 -2
- data/Dockerfile +4 -0
- data/README.md +15 -0
- data/Rakefile +1 -1
- data/apiary.gemspec +1 -1
- data/lib/apiary/command/publish.rb +2 -2
- data/lib/apiary/version.rb +1 -1
- data/spec/command/publish_spec.rb +48 -0
- data/spec/spec_helper.rb +0 -1
- metadata +7 -4
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/Dockerfile
ADDED
data/README.md
CHANGED
@@ -25,6 +25,21 @@ For instructions on making your own changes, see [Hacking Apiary CLI Client](#h
|
|
25
25
|
gem install apiaryio
|
26
26
|
```
|
27
27
|
|
28
|
+
### Using Docker - alternative if you don't install ruby or installation not work for you
|
29
|
+
|
30
|
+
Download image:
|
31
|
+
|
32
|
+
```
|
33
|
+
docker pull apiaryio/client
|
34
|
+
```
|
35
|
+
Run instead `apiary` just `docker run apiaryio/client`
|
36
|
+
|
37
|
+
Build from source code:
|
38
|
+
|
39
|
+
```
|
40
|
+
docker build -t "apiaryio/client" .
|
41
|
+
```
|
42
|
+
|
28
43
|
### Setup Apiary credentials
|
29
44
|
|
30
45
|
*Required only for publish and fetch commands.*
|
data/Rakefile
CHANGED
data/apiary.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
|
24
24
|
gem.add_runtime_dependency "json", "~> 1.8"
|
25
25
|
|
26
|
-
gem.add_development_dependency "rspec", "~> 3.2"
|
26
|
+
gem.add_development_dependency "rspec", "~> 3.2.0"
|
27
27
|
gem.add_development_dependency "webmock", "~> 1.20"
|
28
28
|
gem.add_development_dependency "yard", "~> 0.8"
|
29
29
|
gem.add_development_dependency "aruba", ">= 0.6.2", "< 0.7.0"
|
@@ -24,7 +24,7 @@ module Apiary
|
|
24
24
|
:content_type => "text/plain",
|
25
25
|
:authentication => "Token #{@options.api_key}"
|
26
26
|
}
|
27
|
-
@options.
|
27
|
+
@options.message ||= "Saving blueprint from apiary-client"
|
28
28
|
end
|
29
29
|
|
30
30
|
def execute()
|
@@ -63,7 +63,7 @@ module Apiary
|
|
63
63
|
if validate_apib_file path
|
64
64
|
data = {
|
65
65
|
:code => get_apib_file(path),
|
66
|
-
:messageToSave => @options.
|
66
|
+
:messageToSave => @options.message
|
67
67
|
}
|
68
68
|
RestClient.proxy = @options.proxy
|
69
69
|
|
data/lib/apiary/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Apiary::Command::Publish do
|
4
|
+
context 'when constructed without a message' do
|
5
|
+
let(:message) do
|
6
|
+
Apiary::Command::Publish.new({
|
7
|
+
:api_name => 'myapi',
|
8
|
+
:path => './features/fixtures/apiary.apib'
|
9
|
+
}).options.message
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'uses the default message' do
|
13
|
+
expect(message).to eq('Saving blueprint from apiary-client')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when constructed with a message' do
|
18
|
+
let(:message) do
|
19
|
+
Apiary::Command::Publish.new({
|
20
|
+
:api_name => 'myapi',
|
21
|
+
:message => 'Custom message',
|
22
|
+
:path => './features/fixtures/apiary.apib'
|
23
|
+
}).options.message
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'stores the message in the opts' do
|
27
|
+
expect(message).to eq('Custom message')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#execute' do
|
32
|
+
context 'when calling with a custom message' do
|
33
|
+
before(:all) do
|
34
|
+
WebMock.stub_request(:post, 'https://api.apiary.io/blueprint/publish/myapi')
|
35
|
+
Apiary::Command::Publish.new({
|
36
|
+
:api_name => 'myapi',
|
37
|
+
:message => 'Custom message',
|
38
|
+
:path => './features/fixtures/apiary.apib'
|
39
|
+
}).execute
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'sends the message when publishing' do
|
43
|
+
expect(WebMock).to have_requested(:post, 'https://api.apiary.io/blueprint/publish/myapi').
|
44
|
+
with {|request| request.body.include? 'messageToSave=Custom%20message'}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.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.4
|
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:
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 3.2.0
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 3.2.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: webmock
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- .gitignore
|
195
195
|
- .rspec
|
196
196
|
- .travis.yml
|
197
|
+
- Dockerfile
|
197
198
|
- Gemfile
|
198
199
|
- LICENSE
|
199
200
|
- README.md
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- spec/cli_spec.rb
|
225
226
|
- spec/command/fetch_spec.rb
|
226
227
|
- spec/command/preview_spec.rb
|
228
|
+
- spec/command/publish_spec.rb
|
227
229
|
- spec/common_spec.rb
|
228
230
|
- spec/spec_helper.rb
|
229
231
|
- spec/support/aruba.rb
|
@@ -266,6 +268,7 @@ test_files:
|
|
266
268
|
- spec/cli_spec.rb
|
267
269
|
- spec/command/fetch_spec.rb
|
268
270
|
- spec/command/preview_spec.rb
|
271
|
+
- spec/command/publish_spec.rb
|
269
272
|
- spec/common_spec.rb
|
270
273
|
- spec/spec_helper.rb
|
271
274
|
- spec/support/aruba.rb
|