pragma-contract 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +28 -0
- data/README.md +3 -4
- data/lib/pragma/contract/base.rb +1 -1
- data/lib/pragma/contract/coercion.rb +7 -14
- data/lib/pragma/contract/version.rb +1 -1
- data/pragma-contract.gemspec +4 -4
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 65bb088e2e5f2bea1013369379af3335d4c02b381775d376701c0453b8e8f17c
|
4
|
+
data.tar.gz: e2bca105d4a8cc7c3980c8f927bea2468b33a5d342ace9574f5e41afb0a8fc04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a7cf260d36af1a576d4fa6f16c913b0a643dc4ec67a735a5760213efde02ccd94223b35a43ff601b72755d393a8045402e0ad03281c339c78aa4b93c3fcf36
|
7
|
+
data.tar.gz: 07afc3dcc218d6f3208b18f28456327ea7a9850452c41cae0c96f9022a4c4cfe68a6b0808d436cb37651bc60462f17a7601131ae2e80527b7d8ef8c57428645f
|
data/.rubocop.yml
CHANGED
@@ -52,7 +52,7 @@ Style/SignalException:
|
|
52
52
|
Style/BracesAroundHashParameters:
|
53
53
|
EnforcedStyle: context_dependent
|
54
54
|
|
55
|
-
|
55
|
+
Layout/EndAlignment:
|
56
56
|
EnforcedStyleAlignWith: variable
|
57
57
|
AutoCorrect: true
|
58
58
|
|
@@ -74,6 +74,6 @@ Metrics/BlockLength:
|
|
74
74
|
Style/Documentation:
|
75
75
|
Enabled: false
|
76
76
|
|
77
|
-
|
77
|
+
Naming/FileName:
|
78
78
|
Exclude:
|
79
79
|
- '*.gemspec'
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [2.0.1]
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Added forwards compatibility with Dry::Types 0.13
|
15
|
+
- Locked Dry::Types to 0.12.x for compatibility with Dry::Validation
|
16
|
+
- Locked Dry::Validation to 0.11.x to prevent error with Dry::Validation.Form not being available
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- `Pragma::Contract::Coercion` is now loaded with `feature`
|
21
|
+
|
22
|
+
## [2.0.0]
|
23
|
+
|
24
|
+
First Pragma 2 release.
|
25
|
+
|
26
|
+
[Unreleased]: https://github.com/pragmarb/pragma-contract/compare/v2.0.1...HEAD
|
27
|
+
[2.0.1]: https://github.com/pragmarb/pragma-contract/compare/v2.0.0...v2.0.1
|
28
|
+
[2.0.0]: https://github.com/pragmarb/pragma-contract/compare/v0.1.0...v2.0.0
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# Pragma::Contract
|
2
2
|
|
3
|
-
[![Build Status](https://
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![Coveralls](https://img.shields.io/coveralls/pragmarb/pragma-contract.svg?maxAge=3600&style=flat-square)](https://coveralls.io/github/pragmarb/pragma-contract)
|
3
|
+
[![Build Status](https://travis-ci.org/pragmarb/pragma-contract.svg?branch=master)](https://travis-ci.org/pragmarb/pragma-contract)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/pragmarb/pragma-contract/badge.svg?branch=master)](https://coveralls.io/github/pragmarb/pragma-contract?branch=master)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/e51e8d7489eb72ab97ba/maintainability)](https://codeclimate.com/github/pragmarb/pragma-contract/maintainability)
|
7
6
|
|
8
7
|
Contracts are form objects on steroids for your JSON API.
|
9
8
|
|
data/lib/pragma/contract/base.rb
CHANGED
@@ -12,8 +12,8 @@ module Pragma
|
|
12
12
|
# @author Alessandro Desantis
|
13
13
|
class Base < Reform::Form
|
14
14
|
feature Reform::Form::Coercion
|
15
|
+
feature Pragma::Contract::Coercion
|
15
16
|
feature Reform::Form::Dry
|
16
|
-
include Pragma::Contract::Coercion
|
17
17
|
|
18
18
|
property :current_user, virtual: true
|
19
19
|
end
|
@@ -8,19 +8,6 @@ module Pragma
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ClassMethods
|
11
|
-
def property(*args, &block)
|
12
|
-
if block_given?
|
13
|
-
super(*args) do
|
14
|
-
include Pragma::Contract::Coercion
|
15
|
-
instance_eval(&block)
|
16
|
-
end
|
17
|
-
else
|
18
|
-
super(*args)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
11
|
def strict(type)
|
25
12
|
build_type 'Strict', type
|
26
13
|
end
|
@@ -30,7 +17,13 @@ module Pragma
|
|
30
17
|
end
|
31
18
|
|
32
19
|
def form(type)
|
33
|
-
|
20
|
+
# Dry::Types 0.13 renames Types::Form to Types::Params and the Int type to Integer.
|
21
|
+
|
22
|
+
if Dry::Types['form.int']
|
23
|
+
build_type 'Form', type
|
24
|
+
else
|
25
|
+
build_type 'Params', type.to_sym == :int ? :integer : type
|
26
|
+
end
|
34
27
|
end
|
35
28
|
|
36
29
|
def json(type)
|
data/pragma-contract.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'pragma/contract/version'
|
6
6
|
|
@@ -21,14 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
+
spec.add_dependency 'dry-types', '~> 0.12.0'
|
25
|
+
spec.add_dependency 'dry-validation', '~> 0.11.1'
|
24
26
|
spec.add_dependency 'reform', '~> 2.2'
|
25
|
-
spec.add_dependency 'dry-types', '~> 0.9'
|
26
|
-
spec.add_dependency 'dry-validation', '~> 0.10'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler'
|
29
|
+
spec.add_development_dependency 'coveralls'
|
29
30
|
spec.add_development_dependency 'rake'
|
30
31
|
spec.add_development_dependency 'rspec'
|
31
32
|
spec.add_development_dependency 'rubocop'
|
32
33
|
spec.add_development_dependency 'rubocop-rspec'
|
33
|
-
spec.add_development_dependency 'coveralls'
|
34
34
|
end
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pragma-contract
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dry-types
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.12.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.12.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: dry-
|
28
|
+
name: dry-validation
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.11.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.11.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: reform
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: coveralls
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
112
|
+
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rubocop-rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- ".rspec"
|
148
148
|
- ".rubocop.yml"
|
149
149
|
- ".travis.yml"
|
150
|
+
- CHANGELOG.md
|
150
151
|
- Gemfile
|
151
152
|
- LICENSE.txt
|
152
153
|
- README.md
|
@@ -179,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
version: '0'
|
180
181
|
requirements: []
|
181
182
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.7.5
|
183
184
|
signing_key:
|
184
185
|
specification_version: 4
|
185
186
|
summary: Form objects on steroids for your HTTP API.
|