apiaryio 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +34 -12
  2. data/.travis.yml +1 -0
  3. data/Rakefile +8 -0
  4. data/apiary.gemspec +5 -2
  5. data/circle.yml +4 -0
  6. data/features/fetch.feature +7 -0
  7. data/features/fixtures/apiary.apib +48 -0
  8. data/features/preview.feature +7 -0
  9. data/features/publish.feature +7 -0
  10. data/features/step_definitions/file_content_step.rb +19 -0
  11. data/features/support/env.rb +7 -0
  12. data/features/support/setup.rb +1 -0
  13. data/features/version.feature +10 -0
  14. data/lib/apiary/cli.rb +37 -74
  15. data/lib/apiary/command/fetch.rb +2 -2
  16. data/lib/apiary/command/preview.rb +16 -5
  17. data/lib/apiary/command/publish.rb +3 -2
  18. data/lib/apiary/version.rb +1 -1
  19. data/spec/cli_spec.rb +1 -1
  20. data/spec/command/fetch_spec.rb +11 -9
  21. data/spec/spec_helper.rb +7 -0
  22. data/spec/support/aruba.rb +11 -0
  23. metadata +108 -52
  24. checksums.yaml +0 -7
  25. data/doc/Apiary.html +0 -131
  26. data/doc/Apiary/CLI.html +0 -528
  27. data/doc/Apiary/Command.html +0 -117
  28. data/doc/Apiary/Command/Fetch.html +0 -652
  29. data/doc/Apiary/Command/Help.html +0 -338
  30. data/doc/Apiary/Command/Preview.html +0 -1089
  31. data/doc/Apiary/Command/Publish.html +0 -658
  32. data/doc/Apiary/Command/Runner.html +0 -200
  33. data/doc/Apiary/Command/Version.html +0 -200
  34. data/doc/_index.html +0 -214
  35. data/doc/class_list.html +0 -54
  36. data/doc/css/common.css +0 -1
  37. data/doc/css/full_list.css +0 -57
  38. data/doc/css/style.css +0 -339
  39. data/doc/file.README.html +0 -169
  40. data/doc/file_list.html +0 -56
  41. data/doc/frames.html +0 -26
  42. data/doc/index.html +0 -169
  43. data/doc/js/app.js +0 -219
  44. data/doc/js/full_list.js +0 -178
  45. data/doc/js/jquery.js +0 -4
  46. data/doc/method_list.html +0 -281
  47. data/doc/top-level-namespace.html +0 -112
  48. data/lib/apiary/command/help.rb +0 -38
  49. data/lib/apiary/command/runner.rb +0 -13
  50. data/lib/apiary/command/version.rb +0 -13
data/spec/cli_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Apiary::CLI do
4
4
 
5
5
  it 'pass the test' do
6
- true.should be_true
6
+ expect(true).to be_truthy
7
7
  end
8
8
 
9
9
  end
@@ -4,16 +4,18 @@ describe Apiary::Command::Fetch do
4
4
 
5
5
  it 'pass command without params' do
6
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/)')
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
9
  end
10
10
 
11
- it 'pass command only with api_name' do
11
+ it 'pass command only with api_name', api_key: true do
12
+
12
13
  opts = {
13
14
  :api_name => 'test_api'
14
15
  }
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.')
16
+
17
+ command = Apiary::Command::Fetch.new(opts)
18
+ 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
19
  end
18
20
 
19
21
  it 'check request for fetch to apiary' do
@@ -24,13 +26,13 @@ describe Apiary::Command::Fetch do
24
26
  :api_name => API_NAME,
25
27
  :api_key => '1234567890'
26
28
  }
27
- command = Apiary::Command::Fetch.new(opts)
28
-
29
+ command = Apiary::Command::Fetch.new(opts)
30
+
29
31
  BODY_EXAMPLE = '{
30
32
  "error": false,
31
33
  "message": "",
32
34
  "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
- }'
35
+ }'
34
36
 
35
37
  BLUEPRINT_EXAMPLE = %Q{FORMAT: 1A
36
38
  HOST: http://www.testing.com
@@ -82,6 +84,6 @@ A single Note object with all its details
82
84
  }
83
85
 
84
86
  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)
87
+ expect(command.fetch_from_apiary).to eq(BLUEPRINT_EXAMPLE)
86
88
  end
87
89
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,10 @@
1
1
  require 'rspec'
2
2
  require 'webmock/rspec'
3
3
  require 'apiary'
4
+
5
+ RSpec.configure do |config|
6
+ config.filter_run_excluding :api_key => true if ENV['APIARY_API_KEY']
7
+ end
8
+
9
+ Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
10
+
@@ -0,0 +1,11 @@
1
+ require 'aruba/api'
2
+ require 'aruba/reporting'
3
+
4
+ RSpec.configure do |config|
5
+ config.include Aruba::Api
6
+
7
+ config.before(:each) do
8
+ restore_env
9
+ clean_current_dir
10
+ end
11
+ end
metadata CHANGED
@@ -1,103 +1,164 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiaryio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Apiary Ltd.
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
12
+ date: 2014-09-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rest-client
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: 1.6.7
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: 1.6.7
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rack
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 1.4.0
34
- - - "<"
38
+ - - <
35
39
  - !ruby/object:Gem::Version
36
40
  version: 1.6.0
37
41
  type: :runtime
38
42
  prerelease: false
39
43
  version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
40
45
  requirements:
41
- - - ">="
46
+ - - ! '>='
42
47
  - !ruby/object:Gem::Version
43
48
  version: 1.4.0
44
- - - "<"
49
+ - - <
45
50
  - !ruby/object:Gem::Version
46
51
  version: 1.6.0
47
52
  - !ruby/object:Gem::Dependency
48
53
  name: rake
49
54
  requirement: !ruby/object:Gem::Requirement
55
+ none: false
50
56
  requirements:
51
- - - ">="
57
+ - - ! '>='
52
58
  - !ruby/object:Gem::Version
53
59
  version: '0'
54
60
  type: :runtime
55
61
  prerelease: false
56
62
  version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
57
64
  requirements:
58
- - - ">="
65
+ - - ! '>='
59
66
  - !ruby/object:Gem::Version
60
67
  version: '0'
61
68
  - !ruby/object:Gem::Dependency
62
- name: rspec
69
+ name: thor
63
70
  requirement: !ruby/object:Gem::Requirement
71
+ none: false
64
72
  requirements:
65
- - - ">="
73
+ - - ! '>='
66
74
  - !ruby/object:Gem::Version
67
75
  version: '0'
68
- type: :development
76
+ type: :runtime
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
71
80
  requirements:
72
- - - ">="
81
+ - - ! '>='
73
82
  - !ruby/object:Gem::Version
74
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ version: 3.1.0
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 3.1.0
75
100
  - !ruby/object:Gem::Dependency
76
101
  name: webmock
77
102
  requirement: !ruby/object:Gem::Requirement
103
+ none: false
78
104
  requirements:
79
- - - ">="
105
+ - - ! '>='
80
106
  - !ruby/object:Gem::Version
81
107
  version: '0'
82
108
  type: :development
83
109
  prerelease: false
84
110
  version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
85
112
  requirements:
86
- - - ">="
113
+ - - ! '>='
87
114
  - !ruby/object:Gem::Version
88
115
  version: '0'
89
116
  - !ruby/object:Gem::Dependency
90
117
  name: yard
91
118
  requirement: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ - !ruby/object:Gem::Dependency
133
+ name: aruba
134
+ requirement: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ - !ruby/object:Gem::Dependency
149
+ name: cucumber
150
+ requirement: !ruby/object:Gem::Requirement
151
+ none: false
92
152
  requirements:
93
- - - ">="
153
+ - - ! '>='
94
154
  - !ruby/object:Gem::Version
95
155
  version: '0'
96
156
  type: :development
97
157
  prerelease: false
98
158
  version_requirements: !ruby/object:Gem::Requirement
159
+ none: false
99
160
  requirements:
100
- - - ">="
161
+ - - ! '>='
101
162
  - !ruby/object:Gem::Version
102
163
  version: '0'
103
164
  description: Apiary.io CLI
@@ -108,75 +169,70 @@ executables:
108
169
  extensions: []
109
170
  extra_rdoc_files: []
110
171
  files:
111
- - ".gitignore"
112
- - ".rspec"
113
- - ".travis.yml"
172
+ - .gitignore
173
+ - .rspec
174
+ - .travis.yml
114
175
  - Gemfile
115
176
  - LICENSE
116
177
  - README.md
117
178
  - Rakefile
118
179
  - apiary.gemspec
119
180
  - bin/apiary
120
- - doc/Apiary.html
121
- - doc/Apiary/CLI.html
122
- - doc/Apiary/Command.html
123
- - doc/Apiary/Command/Fetch.html
124
- - doc/Apiary/Command/Help.html
125
- - doc/Apiary/Command/Preview.html
126
- - doc/Apiary/Command/Publish.html
127
- - doc/Apiary/Command/Runner.html
128
- - doc/Apiary/Command/Version.html
129
- - doc/_index.html
130
- - doc/class_list.html
131
- - doc/css/common.css
132
- - doc/css/full_list.css
133
- - doc/css/style.css
134
- - doc/file.README.html
135
- - doc/file_list.html
136
- - doc/frames.html
137
- - doc/index.html
138
- - doc/js/app.js
139
- - doc/js/full_list.js
140
- - doc/js/jquery.js
141
- - doc/method_list.html
142
- - doc/top-level-namespace.html
181
+ - circle.yml
182
+ - features/fetch.feature
183
+ - features/fixtures/apiary.apib
184
+ - features/preview.feature
185
+ - features/publish.feature
186
+ - features/step_definitions/file_content_step.rb
187
+ - features/support/env.rb
188
+ - features/support/setup.rb
189
+ - features/version.feature
143
190
  - lib/apiary.rb
144
191
  - lib/apiary/cli.rb
145
192
  - lib/apiary/command/fetch.rb
146
- - lib/apiary/command/help.rb
147
193
  - lib/apiary/command/preview.rb
148
194
  - lib/apiary/command/publish.rb
149
- - lib/apiary/command/runner.rb
150
- - lib/apiary/command/version.rb
151
195
  - lib/apiary/version.rb
152
196
  - spec/cli_spec.rb
153
197
  - spec/command/fetch_spec.rb
154
198
  - spec/spec_helper.rb
199
+ - spec/support/aruba.rb
155
200
  homepage: http://apiary.io
156
201
  licenses:
157
202
  - MIT
158
- metadata: {}
159
203
  post_install_message:
160
204
  rdoc_options: []
161
205
  require_paths:
162
206
  - lib
163
207
  required_ruby_version: !ruby/object:Gem::Requirement
208
+ none: false
164
209
  requirements:
165
- - - ">="
210
+ - - ! '>='
166
211
  - !ruby/object:Gem::Version
167
212
  version: '0'
168
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
+ none: false
169
215
  requirements:
170
- - - ">="
216
+ - - ! '>='
171
217
  - !ruby/object:Gem::Version
172
218
  version: '0'
173
219
  requirements: []
174
220
  rubyforge_project:
175
- rubygems_version: 2.2.2
221
+ rubygems_version: 1.8.23
176
222
  signing_key:
177
- specification_version: 4
223
+ specification_version: 3
178
224
  summary: Apiary.io CLI
179
225
  test_files:
226
+ - features/fetch.feature
227
+ - features/fixtures/apiary.apib
228
+ - features/preview.feature
229
+ - features/publish.feature
230
+ - features/step_definitions/file_content_step.rb
231
+ - features/support/env.rb
232
+ - features/support/setup.rb
233
+ - features/version.feature
180
234
  - spec/cli_spec.rb
181
235
  - spec/command/fetch_spec.rb
182
236
  - spec/spec_helper.rb
237
+ - spec/support/aruba.rb
238
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 359e69d0d6e45ed64f46ae2d9b4e74594849e2d4
4
- data.tar.gz: 7565ee20da4cb1cd47b2eec59ce3093b32e525b0
5
- SHA512:
6
- metadata.gz: 0bbd90dd68c53870f038f80b7cd94972af29d80f80e754f8a67b91aab74172e103e28abf12178f8122d240d4704f44cdb8f3fe8060dd4307502ae15d5e98f4bb
7
- data.tar.gz: 4dea673fcf080f6966f468c0d0a090b774aefa6c7890aaf4ef7ab3c17e698cd2d96f2aa46f9b129602fc848d4b1d63c7a51c8cf8e1a5ad53083183356a6605e5
data/doc/Apiary.html DELETED
@@ -1,131 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Module: Apiary
8
-
9
- &mdash; Documentation by YARD 0.8.7.4
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '';
20
- framesUrl = "frames.html#!Apiary.html";
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="_index.html">Index (A)</a> &raquo;
35
-
36
-
37
- <span class="title">Apiary</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Module: Apiary
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
- <dt class="r1 last">Defined in:</dt>
82
- <dd class="r1 last">lib/apiary.rb<span class="defines">,<br />
83
- lib/apiary/cli.rb,<br /> lib/apiary/version.rb,<br /> lib/apiary/command/help.rb,<br /> lib/apiary/command/fetch.rb,<br /> lib/apiary/command/runner.rb,<br /> lib/apiary/command/preview.rb,<br /> lib/apiary/command/publish.rb,<br /> lib/apiary/command/version.rb</span>
84
- </dd>
85
-
86
- </dl>
87
- <div class="clear"></div>
88
-
89
- <h2>Defined Under Namespace</h2>
90
- <p class="children">
91
-
92
-
93
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Apiary/Command.html" title="Apiary::Command (module)">Command</a></span>
94
-
95
-
96
-
97
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Apiary/CLI.html" title="Apiary::CLI (class)">CLI</a></span>
98
-
99
-
100
- </p>
101
-
102
- <h2>Constant Summary</h2>
103
-
104
- <dl class="constants">
105
-
106
- <dt id="VERSION-constant" class="">VERSION =
107
-
108
- </dt>
109
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
-
111
- </dl>
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
- </div>
123
-
124
- <div id="footer">
125
- Generated on Mon May 12 13:32:43 2014 by
126
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
127
- 0.8.7.4 (ruby-2.0.0).
128
- </div>
129
-
130
- </body>
131
- </html>