json_api_conformant 0.0.1 → 0.0.2

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: 92291efde255c5c90b95e15c05e83bf78847cfaf
4
- data.tar.gz: af194f8d29d1c213ed446298e78530ee65edfa6c
3
+ metadata.gz: 4634ddceab8a179d9c13de30a94cf8592db96bf9
4
+ data.tar.gz: 66ca7f6573f8bb44f5badf9dd29dda5de8593bd9
5
5
  SHA512:
6
- metadata.gz: a1ad1aea511b450f83e5b761b5dc2fb55a1f493e73fa9e3fbd9b3bb72875214b6287e49d782462a77a18bb027cf05c485ce26f723597a9519ef82064378d5f49
7
- data.tar.gz: 50d9dbc0363d0f0619b619fa8bc210ccfb69463c3ce759e0f75e61d739de5bf00f259c630453afc4f7c6af891f89e70daf940f2950b9a90eaa42b827f1b56f02
6
+ metadata.gz: f5a94c9cad6f10c1c64d5e5c28e32a249b366b83a27264d6e1522056808eb5a2c68f2cfb050aaf853a7012f67c5644f82eca6d74a02636f827c07bc70d111997
7
+ data.tar.gz: 0e09e145ab952ac4eab546015bf4d3cc61397e460838a773a21f18ef4f430f00ed4c630fa9d2ce7f2df5beeda1415cd90571683bf8337eeb334fa76397271acb
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  .DS_Store
16
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
+ - ruby-head
7
+ - jruby-1.7.9
8
+ - jruby-head
9
+ - rbx-2.2.7
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: jruby-head
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # JSON API Conformant
2
+ [![Build Status](https://travis-ci.org/sebasoga/json_api_conformant.svg?branch=master)](https://travis-ci.org/sebasoga/json_api_conformant)
3
+ [![Code Climate](https://codeclimate.com/github/sebasoga/json_api_conformant/badges/gpa.svg)](https://codeclimate.com/github/sebasoga/json_api_conformant)
2
4
 
3
5
  When building an API in JSON it is important to follow conventions for the so
4
6
  that your system clients know how to send a request for the available resources
@@ -47,20 +49,26 @@ valid_schema = {"posts" => [{"id" => "1"}]}
47
49
  invalid_schema = {"comments" => "Nice gem!"}
48
50
 
49
51
  JSON::API::Conformant.validate(valid_schema) # => []
50
- JSON::API::Conformant.validate(invalid_schema) # => ["The property
51
- '#/comments' of type String did not match the"]
52
+ JSON::API::Conformant.validate(invalid_schema) # => ["The property '#/comments' of type String did not match the..."]
52
53
  ```
53
54
 
54
- JSON API Conformant wraps [json-schema](https://github.com/hoxworth/json-schema,
55
+ JSON API Conformant wraps [json-schema](https://github.com/hoxworth/json-schema),
55
56
  so other options that validator accepts will work here too.
57
+ ```ruby
58
+ schema = {"posts" => [{"id" => "1"}]}
59
+
60
+ JSON::API::Conformant.valid?(valid_schema, insert_defaults: true)
61
+ JSON::API::Conformant.validate(valid_schema, errors_as_objects: true)
62
+ ```
63
+
56
64
 
57
65
  ### RSpec Matcher
66
+ Only tested with RSpec 3.
58
67
 
59
68
  It is pretty straighword to use.
60
69
  ```ruby
61
- it "..." do
70
+ it "validates that's JSON API conformant" do
62
71
  data = {"posts" => [{"id" => "1"}]}
63
-
64
72
  expect(data).to be_json_api_conformant
65
73
  end
66
74
  ```
@@ -1,7 +1,7 @@
1
1
  module JSON
2
2
  module API
3
3
  class Conformant
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,6 @@
1
1
  require "json_api_conformant/version"
2
2
  require "json_api_conformant/conformant"
3
- require "json_api_conformant/matchers/rspec"
3
+
4
+ require "json_api_conformant/matchers/rspec" if defined?(RSpec)
5
+
6
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_conformant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Sogamoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-07 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
+ - ".travis.yml"
77
78
  - Gemfile
78
79
  - LICENSE.txt
79
80
  - README.md