biceps 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 014ee27f726440d37df4407f5f4bca8ecc5e17d4
4
+ data.tar.gz: 787ba7af739bba8bdd80200eb215b2348301fc60
5
+ SHA512:
6
+ metadata.gz: 5f1d6cf897a174142aea56df62a8f1cff585c85a4a2992f714200c3e48a669faaa3ebe11062ae0817457e70d07f818ee95692115c6aec4b571fe464d961ebb3f
7
+ data.tar.gz: 4d5b3cfd75a03c113f6fe964ddce1c5caa55f69458be066c334bc7b8ec17d4c3bb5458b27bc89091e8bcc9f8d1d27e97f04bfdaac8cfd0253fe7b9f923b70d7b
@@ -4,6 +4,7 @@ module Biceps
4
4
 
5
5
  def initialize(version)
6
6
  @version = [version].flatten
7
+ @version_matcher = {}
7
8
  end
8
9
 
9
10
  def matches?(request)
@@ -11,7 +12,6 @@ module Biceps
11
12
  valid_api_version?
12
13
  end
13
14
 
14
-
15
15
  private
16
16
  def valid_api_version?
17
17
  version.include?(request_version)
@@ -21,12 +21,20 @@ module Biceps
21
21
  if Biceps.force_test_version?
22
22
  Biceps.force_test_version
23
23
  else
24
- is_api_call?[1].to_i if is_api_call?
24
+ api_version if is_api_call?
25
25
  end
26
26
  end
27
27
 
28
+ def api_version
29
+ version_matcher[1].to_i
30
+ end
31
+
28
32
  def is_api_call?
29
- @is_api_call = accept ? accept.match(regex) : false
33
+ accept && version_matcher.present?
34
+ end
35
+
36
+ def version_matcher
37
+ @version_matcher[accept] ||= accept.match(regex) if accept
30
38
  end
31
39
 
32
40
  def regex
@@ -1,3 +1,3 @@
1
1
  module Biceps
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,82 +1,88 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biceps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
- - Evome
7
+ - Damien MATHIEU
8
+ - Franck VERROT
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2014-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '0'
22
21
  type: :development
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
27
  version: '0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: minitest
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
35
  type: :development
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: rake
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ! '>='
46
+ - - ">="
52
47
  - !ruby/object:Gem::Version
53
48
  version: 0.8.7
54
49
  type: :runtime
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ! '>='
53
+ - - ">="
60
54
  - !ruby/object:Gem::Version
61
55
  version: 0.8.7
62
56
  - !ruby/object:Gem::Dependency
63
- name: rails
57
+ name: actionpack
64
58
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
59
  requirements:
67
- - - ! '>='
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
62
  version: 3.0.0
70
63
  type: :runtime
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
- - - ! '>='
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: railties
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
76
82
  - !ruby/object:Gem::Version
77
83
  version: 3.0.0
78
84
  description: Create a versioned API with rails
79
- email: dev@evome.fr
85
+ email: 42@dmathieu.com
80
86
  executables: []
81
87
  extensions: []
82
88
  extra_rdoc_files: []
@@ -88,26 +94,25 @@ files:
88
94
  - lib/biceps/version.rb
89
95
  homepage: https://github.com/lyonrb/biceps
90
96
  licenses: []
97
+ metadata: {}
91
98
  post_install_message:
92
99
  rdoc_options: []
93
100
  require_paths:
94
101
  - lib
95
102
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
103
  requirements:
98
- - - ! '>='
104
+ - - ">="
99
105
  - !ruby/object:Gem::Version
100
106
  version: '0'
101
107
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
108
  requirements:
104
- - - ! '>='
109
+ - - ">="
105
110
  - !ruby/object:Gem::Version
106
111
  version: '0'
107
112
  requirements: []
108
113
  rubyforge_project:
109
- rubygems_version: 1.8.24
114
+ rubygems_version: 2.2.1
110
115
  signing_key:
111
- specification_version: 3
116
+ specification_version: 4
112
117
  summary: Leverage your api
113
118
  test_files: []