raml-rb 0.0.6 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b89803dbf18a158ddc7f781c03b1b5b8b266f89
4
- data.tar.gz: 3f97e128ffddc9f7f6db4cad8b741115619876ea
3
+ metadata.gz: df2e4d4523124e124d26a17682ad25e97bafeb1f
4
+ data.tar.gz: 57fecb9fa9a2195963b4918381da41699cb4ccaf
5
5
  SHA512:
6
- metadata.gz: 1f55464b58630ad4e0e50bbfcdf7ed2b4cce179eb29b8a7a87d7b373dc174dac0398227ef16b48027b31bfa78852f65d20bd88816688fa8e2ad7476ff55371b7
7
- data.tar.gz: 1c796472b8a9cbe85c1442d6662e36d9ed4809c38c3619e80637577865cbcd5244ae5c75f3fe3c02fef49621f49341ee13870c2045ad41f7fb8b0905b3bbf443
6
+ metadata.gz: b2138442d6609232fa226ec002f5143a404ab3c023252eeec71dbc6e58e9695f2bd848577a90362b42e3dbeebbb92b7c578e6d5c694812f00a4ef67edee2bc2b
7
+ data.tar.gz: 958813a38ecd31dad8d8c6dd588dfa1af9b907d9504346d693769d953cbe6edcf8b02fefa98759b4d2a9ec10efaa8760ddfafee223ff7dbea57d89690c030d78
@@ -11,7 +11,7 @@ module Raml
11
11
  extend Forwardable
12
12
  include Raml::Parser::Util
13
13
 
14
- METHODS = %w[get put post delete]
14
+ HTTP_METHODS = %w[get put post delete]
15
15
 
16
16
  attr_accessor :parent_node, :resource, :trait_names, :attributes
17
17
  def_delegators :@parent, :traits, :resource_types
@@ -37,8 +37,8 @@ module Raml
37
37
  case key
38
38
  when /^\//
39
39
  resource.resources << Raml::Parser::Resource.new(self).parse(resource, key, value)
40
- when *METHODS
41
- resource.methods << Raml::Parser::Method.new(self).parse(key, value)
40
+ when *HTTP_METHODS
41
+ resource.http_methods << Raml::Parser::Method.new(self).parse(key, value)
42
42
  when 'is'
43
43
  @trait_names = value
44
44
  else
@@ -9,7 +9,7 @@ module Raml
9
9
  class Root
10
10
  include Raml::Parser::Util
11
11
 
12
- BASIC_ATTRIBUTES = %w[title base_uri version base_uri_parameters media_type]
12
+ BASIC_ATTRIBUTES = %w[title base_uri version base_uri_parameters media_type secured_by security_schemes]
13
13
 
14
14
  attr_accessor :root, :traits, :resource_types, :attributes
15
15
 
data/lib/raml/resource.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  module Raml
2
2
  class Resource
3
- attr_accessor :parent, :methods, :uri_partial, :resources
3
+ attr_accessor :parent, :http_methods, :uri_partial, :resources
4
4
 
5
5
  def initialize(parent, uri_partial)
6
- @parent = parent
7
- @uri_partial = uri_partial
8
- @methods = []
9
- @resources = []
6
+ @parent = parent
7
+ @uri_partial = uri_partial
8
+ @http_methods = []
9
+ @resources = []
10
10
  end
11
11
 
12
12
  def path
data/lib/raml/root.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Raml
2
2
  class Root
3
3
  attr_accessor :title, :base_uri, :version, :resources, :documentation,
4
- :base_uri_parameters, :media_type
4
+ :base_uri_parameters, :media_type, :security_schemes, :secured_by
5
5
 
6
6
  def initialize
7
7
  @resources = []
data/lib/raml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Raml
2
- VERSION = '0.0.6'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -12,6 +12,16 @@ documentation:
12
12
  - title: RAML Baml
13
13
  content: |
14
14
  - Project: [source code](https://github.com/jpb/raml-rb)
15
+ securedBy: [ authenticationHeader ]
16
+ securitySchemes:
17
+ - authenticationHeader:
18
+ describedBy:
19
+ headers:
20
+ Authorization:
21
+ type: string
22
+ responses:
23
+ 401:
24
+ description: Authentication required
15
25
  traits:
16
26
  - paged:
17
27
  queryParameters:
@@ -8,6 +8,16 @@ baseUriParameters:
8
8
  type: String
9
9
  version: v1
10
10
  mediaType: application/json
11
+ securedBy: [ authenticationHeader ]
12
+ securitySchemes:
13
+ - authenticationHeader:
14
+ describedBy:
15
+ headers:
16
+ Authorization:
17
+ type: string
18
+ responses:
19
+ 401:
20
+ description: Authentication required
11
21
  traits:
12
22
  - paged:
13
23
  queryParameters:
@@ -15,24 +15,25 @@ describe Raml::Parser::Root do
15
15
  should == {"environment" => { "description"=>"The deployed environment", "type"=>"String" }}
16
16
  end
17
17
  its(:media_type) { should == "application/json" }
18
+ its(:secured_by) { should == [ "authenticationHeader" ] }
18
19
  its('resources.count') { should == 1 }
19
- its('resources.first.methods.count') { should == 2 }
20
- its('resources.first.methods.first.responses.count') { should == 0 }
21
- its('resources.first.methods.first.query_parameters.count') { should == 2 }
20
+ its('resources.first.http_methods.count') { should == 2 }
21
+ its('resources.first.http_methods.first.responses.count') { should == 0 }
22
+ its('resources.first.http_methods.first.query_parameters.count') { should == 2 }
22
23
  its('documentation.count') { should == 0 }
23
- its('resources.first.resources.first.methods.first.responses.first.bodies.first.example') do
24
+ its('resources.first.resources.first.http_methods.first.responses.first.bodies.first.example') do
24
25
  should include '{"artist":"Pink Floyd", "title":"Wish You Were Here"}'
25
26
  end
26
27
 
27
28
  context 'trait-inherited attributes' do
28
- subject { Raml::Parser::Root.new.parse(raml).resources.first.methods.first.query_parameters.first }
29
+ subject { Raml::Parser::Root.new.parse(raml).resources.first.http_methods.first.query_parameters.first }
29
30
  its(:name) { should == 'pages' }
30
31
  its(:description) { should == 'The number of pages to return' }
31
32
  its(:type) { should == 'number' }
32
33
  end
33
34
 
34
35
  context 'non trait-inherited attributes' do
35
- subject { Raml::Parser::Root.new.parse(raml).resources.first.methods.first.query_parameters.last }
36
+ subject { Raml::Parser::Root.new.parse(raml).resources.first.http_methods.first.query_parameters.last }
36
37
  its(:name) { should == 'genre' }
37
38
  its(:description) { should == 'filter the songs by genre' }
38
39
  its(:type) { should == nil }
@@ -7,7 +7,7 @@ describe Raml::Resource do
7
7
  subject { Raml::Resource.new(parent, '/cats') }
8
8
  its(:parent) { should == parent }
9
9
  its(:uri_partial) { should == '/cats' }
10
- its(:methods) { should == [] }
10
+ its(:http_methods) { should == [] }
11
11
  end
12
12
 
13
13
  describe '#uri' do
@@ -40,6 +40,20 @@ describe Raml::Root do
40
40
  it { is_expected.to eq('') }
41
41
  end
42
42
 
43
+ describe '#security_schemes' do
44
+ let(:root) { Raml::Root.new }
45
+ before { root.security_schemes = 'foo' }
46
+ subject { root.security_schemes }
47
+ it { is_expected.to eq('foo') }
48
+ end
49
+
50
+ describe '#secured_by' do
51
+ let(:root) { Raml::Root.new }
52
+ before { root.secured_by = [ 'oauth_2_0' ] }
53
+ subject { root.secured_by }
54
+ it { is_expected.to eq([ 'oauth_2_0' ]) }
55
+ end
56
+
43
57
  describe '#media_type' do
44
58
  let(:root) { Raml::Root.new }
45
59
  before { root.media_type = 'application/json' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raml-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Brennan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-22 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler