apitools-middleware 0.0.4 → 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98fca66c7e5d7143c74e114003256d121e876bc4
4
- data.tar.gz: 4b200fbe2463c067dcb67cc6895a64efb5985c2f
3
+ metadata.gz: ee3ae57c879757cb9b3cdfb15b3948992e354898
4
+ data.tar.gz: 8fcadbd213b8ae54dab35f79634559905d2e0458
5
5
  SHA512:
6
- metadata.gz: 4ec6095cdd19ac4a64f58b802b809c50bb55eee7a2de0ebf862c49b57b78779b078cd87d565e73e262ff962f758763766fc7ecf3d098a62dc3b03f746afbe5c8
7
- data.tar.gz: 1858a0c45590a24ec7e9d2ee22ebe645a09202c5d998db493d8dfe6b75a32e8e611bb4655de79d23fbb558e91e570694b6a03882243d13bb226d75928ba8ca18
6
+ metadata.gz: cafba3753e2021015739f1ac8f4dec7d86776c85670b5aa333a04b893254fba42d93fbe9b666b0d68c2189e4d4bed20ef406ac755caf3a3362aa82f14fe1bcd2
7
+ data.tar.gz: 5b7d549c53d53e82462d4155825794377c62a35a2a86857ac7653f8c40906b653af010ae793c615557e411a667104a98f4be30b8af6a553b097986ef1cc45ea6
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.2
4
- - 2.1.1
5
- - 2.0.0
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ ruby '2.1.2'
3
4
  # Specify your gem's dependencies in apitools-middleware.gemspec
4
5
  gemspec
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Apitools::Middleware [![Build Status](https://travis-ci.org/APItools/apitools-middleware.svg?branch=master)](https://travis-ci.org/APItools/apitools-middleware)
2
2
 
3
- Ruby Library for working with APItools Middleware. Validating, testing, ...
3
+ Ruby Library for working with [APItools Middleware](https://github.com/APItools/middleware). Validating, testing, ...
4
+ Collection of middleware can be found in https://github.com/APItools/middleware
4
5
 
5
6
 
6
7
  ## Installation
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.required_ruby_version = '>= 2.1.2'
21
22
  spec.add_development_dependency "bundler", "~> 1.6"
22
23
  spec.add_development_dependency "rake"
23
24
 
@@ -6,13 +6,11 @@ require 'apitools/middleware/manifest'
6
6
  module Apitools
7
7
  module Middleware
8
8
  class Spec
9
+ SPEC_ATTRIBUTES = %I[path code endpoint description name author github_user version]
9
10
  MANIFEST_FILE = Pathname('apitools.json') # should be apitools.json
10
11
 
11
12
  attr_reader :repo
12
13
 
13
- extend Forwardable
14
- def_delegators :manifest, :name, :description, :author, :endpoints
15
-
16
14
  def initialize(repo, path)
17
15
  @repo = repo
18
16
  @path, @manifest_file = extract_path_and_manifest(path)
@@ -46,6 +44,23 @@ module Apitools
46
44
  Array(manifest.files)
47
45
  end
48
46
 
47
+ def method_missing(method, *)
48
+ hash = manifest.to_h
49
+
50
+ if hash && hash.has_key?(method)
51
+ hash.fetch(method)
52
+ end
53
+ end
54
+
55
+ def respond_to_missing?(method, *)
56
+ hash = manifest.to_h
57
+ hash && hash.has_key?(method) || super
58
+ end
59
+
60
+ def to_h
61
+ SPEC_ATTRIBUTES.map{|attr| [attr, public_send(attr)] }.to_h
62
+ end
63
+
49
64
  def version
50
65
  Semantic::Version.new(manifest.version)
51
66
  rescue ArgumentError
@@ -1,5 +1,5 @@
1
1
  module Apitools
2
2
  module Middleware
3
- VERSION = '0.0.4'
3
+ VERSION = '0.1.0.pre'
4
4
  end
5
5
  end
data/spec/spec_spec.rb CHANGED
@@ -47,6 +47,15 @@ describe Apitools::Middleware::Spec do
47
47
  end
48
48
 
49
49
  expect_it { to be_valid }
50
+
51
+
52
+ context 'converted to a hash' do
53
+ subject(:hash) { spec.to_h }
54
+
55
+ it { expect(hash).to include(name: 'middleware') }
56
+ it { expect(hash).to include(author: '3scale') }
57
+ it { expect(hash).to include(endpoint: '*') }
58
+ end
50
59
  end
51
60
 
52
61
  context 'with empty manifest' do
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apitools-middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Cichra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: semantic
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Apitools Middleware manifest, repository, specification and more.
@@ -73,9 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -108,14 +108,14 @@ require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: 2.1.2
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">"
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: 1.3.1
119
119
  requirements: []
120
120
  rubyforge_project:
121
121
  rubygems_version: 2.2.2