sinatra-param 0.1.3 → 1.0.0

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: e7dbe726f102751c1097223f977fff0dd518657c
4
- data.tar.gz: 062b3d2a5e030e9de921d61c6fae5e1a5fddf25a
3
+ metadata.gz: 18a23f0baef3417d12254ac4083df075ffe7b05c
4
+ data.tar.gz: 854af92a66e992f5c1b86dc14600f4715b6dc338
5
5
  SHA512:
6
- metadata.gz: 85d3cfa4e8d88b2dca9815b27dd10dd501e3f76917eb96e6af9de67135c1e335b055df516db8a1d835b433f87022319d4f537cfd6dad0515a2237c1f57170d95
7
- data.tar.gz: 5bb3ea903211d62372ee263c0debe410c282046af58b533ecf7e333b3cbc41aa988fa95ce3bd83f5ec93ac0bf454e899422c4684e4c1608bd230482b285901dc
6
+ metadata.gz: 25576e0184a0adabe22e38f05c7b2a717506b1692e8c90e604f8af2a09214a1609bdf1b12cae630843a72f02d0660f75022cc7449763cd4dc972d011f9b8f536
7
+ data.tar.gz: abbcb391d35a4cde22b8d5a1acc97bd8a312d494edeb27b399618e7b997f5edfa5ef0f264b332a75ac767b4dbb62d969682f6bd8d545a077960c1a231952f223
data/Gemfile CHANGED
@@ -1,13 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'sinatra', '~> 1.3'
4
-
5
- group :test do
6
- gem "rspec", "~> 2.10"
7
- gem "rack-test"
8
- gem "rake"
9
- end
10
-
11
3
  gemspec
12
-
13
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-param (0.1.3)
4
+ sinatra-param (1.0.0)
5
5
  sinatra (~> 1.3)
6
6
 
7
7
  GEM
@@ -12,34 +12,30 @@ GEM
12
12
  rack (1.5.2)
13
13
  rack-protection (1.5.0)
14
14
  rack
15
- rack-test (0.6.2)
16
- rack (>= 1.0)
17
- rake (10.0.4)
18
- rspec (2.13.0)
19
- rspec-core (~> 2.13.0)
20
- rspec-expectations (~> 2.13.0)
21
- rspec-mocks (~> 2.13.0)
22
- rspec-core (2.13.1)
23
- rspec-expectations (2.13.0)
15
+ rake (10.1.0)
16
+ rspec (2.14.1)
17
+ rspec-core (~> 2.14.0)
18
+ rspec-expectations (~> 2.14.0)
19
+ rspec-mocks (~> 2.14.0)
20
+ rspec-core (2.14.5)
21
+ rspec-expectations (2.14.3)
24
22
  diff-lcs (>= 1.1.3, < 2.0)
25
- rspec-mocks (2.13.1)
23
+ rspec-mocks (2.14.3)
26
24
  simplecov (0.7.1)
27
25
  multi_json (~> 1.0)
28
26
  simplecov-html (~> 0.7.1)
29
27
  simplecov-html (0.7.1)
30
- sinatra (1.4.2)
31
- rack (~> 1.5, >= 1.5.2)
28
+ sinatra (1.4.3)
29
+ rack (~> 1.4)
32
30
  rack-protection (~> 1.4)
33
31
  tilt (~> 1.3, >= 1.3.4)
34
- tilt (1.3.7)
32
+ tilt (1.4.1)
35
33
 
36
34
  PLATFORMS
37
35
  ruby
38
36
 
39
37
  DEPENDENCIES
40
- rack-test
41
38
  rake
42
- rspec (~> 2.10)
39
+ rspec
43
40
  simplecov
44
- sinatra (~> 1.3)
45
41
  sinatra-param!
data/README.md CHANGED
@@ -1,16 +1,23 @@
1
1
  # sinatra-param
2
2
  _Parameter Contracts for Sinatra_
3
3
 
4
- REST conventions takes the guesswork out of designing and consuming web APIs. `GET` / `POST` / `PATCH` / `DELETE` resource endpoints and you get what you'd expect.
4
+ REST conventions take the guesswork out of designing and consuming web APIs. Simply `GET`, `POST`, `PATCH`, or `DELETE` resource endpoints, and you get what you'd expect.
5
5
 
6
- But figuring out what parameters are expected... well, all bets are off. This Sinatra extension takes a first step to solving this problem on the developer side
6
+ However, when it comes to figuring out what parameters are expected... well, all bets are off.
7
+
8
+ This Sinatra extension takes a first step to solving this problem on the developer side
7
9
 
8
10
  **`sinatra-param` allows you to declare, validate, and transform endpoint parameters as you would in frameworks like [ActiveModel](http://rubydoc.info/gems/activemodel/3.2.3/frames) or [DataMapper](http://datamapper.org/).**
9
11
 
12
+ > Use `sinatra-param` in combination with [`Rack::PostBodyContentTypeParser` and `Rack::NestedParams`](https://github.com/rack/rack-contrib) to automatically parameterize JSON `POST` bodies and nested parameters.
13
+
10
14
  ## Example
11
15
 
12
16
  ``` ruby
17
+ require 'sinatra/base'
13
18
  require 'sinatra/param'
19
+ require 'json'
20
+
14
21
  class App < Sinatra::Base
15
22
  helpers Sinatra::Param
16
23
 
@@ -59,12 +66,6 @@ Passing a `default` option will provide a default value for a parameter if none
59
66
 
60
67
  Use the `transform` option to take even more of the business logic of parameter I/O out of your code. Anything that responds to `to_proc` (including Procs and symbols) will do.
61
68
 
62
- ## Next Steps
63
-
64
- - [Design by contract](http://en.wikipedia.org/wiki/Design_by_contract) like this is great for developers, and with a little meta-programming, it could probably be exposed to users as well. The self-documenting dream of [Hypermedia folks](http://twitter.com/#!/steveklabnik) could well be within reach.
65
-
66
- - Support for Rails-style Arrays (`'key[]=value1&key[]=value2'`) and Hashes (`'key[a]=value1&key[b]=value2`). /via [@manton](https://twitter.com/#!/manton)
67
-
68
69
  ## Contact
69
70
 
70
71
  Mattt Thompson
data/example/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
- source :rubygems
1
+ ruby '2.0.0'
2
+ source "https://rubygems.org"
2
3
 
3
- gem 'sinatra'
4
- gem 'thin'
4
+ gem 'sinatra', require: 'sinatra/base'
5
+ gem 'sinatra-param', path: File.join(__FILE__, "../.."), require: 'sinatra/param'
6
+ gem 'json'
7
+ gem 'unicorn'
data/example/Gemfile.lock CHANGED
@@ -1,24 +1,33 @@
1
+ PATH
2
+ remote: /Users/mattt/Code/Ruby/sinatra-param
3
+ specs:
4
+ sinatra-param (0.1.3)
5
+ sinatra (~> 1.3)
6
+
1
7
  GEM
2
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
3
9
  specs:
4
- daemons (1.1.8)
5
- eventmachine (0.12.10)
6
- rack (1.4.1)
7
- rack-protection (1.2.0)
10
+ json (1.8.1)
11
+ kgio (2.8.1)
12
+ rack (1.5.2)
13
+ rack-protection (1.5.0)
14
+ rack
15
+ raindrops (0.12.0)
16
+ sinatra (1.4.3)
17
+ rack (~> 1.4)
18
+ rack-protection (~> 1.4)
19
+ tilt (~> 1.3, >= 1.3.4)
20
+ tilt (1.4.1)
21
+ unicorn (4.6.3)
22
+ kgio (~> 2.6)
8
23
  rack
9
- sinatra (1.3.2)
10
- rack (~> 1.3, >= 1.3.6)
11
- rack-protection (~> 1.2)
12
- tilt (~> 1.3, >= 1.3.3)
13
- thin (1.3.1)
14
- daemons (>= 1.0.9)
15
- eventmachine (>= 0.12.6)
16
- rack (>= 1.0.0)
17
- tilt (1.3.3)
24
+ raindrops (~> 0.7)
18
25
 
19
26
  PLATFORMS
20
27
  ruby
21
28
 
22
29
  DEPENDENCIES
30
+ json
23
31
  sinatra
24
- thin
32
+ sinatra-param!
33
+ unicorn
data/example/Procfile CHANGED
@@ -1 +1 @@
1
- web: bundle exec thin start -p $PORT
1
+ web: bundle exec unicorn -p $PORT
data/example/app.rb CHANGED
@@ -1,8 +1,3 @@
1
- require 'sinatra/base'
2
- require 'json'
3
-
4
- require_relative '../lib/sinatra/param'
5
-
6
1
  class App < Sinatra::Base
7
2
  helpers Sinatra::Param
8
3
 
@@ -55,4 +50,3 @@ class App < Sinatra::Base
55
50
  }.to_json
56
51
  end
57
52
  end
58
-
data/example/config.ru CHANGED
@@ -1,3 +1,6 @@
1
+ require 'bundler'
2
+ Bundler.require
3
+
1
4
  require './app'
2
5
 
3
6
  run App
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Param
3
- VERSION = '0.1.3'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -5,15 +5,17 @@ Gem::Specification.new do |s|
5
5
  s.name = "sinatra-param"
6
6
  s.authors = ["Mattt Thompson"]
7
7
  s.email = "m@mattt.me"
8
- s.homepage = "http://github.com/mattt/sinatra-param"
8
+ s.homepage = "https://github.com/mattt/sinatra-param"
9
9
  s.version = Sinatra::Param::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.summary = "sinatra-param"
12
- s.description = "Parameter Contracts for Sinatra"
11
+ s.summary = "Parameter Contracts for Sinatra"
12
+ s.description = "sinatra-param allows you to declare, validate, and transform endpoint parameters as you would in frameworks like ActiveModel or DataMapper."
13
13
 
14
14
  s.add_dependency "sinatra", "~> 1.3"
15
15
 
16
- s.add_development_dependency 'simplecov'
16
+ s.add_development_dependency "rake"
17
+ s.add_development_dependency "rspec"
18
+ s.add_development_dependency "simplecov"
17
19
 
18
20
  s.files = Dir["./**/*"].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
19
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/spec/dummy/app.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'sinatra/base'
2
+ require 'sinatra/param'
2
3
  require 'json'
3
4
  require 'time'
4
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-param
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-26 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -24,21 +24,50 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: simplecov
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ! '>='
59
+ - - '>='
32
60
  - !ruby/object:Gem::Version
33
61
  version: '0'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ! '>='
66
+ - - '>='
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
- description: Parameter Contracts for Sinatra
69
+ description: sinatra-param allows you to declare, validate, and transform endpoint
70
+ parameters as you would in frameworks like ActiveModel or DataMapper.
42
71
  email: m@mattt.me
43
72
  executables: []
44
73
  extensions: []
@@ -104,7 +133,7 @@ files:
104
133
  - spec/parameter_type_coercion_spec.rb
105
134
  - spec/parameter_validations_spec.rb
106
135
  - spec/spec_helper.rb
107
- homepage: http://github.com/mattt/sinatra-param
136
+ homepage: https://github.com/mattt/sinatra-param
108
137
  licenses: []
109
138
  metadata: {}
110
139
  post_install_message:
@@ -113,12 +142,12 @@ require_paths:
113
142
  - lib
114
143
  required_ruby_version: !ruby/object:Gem::Requirement
115
144
  requirements:
116
- - - ! '>='
145
+ - - '>='
117
146
  - !ruby/object:Gem::Version
118
147
  version: '0'
119
148
  required_rubygems_version: !ruby/object:Gem::Requirement
120
149
  requirements:
121
- - - ! '>='
150
+ - - '>='
122
151
  - !ruby/object:Gem::Version
123
152
  version: '0'
124
153
  requirements: []
@@ -126,7 +155,7 @@ rubyforge_project:
126
155
  rubygems_version: 2.0.3
127
156
  signing_key:
128
157
  specification_version: 4
129
- summary: sinatra-param
158
+ summary: Parameter Contracts for Sinatra
130
159
  test_files:
131
160
  - spec/dummy/app.rb
132
161
  - spec/parameter_sets_spec.rb