apiaryio 0.0.8 → 0.0.9
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/.gitignore +1 -0
- data/.travis.yml +3 -4
- data/Gemfile +5 -0
- data/README.md +6 -2
- data/apiary.gemspec +4 -3
- data/doc/Apiary.html +7 -7
- data/doc/Apiary/CLI.html +44 -32
- data/doc/Apiary/Command.html +7 -7
- data/doc/Apiary/Command/Fetch.html +572 -0
- data/doc/Apiary/Command/Help.html +16 -11
- data/doc/Apiary/Command/Preview.html +175 -216
- data/doc/Apiary/Command/Publish.html +634 -0
- data/doc/Apiary/Command/Runner.html +8 -9
- data/doc/Apiary/Command/Version.html +7 -8
- data/doc/_index.html +28 -6
- data/doc/class_list.html +3 -2
- data/doc/css/style.css +11 -1
- data/doc/file.README.html +37 -22
- data/doc/file_list.html +2 -1
- data/doc/frames.html +5 -7
- data/doc/index.html +37 -22
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +7 -2
- data/doc/method_list.html +112 -89
- data/doc/top-level-namespace.html +5 -5
- data/lib/apiary/command/fetch.rb +79 -0
- data/lib/apiary/command/help.rb +1 -0
- data/lib/apiary/version.rb +1 -1
- data/spec/command/fetch_spec.rb +87 -0
- data/spec/spec_helper.rb +1 -0
- metadata +121 -85
data/lib/apiary/command/help.rb
CHANGED
|
@@ -24,6 +24,7 @@ module Apiary
|
|
|
24
24
|
puts "\tpreview --server Start standalone web server on port 8080"
|
|
25
25
|
puts "\tpreview --server --port [PORT] Start standalone web server on specified port"
|
|
26
26
|
puts "\tpublish --api-name [API_NAME] Publish apiary.apib on docs.API_NAME.apiary.io"
|
|
27
|
+
puts "\tfetch --api-name [API_NAME] Fetch apiary.apib from API_NAME.apiary.io"
|
|
27
28
|
puts "\n"
|
|
28
29
|
puts "\thelp Show this help"
|
|
29
30
|
puts "\n"
|
data/lib/apiary/version.rb
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Apiary::Command::Fetch do
|
|
4
|
+
|
|
5
|
+
it 'pass command without params' do
|
|
6
|
+
opts = {}
|
|
7
|
+
command = Apiary::Command::Fetch.new(opts)
|
|
8
|
+
expect { command.fetch_from_apiary }.to raise_error('Please provide an api-name option (subdomain part from your http://docs.<api-name>.apiary.io/)')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'pass command only with api_name' do
|
|
12
|
+
opts = {
|
|
13
|
+
:api_name => 'test_api'
|
|
14
|
+
}
|
|
15
|
+
command = Apiary::Command::Fetch.new(opts)
|
|
16
|
+
expect { command.fetch_from_apiary }.to raise_error('API key must be provided through environment variable APIARY_API_KEY. Please go to https://login.apiary.io/tokens to obtain it.')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'check request for fetch to apiary' do
|
|
20
|
+
|
|
21
|
+
API_NAME = 'test_api'
|
|
22
|
+
|
|
23
|
+
opts = {
|
|
24
|
+
:api_name => API_NAME,
|
|
25
|
+
:api_key => '1234567890'
|
|
26
|
+
}
|
|
27
|
+
command = Apiary::Command::Fetch.new(opts)
|
|
28
|
+
|
|
29
|
+
BODY_EXAMPLE = '{
|
|
30
|
+
"error": false,
|
|
31
|
+
"message": "",
|
|
32
|
+
"code": "FORMAT: 1A\nHOST: http://www.testing.com\n\n# Notes API test 123\nNotes API is a *short texts saving* service similar to its physical paper presence on your table.\n\n# Group Notes\nNotes related resources of the **Notes API**\n\n## Notes Collection [/notes]\n### List all Notes [GET]\n+ Response 200 (application/json)\n\n [{\n \"id\": 1, \"title\": \"Jogging in park\"\n }, {\n \"id\": 2, \"title\": \"Pick-up posters from post-office\"\n }]\n\n### Create a Note [POST]\n+ Request (application/json)\n\n { \"title\": \"Buy cheese and bread for breakfast.\" }\n\n+ Response 201 (application/json)\n\n { \"id\": 3, \"title\": \"Buy cheese and bread for breakfast.\" }\n\n## Note [/notes/{id}]\nA single Note object with all its details\n\n+ Parameters\n + id (required, number, `1`) ... Numeric `id` of the Note to perform action with. Has example value.\n\n### Retrieve a Note [GET]\n+ Response 200 (application/json)\n\n + Header\n\n X-My-Header: The Value\n\n + Body\n\n { \"id\": 2, \"title\": \"Pick-up posters from post-office\" }\n\n### Remove a Note [DELETE]\n+ Response 204\n"
|
|
33
|
+
}'
|
|
34
|
+
|
|
35
|
+
BLUEPRINT_EXAMPLE = %Q{FORMAT: 1A
|
|
36
|
+
HOST: http://www.testing.com
|
|
37
|
+
|
|
38
|
+
# Notes API test 123
|
|
39
|
+
Notes API is a *short texts saving* service similar to its physical paper presence on your table.
|
|
40
|
+
|
|
41
|
+
# Group Notes
|
|
42
|
+
Notes related resources of the **Notes API**
|
|
43
|
+
|
|
44
|
+
## Notes Collection [/notes]
|
|
45
|
+
### List all Notes [GET]
|
|
46
|
+
+ Response 200 (application/json)
|
|
47
|
+
|
|
48
|
+
[{
|
|
49
|
+
"id": 1, "title": "Jogging in park"
|
|
50
|
+
}, {
|
|
51
|
+
"id": 2, "title": "Pick-up posters from post-office"
|
|
52
|
+
}]
|
|
53
|
+
|
|
54
|
+
### Create a Note [POST]
|
|
55
|
+
+ Request (application/json)
|
|
56
|
+
|
|
57
|
+
{ "title": "Buy cheese and bread for breakfast." }
|
|
58
|
+
|
|
59
|
+
+ Response 201 (application/json)
|
|
60
|
+
|
|
61
|
+
{ "id": 3, "title": "Buy cheese and bread for breakfast." }
|
|
62
|
+
|
|
63
|
+
## Note [/notes/{id}]
|
|
64
|
+
A single Note object with all its details
|
|
65
|
+
|
|
66
|
+
+ Parameters
|
|
67
|
+
+ id (required, number, `1`) ... Numeric `id` of the Note to perform action with. Has example value.
|
|
68
|
+
|
|
69
|
+
### Retrieve a Note [GET]
|
|
70
|
+
+ Response 200 (application/json)
|
|
71
|
+
|
|
72
|
+
+ Header
|
|
73
|
+
|
|
74
|
+
X-My-Header: The Value
|
|
75
|
+
|
|
76
|
+
+ Body
|
|
77
|
+
|
|
78
|
+
{ "id": 2, "title": "Pick-up posters from post-office" }
|
|
79
|
+
|
|
80
|
+
### Remove a Note [DELETE]
|
|
81
|
+
+ Response 204
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
stub_request(:get, "https://api.apiary.io/blueprint/get/#{API_NAME}").to_return(:status => 200, :body => BODY_EXAMPLE, :headers => { 'Content-Type' => 'text/plain' })
|
|
85
|
+
command.fetch_from_apiary.should eq(BLUEPRINT_EXAMPLE)
|
|
86
|
+
end
|
|
87
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,104 +1,128 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apiaryio
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 13
|
|
5
5
|
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 9
|
|
10
|
+
version: 0.0.9
|
|
6
11
|
platform: ruby
|
|
7
|
-
authors:
|
|
12
|
+
authors:
|
|
8
13
|
- Apiary Ltd.
|
|
9
14
|
autorequire:
|
|
10
15
|
bindir: bin
|
|
11
16
|
cert_chain: []
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
date: 2014-01-27 00:00:00 Z
|
|
19
|
+
dependencies:
|
|
20
|
+
- !ruby/object:Gem::Dependency
|
|
15
21
|
name: rest-client
|
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
|
-
requirements:
|
|
19
|
-
- - ~>
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.6.7
|
|
22
|
-
type: :runtime
|
|
23
22
|
prerelease: false
|
|
24
|
-
|
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
24
|
none: false
|
|
26
|
-
requirements:
|
|
25
|
+
requirements:
|
|
27
26
|
- - ~>
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
hash: 1
|
|
29
|
+
segments:
|
|
30
|
+
- 1
|
|
31
|
+
- 6
|
|
32
|
+
- 7
|
|
29
33
|
version: 1.6.7
|
|
30
|
-
- !ruby/object:Gem::Dependency
|
|
31
|
-
name: rack
|
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
|
-
requirements:
|
|
35
|
-
- - ~>
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version: 1.4.1
|
|
38
34
|
type: :runtime
|
|
35
|
+
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: rack
|
|
39
38
|
prerelease: false
|
|
40
|
-
|
|
41
|
-
none: false
|
|
42
|
-
requirements:
|
|
43
|
-
- - ~>
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
version: 1.4.1
|
|
46
|
-
- !ruby/object:Gem::Dependency
|
|
47
|
-
name: rake
|
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
49
40
|
none: false
|
|
50
|
-
requirements:
|
|
51
|
-
- -
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 7
|
|
45
|
+
segments:
|
|
46
|
+
- 1
|
|
47
|
+
- 4
|
|
48
|
+
- 0
|
|
49
|
+
version: 1.4.0
|
|
50
|
+
- - <
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
hash: 15
|
|
53
|
+
segments:
|
|
54
|
+
- 1
|
|
55
|
+
- 6
|
|
56
|
+
- 0
|
|
57
|
+
version: 1.6.0
|
|
54
58
|
type: :runtime
|
|
59
|
+
version_requirements: *id002
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: rake
|
|
55
62
|
prerelease: false
|
|
56
|
-
|
|
63
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
57
64
|
none: false
|
|
58
|
-
requirements:
|
|
59
|
-
- -
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
hash: 3
|
|
69
|
+
segments:
|
|
70
|
+
- 0
|
|
71
|
+
version: "0"
|
|
72
|
+
type: :runtime
|
|
73
|
+
version_requirements: *id003
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
63
75
|
name: rspec
|
|
64
|
-
|
|
76
|
+
prerelease: false
|
|
77
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
65
78
|
none: false
|
|
66
|
-
requirements:
|
|
67
|
-
- -
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
hash: 3
|
|
83
|
+
segments:
|
|
84
|
+
- 0
|
|
85
|
+
version: "0"
|
|
70
86
|
type: :development
|
|
87
|
+
version_requirements: *id004
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: webmock
|
|
71
90
|
prerelease: false
|
|
72
|
-
|
|
91
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
73
92
|
none: false
|
|
74
|
-
requirements:
|
|
75
|
-
- -
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
none: false
|
|
82
|
-
requirements:
|
|
83
|
-
- - ~>
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: 0.8.2.1
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
hash: 3
|
|
97
|
+
segments:
|
|
98
|
+
- 0
|
|
99
|
+
version: "0"
|
|
86
100
|
type: :development
|
|
101
|
+
version_requirements: *id005
|
|
102
|
+
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: yard
|
|
87
104
|
prerelease: false
|
|
88
|
-
|
|
105
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
89
106
|
none: false
|
|
90
|
-
requirements:
|
|
91
|
-
- -
|
|
92
|
-
- !ruby/object:Gem::Version
|
|
93
|
-
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
hash: 3
|
|
111
|
+
segments:
|
|
112
|
+
- 0
|
|
113
|
+
version: "0"
|
|
114
|
+
type: :development
|
|
115
|
+
version_requirements: *id006
|
|
94
116
|
description: Apiary.io CLI
|
|
95
|
-
email:
|
|
117
|
+
email:
|
|
96
118
|
- team@apiary.io
|
|
97
|
-
executables:
|
|
119
|
+
executables:
|
|
98
120
|
- apiary
|
|
99
121
|
extensions: []
|
|
122
|
+
|
|
100
123
|
extra_rdoc_files: []
|
|
101
|
-
|
|
124
|
+
|
|
125
|
+
files:
|
|
102
126
|
- .gitignore
|
|
103
127
|
- .rspec
|
|
104
128
|
- .travis.yml
|
|
@@ -111,8 +135,10 @@ files:
|
|
|
111
135
|
- doc/Apiary.html
|
|
112
136
|
- doc/Apiary/CLI.html
|
|
113
137
|
- doc/Apiary/Command.html
|
|
138
|
+
- doc/Apiary/Command/Fetch.html
|
|
114
139
|
- doc/Apiary/Command/Help.html
|
|
115
140
|
- doc/Apiary/Command/Preview.html
|
|
141
|
+
- doc/Apiary/Command/Publish.html
|
|
116
142
|
- doc/Apiary/Command/Runner.html
|
|
117
143
|
- doc/Apiary/Command/Version.html
|
|
118
144
|
- doc/_index.html
|
|
@@ -131,6 +157,7 @@ files:
|
|
|
131
157
|
- doc/top-level-namespace.html
|
|
132
158
|
- lib/apiary.rb
|
|
133
159
|
- lib/apiary/cli.rb
|
|
160
|
+
- lib/apiary/command/fetch.rb
|
|
134
161
|
- lib/apiary/command/help.rb
|
|
135
162
|
- lib/apiary/command/preview.rb
|
|
136
163
|
- lib/apiary/command/publish.rb
|
|
@@ -138,33 +165,42 @@ files:
|
|
|
138
165
|
- lib/apiary/command/version.rb
|
|
139
166
|
- lib/apiary/version.rb
|
|
140
167
|
- spec/cli_spec.rb
|
|
168
|
+
- spec/command/fetch_spec.rb
|
|
141
169
|
- spec/spec_helper.rb
|
|
142
170
|
homepage: http://apiary.io
|
|
143
|
-
licenses:
|
|
171
|
+
licenses:
|
|
144
172
|
- MIT
|
|
145
173
|
post_install_message:
|
|
146
174
|
rdoc_options: []
|
|
147
|
-
|
|
175
|
+
|
|
176
|
+
require_paths:
|
|
148
177
|
- lib
|
|
149
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
179
|
none: false
|
|
151
|
-
requirements:
|
|
152
|
-
- -
|
|
153
|
-
- !ruby/object:Gem::Version
|
|
154
|
-
|
|
155
|
-
|
|
180
|
+
requirements:
|
|
181
|
+
- - ">="
|
|
182
|
+
- !ruby/object:Gem::Version
|
|
183
|
+
hash: 3
|
|
184
|
+
segments:
|
|
185
|
+
- 0
|
|
186
|
+
version: "0"
|
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
188
|
none: false
|
|
157
|
-
requirements:
|
|
158
|
-
- -
|
|
159
|
-
- !ruby/object:Gem::Version
|
|
160
|
-
|
|
189
|
+
requirements:
|
|
190
|
+
- - ">="
|
|
191
|
+
- !ruby/object:Gem::Version
|
|
192
|
+
hash: 3
|
|
193
|
+
segments:
|
|
194
|
+
- 0
|
|
195
|
+
version: "0"
|
|
161
196
|
requirements: []
|
|
197
|
+
|
|
162
198
|
rubyforge_project:
|
|
163
|
-
rubygems_version: 1.8.
|
|
199
|
+
rubygems_version: 1.8.15
|
|
164
200
|
signing_key:
|
|
165
201
|
specification_version: 3
|
|
166
202
|
summary: Apiary.io CLI
|
|
167
|
-
test_files:
|
|
203
|
+
test_files:
|
|
168
204
|
- spec/cli_spec.rb
|
|
205
|
+
- spec/command/fetch_spec.rb
|
|
169
206
|
- spec/spec_helper.rb
|
|
170
|
-
has_rdoc:
|