graph_starter 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bb616c633b16f954ef39ea7783586d963ce06a8
4
- data.tar.gz: 46570de9893212dff573bc2c5813392cb5ac3b95
3
+ metadata.gz: 9e3cb6569a3ccc4e443bc052a109ef9e72a6554a
4
+ data.tar.gz: be29217c2e8783a128fea3f39d5b512d20ab47ee
5
5
  SHA512:
6
- metadata.gz: e494c12cf9452e735f79783ebe1d970f23ee254c488f6bb0b9420b376947be3234b1745c10cb3e51a73a1c3bf65f6fe3a7db2282a77089bc72d9b686d50e7bd7
7
- data.tar.gz: 162af3bd46e5097974b3a72424ffe8f4ddb7bf6c2072c2e774243222e4ea1535d0c387be65892f8e8c650c325c56f028f808afe6666a9fe559687a14cffd4bc2
6
+ metadata.gz: 827296f2a570b1aaee411c9bda8095ea21de1ced12a88c41fa2698bdac5b195eb0dedd210c4558168d28cb277f9a4d1111dc26c3446f8deb9fee77a8b3e544f0
7
+ data.tar.gz: b955f96ca5b0876e7d611e7f52e73dabd7754f59b74822f3c43df7d8acba1e1e098c14cc25fac0a308b3cf2628e47308ee2226b1640c6cff6e68d4f6a98ee640
@@ -1,3 +1,5 @@
1
+ require 'graph_starter/ip_address_validator'
2
+
1
3
  module GraphStarter
2
4
  class View
3
5
  include Neo4j::ActiveRel
@@ -0,0 +1,19 @@
1
+ class IpAddressValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ message = validation_message(value)
4
+
5
+ record.errors.add attribute, message if message
6
+ end
7
+
8
+ def validation_message(value)
9
+ match = value.to_s.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
10
+
11
+ if match
12
+ if !value.split('.').all? { |segment| segment.to_i.in?(0..255) }
13
+ 'segments must be between 0 and 255'
14
+ end
15
+ else
16
+ 'must match IP address pattern'
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph_starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Underwood
@@ -158,6 +158,7 @@ files:
158
158
  - config/routes.rb
159
159
  - lib/graph_starter.rb
160
160
  - lib/graph_starter/engine.rb
161
+ - lib/graph_starter/ip_address_validator.rb
161
162
  - lib/graph_starter/query_authorizer.rb
162
163
  - lib/graph_starter/version.rb
163
164
  - lib/tasks/graph_starter_tasks.rake