reaction 0.0.0 → 0.2.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: 70ffb42ccf83ba294bfb07d8887055c9a2343d2e
4
- data.tar.gz: 44a1abae9c843a15bbe634c28ab867216b1042f4
3
+ metadata.gz: aca4aad215915e667e9c711483c2cfc9ff476868
4
+ data.tar.gz: d54fd1353ef63abad3c25aae23e09031f111beae
5
5
  SHA512:
6
- metadata.gz: cc74f3443a4b55a2828c03ce89b971f7022320f8cbb994b5e8c099ee4ebdb48d24abd2ab8e78e9a76049d2bd257a4ec45504ba963c590238a7ddbcb6e8b9010d
7
- data.tar.gz: be02f4c83dbf04a96762b3d009942542ff477e0c21962d8a5d5b475598939293d8db2db83a48fc72894ae26a6b2f108c12b1f3b5121dc2695111ea3c81b8922f
6
+ metadata.gz: 69b6a817db4c326691a171514987a0d4bd98b12a568d51c771db34f7eec84eaa917d47f8a653252c2191cc514d15b3fea5d9fff075099c14d546f3298056a744
7
+ data.tar.gz: 26262301db8e8898ce28e399019cb11b6b083b8ebb7ee51ed6c97a7e68b1a06e358cd77e7df3fc3e1dfc688e59ab3d514cc21b43b98cd32e22b1fe1e0c8e6475
@@ -32,6 +32,11 @@ module Reaction
32
32
  end
33
33
 
34
34
  def validate!
35
+ params.each do |name, value|
36
+ unless self.class.class_for_type(name)
37
+ errors.add(name, 'is not a valid parameter.')
38
+ end
39
+ end
35
40
  self.class.types.each do |name, type|
36
41
  type.validate_each(self, name, raw_param(name))
37
42
  end
@@ -10,7 +10,7 @@ module Reaction
10
10
 
11
11
  module ClassMethods
12
12
  def param(name, options = {})
13
- set_type(name, options.delete(:type))
13
+ set_type(name, options.delete(:type) || RawType)
14
14
  set_validators(name, options)
15
15
  end
16
16
  end
@@ -20,7 +20,7 @@ module Reaction
20
20
  name = type.to_s.split('_').map(&:capitalize).join
21
21
  const_get("#{name}Type")
22
22
  rescue NameError
23
- raise ArgumentError.new("Unknown param type: #{type}")
23
+ nil
24
24
  end
25
25
  end
26
26
 
data/reaction.gemspec CHANGED
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'reaction'
7
- gem.version = '0.0.0'
8
- gem.authors = ["Jonathan Calhoun"]
9
- gem.email = ["joncalhoun@gmail.com"]
10
- gem.description = 'Reaction is a library to help build reusable actions for Rails controllers.'
11
- gem.summary = 'Reaction is a library to help build reusable actions for Rails controllers.'
12
- gem.homepage = 'https://github.com/joncalhoun/reaction'
7
+ gem.version = '0.2.0'
8
+ gem.authors = ["Jon Calhoun", "Jon Calhoun", "Ryan Jackson"]
9
+ gem.email = ["joncalhoun@gmail.com", "jon@paidlabs.com", "ryan@paidlabs.com"]
10
+ gem.description = 'Reaction makes it easy to build reusable controller actions along with reusable validators and param type converters.'
11
+ gem.summary = 'Reusable controller actions and validators.'
12
+ gem.homepage = 'https://github.com/paidlabs/reaction'
13
13
 
14
14
  gem.files = `git ls-files`.split($/)
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,18 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Jonathan Calhoun
7
+ - Jon Calhoun
8
+ - Jon Calhoun
9
+ - Ryan Jackson
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
13
+ date: 2016-03-02 00:00:00.000000000 Z
12
14
  dependencies: []
13
- description: Reaction is a library to help build reusable actions for Rails controllers.
15
+ description: Reaction makes it easy to build reusable controller actions along with
16
+ reusable validators and param type converters.
14
17
  email:
15
18
  - joncalhoun@gmail.com
19
+ - jon@paidlabs.com
20
+ - ryan@paidlabs.com
16
21
  executables: []
17
22
  extensions: []
18
23
  extra_rdoc_files: []
@@ -34,7 +39,7 @@ files:
34
39
  - lib/reaction/type.rb
35
40
  - lib/reaction/types/raw_type.rb
36
41
  - reaction.gemspec
37
- homepage: https://github.com/joncalhoun/reaction
42
+ homepage: https://github.com/paidlabs/reaction
38
43
  licenses: []
39
44
  metadata: {}
40
45
  post_install_message:
@@ -56,5 +61,5 @@ rubyforge_project:
56
61
  rubygems_version: 2.4.5
57
62
  signing_key:
58
63
  specification_version: 4
59
- summary: Reaction is a library to help build reusable actions for Rails controllers.
64
+ summary: Reusable controller actions and validators.
60
65
  test_files: []