interpol 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -13,6 +13,8 @@ gem 'compass_twitter_bootstrap', :git => 'git://github.com/vwall/compass-twitter
13
13
 
14
14
  gem 'json', :platform => 'ruby_18'
15
15
 
16
- gem 'cane', '~> 2.0', :platform => 'ruby_19'
16
+ gem 'cane', '~> 2.6', :platform => 'ruby_19'
17
+
18
+ # 1.6 won't install on JRuby or 1.8.7 :(.
19
+ gem 'nokogiri', '~> 1.5.10'
17
20
 
18
- gem 'rspec-fire', :git => 'git://github.com/xaviershay/rspec-fire.git'
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  ![Interpol Logo](https://github.com/seomoz/interpol/blob/assets/interpol-logo.png?raw=true)
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/seomoz/interpol.png)](http://travis-ci.org/seomoz/interpol)
5
+ [![Code Climate](https://codeclimate.com/github/seomoz/interpol.png)](https://codeclimate.com/github/seomoz/interpol)
5
6
 
6
7
  Interpol is a toolkit for policing your HTTP JSON interface. To use it,
7
8
  define the endpoints of your HTTP API in simple YAML files.
@@ -156,7 +157,7 @@ Interpol.default_configuration do |config|
156
157
  # Needed by Interpol::StubApp and Interpol::ResponseSchemaValidator.
157
158
  config.response_version '1.0'
158
159
 
159
- # Determines which versioned response endpoint definition Interpol uses
160
+ # Determines which versioned request endpoint definition Interpol uses
160
161
  # for a request. You can also use a block form, which yields
161
162
  # the rack env hash and the endpoint object as arguments.
162
163
  # This is useful when you need to extract the version from a
@@ -1,6 +1,8 @@
1
1
  require "interpol/configuration"
2
2
  require "interpol/version"
3
3
 
4
+ # The Interpol namespace. Provides only the default configuration.
5
+ # Each of the tools is self-contained and should be required independently.
4
6
  module Interpol
5
7
  extend self
6
8
 
@@ -5,6 +5,8 @@ require 'yaml'
5
5
  require 'uri'
6
6
 
7
7
  module Interpol
8
+ # Meant to be extended onto an array, to provide custom
9
+ # finder methods for interpol endpoint definitions.
8
10
  module DefinitionFinder
9
11
  include HashFetcher
10
12
  NoDefinitionFound = Class.new
@@ -1,6 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
3
  module Interpol
4
+ # Renders HTML documentation for an interpol endpoint.
4
5
  module Documentation
5
6
  extend self
6
7
 
@@ -4,6 +4,7 @@ require 'sinatra/base'
4
4
  require 'nokogiri'
5
5
 
6
6
  module Interpol
7
+ # Provides the interpol documentation app.
7
8
  module DocumentationApp
8
9
  extend self
9
10
 
@@ -61,6 +62,7 @@ module Interpol
61
62
 
62
63
  private
63
64
 
65
+ # Helper methods for the documentation app.
64
66
  module Helpers
65
67
  def interpol_config
66
68
  self.class.interpol_config
@@ -1,6 +1,7 @@
1
- require 'json-schema'
2
- require 'interpol/errors'
3
1
  require 'forwardable'
2
+ require 'interpol/errors'
3
+ require 'json'
4
+ require 'json-schema'
4
5
  require 'set'
5
6
 
6
7
  module JSON
@@ -51,6 +52,8 @@ module JSON
51
52
  end
52
53
 
53
54
  module Interpol
55
+ # Provides a helper method for fetching an item from a hash.
56
+ # Deals with differences on different ruby interpretters.
54
57
  module HashFetcher
55
58
  # Unfortunately, on JRuby 1.9, the error raised from Hash#fetch when
56
59
  # the key is not found does not include the key itself :(. So we work
@@ -145,7 +148,7 @@ module Interpol
145
148
  end
146
149
  end.join('\/')
147
150
 
148
- /\A#{regex_string}\z/
151
+ /\A#{regex_string}\/?\z/
149
152
  end
150
153
  end
151
154
 
@@ -214,7 +217,7 @@ module Interpol
214
217
 
215
218
  def validate_data!(data)
216
219
  errors = ::JSON::Validator.fully_validate_schema(schema)
217
- raise ValidationError.new(errors, nil, description) if errors.any?
220
+ raise ValidationError.new(errors, schema, description) if errors.any?
218
221
  errors = ::JSON::Validator.fully_validate(schema, data)
219
222
  raise ValidationError.new(errors, data, description) if errors.any?
220
223
  end
@@ -122,6 +122,7 @@ module Interpol
122
122
  end
123
123
  end
124
124
 
125
+ # Contains methods that override sinatra methods.
125
126
  module SinatraOverriddes
126
127
  extend Forwardable
127
128
  def_delegators :settings, :request_params_parser
@@ -3,6 +3,7 @@ require 'sinatra/base'
3
3
  require 'json'
4
4
 
5
5
  module Interpol
6
+ # Public: Builds an interpol stub app.
6
7
  module StubApp
7
8
  extend self
8
9
 
@@ -4,6 +4,7 @@ require 'interpol/request_params_parser'
4
4
 
5
5
  module Interpol
6
6
  module TestHelper
7
+ # Defines methods that are used by both the RSpec and Test::Unit mixins.
7
8
  module Common
8
9
  def define_interpol_example_tests(&block)
9
10
  config = Configuration.default.customized_duplicate(&block)
@@ -57,6 +58,7 @@ module Interpol
57
58
  end
58
59
  end
59
60
 
61
+ # An RSpec mixin for defining interpol example tests.
60
62
  module RSpec
61
63
  include Common
62
64
 
@@ -65,6 +67,7 @@ module Interpol
65
67
  end
66
68
  end
67
69
 
70
+ # A Test::Unit mixin for defining interpol example tests.
68
71
  module TestUnit
69
72
  include Common
70
73
 
@@ -1,4 +1,4 @@
1
1
  module Interpol
2
- VERSION = "0.10.1"
2
+ VERSION = "0.10.2"
3
3
  end
4
4
 
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.10.1
4
+ version: 0.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-29 00:00:00.000000000 Z
12
+ date: 2013-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -43,22 +43,6 @@ dependencies:
43
43
  - !ruby/object:Gem::Version
44
44
  version: 1.1.1
45
45
  none: false
46
- - !ruby/object:Gem::Dependency
47
- name: nokogiri
48
- prerelease: false
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '1.5'
54
- none: false
55
- type: :runtime
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ~>
59
- - !ruby/object:Gem::Version
60
- version: '1.5'
61
- none: false
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: rspec
64
48
  prerelease: false
@@ -82,14 +66,14 @@ dependencies:
82
66
  requirements:
83
67
  - - ~>
84
68
  - !ruby/object:Gem::Version
85
- version: '0.4'
69
+ version: '1.2'
86
70
  none: false
87
71
  type: :development
88
72
  version_requirements: !ruby/object:Gem::Requirement
89
73
  requirements:
90
74
  - - ~>
91
75
  - !ruby/object:Gem::Version
92
- version: '0.4'
76
+ version: '1.2'
93
77
  none: false
94
78
  - !ruby/object:Gem::Dependency
95
79
  name: simplecov