biceps 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,11 +18,15 @@ module Biceps
18
18
  end
19
19
 
20
20
  def request_version
21
- is_api_call?[1].to_i if is_api_call?
21
+ if Biceps.force_test_version?
22
+ Biceps.force_test_version
23
+ else
24
+ is_api_call?[1].to_i if is_api_call?
25
+ end
22
26
  end
23
27
 
24
28
  def is_api_call?
25
- @is_api_call = accept.match(regex)
29
+ @is_api_call = accept ? accept.match(regex) : false
26
30
  end
27
31
 
28
32
  def regex
@@ -6,16 +6,22 @@ require 'action_controller'
6
6
  module ActionDispatch::Routing
7
7
  class Mapper
8
8
 
9
- def api_version(version, opts={})
10
- if opts[:module] && opts[:module].empty?
11
- scope_module = nil
12
- else
13
- scope_module = opts[:module] || "v#{version}"
14
- end
9
+ def api_version(versions, opts={})
10
+ Array(versions).each do |version|
11
+ if opts[:module] && opts[:module].empty?
12
+ scope_module = nil
13
+ elsif opts[:module]
14
+ scope_module = opts[:module]
15
+ elsif !version.nil?
16
+ scope_module = "v#{version}"
17
+ else
18
+ scope_module = nil
19
+ end
15
20
 
16
- scope :module => scope_module do
17
- constraints Biceps::ApiVersion.new(version) do
18
- yield if block_given?
21
+ scope :module => scope_module do
22
+ constraints Biceps::ApiVersion.new(version) do
23
+ yield if block_given?
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -1,3 +1,3 @@
1
1
  module Biceps
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biceps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-10 00:00:00.000000000Z
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70320728877400 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70320728877400
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: minitest
27
- requirement: &70320728876760 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70320728876760
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &70320728876140 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 0.8.7
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70320728876140
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.7
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rails
49
- requirement: &70320728875580 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,7 +69,12 @@ dependencies:
54
69
  version: 3.0.0
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70320728875580
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 3.0.0
58
78
  description: Create a versioned API with rails
59
79
  email: dev@evome.fr
60
80
  executables: []
@@ -66,7 +86,7 @@ files:
66
86
  - lib/biceps/core_ext/action_dispatch/routing/mapper.rb
67
87
  - lib/biceps/test_helper.rb
68
88
  - lib/biceps/version.rb
69
- homepage: https://github.com/evome/biceps
89
+ homepage: https://github.com/lyonrb/biceps
70
90
  licenses: []
71
91
  post_install_message:
72
92
  rdoc_options: []
@@ -86,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
106
  version: '0'
87
107
  requirements: []
88
108
  rubyforge_project:
89
- rubygems_version: 1.8.10
109
+ rubygems_version: 1.8.24
90
110
  signing_key:
91
111
  specification_version: 3
92
112
  summary: Leverage your api