moca_rlibs 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: df0c70ea60a992a5103f12d59597154ab11a0a2f3b4a2ac4855e3c631d228be6
4
- data.tar.gz: 593606828276f8504273ac0ff94f457d670db02cee23fd1fcbbc2aa498ee513a
3
+ metadata.gz: d56de38ddc6cf57ad65b710c31020762a8eb6c0986a2dc0d4bdef1f32a679c21
4
+ data.tar.gz: eed1cd31a40b943240e748a803de37e2bf306f6c63fecda87cd7fabe1cb16d0a
5
5
  SHA512:
6
- metadata.gz: 3bb2f97ef08fe45d873b1ece91d21ea39e0a5fa4d349c65fdb13e2b6ae048dea85cfae4fb7663961ef8d81b441b1d2e59fea86e602e9215c4c830e3cffdb625f
7
- data.tar.gz: 86284a59c185ca93ff85f7390cb28c1d1f2df962efd654dc6b1f2e23d0ac7a5b5e2625582ecd986e70dc33d516ef4088dfa1f96fc8ba2a25f743f569857b4bea
6
+ metadata.gz: bc9da672d7425509fabea361d88ce40fd716dc0999d3a08c54be4cea20ceb5eaf780224fee305d82fd34b3b222d07038059e4746960ece674fd00d9bd72eebdd
7
+ data.tar.gz: 3f355f47f10b8c21a7c23bdf944b7863110cd4a02316b843631e965a272b7c46798c76ac76f96f8bf047e4ab46c85ae06b2c522e22c36e1729f4fd5f0aa9722a
data/.idea/rlibs.iml CHANGED
@@ -36,6 +36,7 @@
36
36
  <orderEntry type="library" scope="PROVIDED" name="parser (v3.0.2.0, rbenv: 3.0.2) [gem]" level="application" />
37
37
  <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, rbenv: 3.0.2) [gem]" level="application" />
38
38
  <orderEntry type="library" scope="PROVIDED" name="rack-accept (v0.4.5, rbenv: 3.0.2) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, rbenv: 3.0.2) [gem]" level="application" />
39
40
  <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, rbenv: 3.0.2) [gem]" level="application" />
40
41
  <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.0.2) [gem]" level="application" />
41
42
  <orderEntry type="library" scope="PROVIDED" name="rbs (v1.0.4, rbenv: 3.0.2) [gem]" level="application" />
@@ -63,7 +64,35 @@
63
64
  </component>
64
65
  <component name="RakeTasksCache">
65
66
  <option name="myRootTask">
66
- <RakeTaskImpl id="rake" />
67
+ <RakeTaskImpl id="rake">
68
+ <subtasks>
69
+ <RakeTaskImpl description="Build moca_rlibs-0.0.3.gem into the pkg directory" fullCommand="build" id="build" />
70
+ <RakeTaskImpl id="build">
71
+ <subtasks>
72
+ <RakeTaskImpl description="Generate SHA512 checksum if moca_rlibs-0.0.3.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
73
+ </subtasks>
74
+ </RakeTaskImpl>
75
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
76
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
77
+ <RakeTaskImpl description="Build and install moca_rlibs-0.0.3.gem into system gems" fullCommand="install" id="install" />
78
+ <RakeTaskImpl id="install">
79
+ <subtasks>
80
+ <RakeTaskImpl description="Build and install moca_rlibs-0.0.3.gem into system gems without network access" fullCommand="install:local" id="local" />
81
+ </subtasks>
82
+ </RakeTaskImpl>
83
+ <RakeTaskImpl description="Create tag v0.0.3 and build and push moca_rlibs-0.0.3.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
84
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
85
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
86
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
87
+ <RakeTaskImpl id="release">
88
+ <subtasks>
89
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
90
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
91
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
92
+ </subtasks>
93
+ </RakeTaskImpl>
94
+ </subtasks>
95
+ </RakeTaskImpl>
67
96
  </option>
68
97
  </component>
69
98
  </module>
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- moca_rlibs (0.0.3)
4
+ moca_rlibs (0.0.4)
5
5
  activemodel
6
6
  activesupport
7
7
  email_validator
@@ -66,6 +66,8 @@ GEM
66
66
  rack (2.2.3)
67
67
  rack-accept (0.4.5)
68
68
  rack (>= 0.4)
69
+ rack-test (1.1.0)
70
+ rack (>= 1.0, < 3)
69
71
  rainbow (3.0.0)
70
72
  rake (13.0.6)
71
73
  regexp_parser (2.1.1)
@@ -124,6 +126,7 @@ DEPENDENCIES
124
126
  codecov
125
127
  moca_rlibs!
126
128
  rack
129
+ rack-test
127
130
  rake
128
131
  rspec
129
132
  rubocop
data/README.md CHANGED
@@ -112,6 +112,13 @@ params do
112
112
  requires :text, type: String, only_alpha_numeric: true
113
113
  end
114
114
  ```
115
+ 出力可能なアスキー文字しか含まれないこと
116
+ (半角英数字、半角スペース、一部の表示可能な記号)
117
+ ```ruby
118
+ params do
119
+ requires :text, type: String, only_printable: true
120
+ end
121
+ ```
115
122
  ## Slack通知送信用クラス
116
123
  ```ruby
117
124
  # インスタンス化
@@ -13,7 +13,7 @@ module MocaRlibs::GrapeValidators
13
13
  parameter = params[attr_name].presence.to_s
14
14
  return if parameter.match?(/\A[a-zA-Z]*\z/)
15
15
 
16
- message = 'contain non-ascii characters'
16
+ message = 'contain invalid characters (only alphabets)'
17
17
  raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)
18
18
  end
19
19
  end
@@ -13,7 +13,7 @@ module MocaRlibs::GrapeValidators
13
13
  parameter = params[attr_name].presence.to_s
14
14
  return if parameter.match?(/\A[a-zA-Z0-9]*\z/)
15
15
 
16
- message = 'contain non-ascii characters'
16
+ message = 'contain invalid characters (only numbers and alphabets)'
17
17
  raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)
18
18
  end
19
19
  end
@@ -13,7 +13,7 @@ module MocaRlibs::GrapeValidators
13
13
  parameter = params[attr_name].presence.to_s
14
14
  return if parameter.match?(/\A[0-9]*\z/)
15
15
 
16
- message = 'contain non-ascii characters'
16
+ message = 'contain invalid characters (only numbers)'
17
17
  raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)
18
18
  end
19
19
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/all'
4
+ require 'grape'
5
+
6
+ module MocaRlibs::GrapeValidators
7
+ # 出力可能なアスキー文字のみかどうかをチェックする(半角英数字+半角スペース+一部の記号)
8
+ class OnlyPrintable < Grape::Validations::Base
9
+ def validate_param!(attr_name, params)
10
+ return if !@required && params[attr_name].blank?
11
+
12
+ # `to_s` is for Symbol.
13
+ parameter = params[attr_name].presence.to_s
14
+ return if parameter.match?(%r{\A[a-zA-Z0-9!"#$%&'()*+,-./:;<=>?@\[\\\]^_`{|}~]*\z})
15
+
16
+ message = 'contain invalid characters (only printable ascii characters)'
17
+ raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message)
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MocaRlibs
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
data/lib/moca_rlibs.rb CHANGED
@@ -18,6 +18,7 @@ require_relative 'moca_rlibs/grape_validators/only_ascii'
18
18
  require_relative 'moca_rlibs/grape_validators/only_numbers'
19
19
  require_relative 'moca_rlibs/grape_validators/only_alpha'
20
20
  require_relative 'moca_rlibs/grape_validators/only_alpha_numeric'
21
+ require_relative 'moca_rlibs/grape_validators/only_printable'
21
22
  require_relative 'moca_rlibs/grape_errors/bad_gateway'
22
23
  require_relative 'moca_rlibs/grape_errors/bad_request'
23
24
  require_relative 'moca_rlibs/grape_errors/conflict'
data/moca_rlibs.gemspec CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_development_dependency 'codecov'
37
37
  spec.add_development_dependency 'rack'
38
+ spec.add_development_dependency 'rack-test'
38
39
  spec.add_development_dependency 'rake'
39
40
  spec.add_development_dependency 'rspec'
40
41
  spec.add_development_dependency 'rubocop'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moca_rlibs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mocaberos
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack-test
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -260,6 +274,7 @@ files:
260
274
  - lib/moca_rlibs/grape_validators/only_alpha_numeric.rb
261
275
  - lib/moca_rlibs/grape_validators/only_ascii.rb
262
276
  - lib/moca_rlibs/grape_validators/only_numbers.rb
277
+ - lib/moca_rlibs/grape_validators/only_printable.rb
263
278
  - lib/moca_rlibs/grape_validators/starts_with.rb
264
279
  - lib/moca_rlibs/grape_validators/url.rb
265
280
  - lib/moca_rlibs/service.rb