jsonapi-validator 0.0.0 → 0.0.1

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: f655bd883eca1ba6402906598a55a3d0561e47f3
4
- data.tar.gz: 4eea1ca51ce5ea131ec786fa8a0ac0e1859de1a2
3
+ metadata.gz: 1516bff498b1fe5a5f1494037b0cc76917f69822
4
+ data.tar.gz: 3bb66beda771c5f5ae6def35b1feba3ed2b19320
5
5
  SHA512:
6
- metadata.gz: d89f222156e0d49682b4aab277d9bf0545fa42578a04acc2320e5c05466d14856fd8b4602106512ced213850325f55aaab9e07334a045c4e12cdfee741f50c29
7
- data.tar.gz: 9a104dd06f078ecbe3788028074c777272e7863804c3edaaddab1479c82212bf1680cbb93ff740c4ec9dd687eb664bc4145d29c8b867d86e0565c99a3dd4537a
6
+ metadata.gz: 98ce72fe2be9ea6a7f546a1337625ad43b3e312baf1fd61bbf4e5ee8acdbf0925af9ee5d77693af61ad02658a183111695526d83d3e5fbfe0ef44b97652fa469
7
+ data.tar.gz: 5123aac1323f9e27e64c73e4c12aa1ef33382c146613070e0de6af7553e2f94b37c5bfc1551d6b81b4a29a53a51d1d456907a74c7e170e28b85167a922b80f93
@@ -1,7 +1,7 @@
1
1
  module JsonApi
2
2
  class Validator
3
3
 
4
- def self.json_file(file)
4
+ def self.file(file)
5
5
  object = nil
6
6
  File.open(file) do |f|
7
7
  object = JSON.parse(f.read)
@@ -9,7 +9,7 @@ module JsonApi
9
9
  return json(object)
10
10
  end
11
11
 
12
- def self.json(object)
12
+ def self.object(object)
13
13
  errors = JSON::Validator.fully_validate(STANDARD_SCHEMA,object)
14
14
  return errors
15
15
  end
@@ -7,7 +7,7 @@ namespace "jsonapi" do
7
7
  json_spec_files = Dir["#{Rails.root}/spec/apis/**/*.json"]
8
8
  json_spec_files.each do |spec|
9
9
  print "\n\nValidating file '#{spec}': "
10
- result = JsonApi::Validator.json_file(spec)
10
+ result = JsonApi::Validator.file(spec)
11
11
  if result.nil? or result.empty?
12
12
  puts " PASSED\n"
13
13
  else
@@ -12,10 +12,10 @@ class TestSchema < Minitest::Test
12
12
  end
13
13
 
14
14
  def test_invalid_json_object
15
- assert_equal JsonApi::Validator.json(@invalid_object)[0].size > 0 ,true
15
+ assert_equal JsonApi::Validator.object(@invalid_object)[0].size > 0 ,true
16
16
  end
17
17
 
18
18
  def test_valid_json_object
19
- assert_equal JsonApi::Validator.json(@valid_object),[]
19
+ assert_equal JsonApi::Validator.object(@valid_object),[]
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karthik selvakumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json