interpol 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,7 @@ module Interpol
34
34
  end
35
35
 
36
36
  validate_if do |env, status, headers, body|
37
+ headers['Content-Type'].to_s.include?('json') &&
37
38
  (200..299).cover?(status) && status != 204 # No Content
38
39
  end
39
40
 
@@ -26,12 +26,15 @@ module Interpol
26
26
  @definitions = extract_definitions_from(endpoint_hash)
27
27
  end
28
28
 
29
- def find_example_for!(version)
30
- d = @definitions.fetch(version) do
29
+ def find_definition!(version)
30
+ @definitions.fetch(version) do
31
31
  message = "No definition found for #{name} endpoint for version #{version}"
32
32
  raise ArgumentError.new(message)
33
33
  end
34
- d.examples.first
34
+ end
35
+
36
+ def find_example_for!(version)
37
+ find_definition!(version).examples.first
35
38
  end
36
39
 
37
40
  def available_versions
@@ -1,3 +1,3 @@
1
1
  module Interpol
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interpol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-04-04 00:00:00.000000000 Z
12
+ date: 2012-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &2152119280 !ruby/object:Gem::Requirement
16
+ requirement: &2155991900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 2.0.0
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2152119280
27
+ version_requirements: *2155991900
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json-schema
30
- requirement: &2152116920 !ruby/object:Gem::Requirement
30
+ requirement: &2155989620 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 1.0.5
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *2152116920
38
+ version_requirements: *2155989620
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rspec
41
- requirement: &2152114860 !ruby/object:Gem::Requirement
41
+ requirement: &2155987560 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '2.9'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *2152114860
49
+ version_requirements: *2155987560
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec-fire
52
- requirement: &2152112940 !ruby/object:Gem::Requirement
52
+ requirement: &2155985640 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ~>
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0.4'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *2152112940
60
+ version_requirements: *2155985640
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: simplecov
63
- requirement: &2152112120 !ruby/object:Gem::Requirement
63
+ requirement: &2155984820 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ~>
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0.6'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *2152112120
71
+ version_requirements: *2155984820
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: cane
74
- requirement: &2152111100 !ruby/object:Gem::Requirement
74
+ requirement: &2155983800 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ~>
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '1.2'
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *2152111100
82
+ version_requirements: *2155983800
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
- requirement: &2151941140 !ruby/object:Gem::Requirement
85
+ requirement: &2151940960 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ~>
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: 0.9.2.2
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *2151941140
93
+ version_requirements: *2151940960
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rack-test
96
- requirement: &2151939360 !ruby/object:Gem::Requirement
96
+ requirement: &2151939280 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - =
@@ -101,7 +101,7 @@ dependencies:
101
101
  version: 0.6.1
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *2151939360
104
+ version_requirements: *2151939280
105
105
  description: Interpol is a toolkit for working with API endpoint definition files,
106
106
  giving you a stub app, a schema validation middleware, and browsable documentation.
107
107
  email: