jsonapi_for_rails 0.1.4 → 0.1.5

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: 3e3b34eaf013306f4520bd8beb8ec87594b0dd32
4
- data.tar.gz: 5d4a449ef838869e77ac51dc9ee070728595d644
3
+ metadata.gz: 8f4dd3218dadbf9a805eb8c2436a83167558657a
4
+ data.tar.gz: 3688d50e8ddea9629ac56428a59ba10018327f6e
5
5
  SHA512:
6
- metadata.gz: a423f57386943e320ac84399d33d6bc7e685d6bb5ca25f81644b9e91e2a82732e94dfbaef602f0f584ef0e48c17d30db656d6036e8caba3bde9e10cccf218c8c
7
- data.tar.gz: ab6ad71dcc6713779f5a6f40be815d18c2847a241af3011524b743f2a226881d044720891ce9c2fbf2d17a99ae8ad6f8465b82a318503329af7048e4a54313c5
6
+ metadata.gz: c684e85d591a7961b5bda7a34234fe76674670a0c2e06d45eda50c5c8103469cc3356a1cc489b6440b1e85344cb8010466b1ca7c38e29576f9d439b8acbe8e27
7
+ data.tar.gz: be0e92ba9720ca2692cf685e74bac9d041a9591bc554f89e56185d22c7e09fe8736447a9f6ae48215607591d253bee2640dc66ec0a3e00f64473aace84862e98
checksums.yaml.gz.sig ADDED
Binary file
data/README.md CHANGED
@@ -1,11 +1,25 @@
1
1
  # JsonapiForRails
2
- A [Rails](http://rubyonrails.org/) 5+ plugin for providing a [JSONAPI v1.0](http://jsonapi.org/format/1.0/) API from your application with very little coding.
2
+ A [Rails](http://rubyonrails.org/) 4+ plugin for providing [JSONAPI v1.0](http://jsonapi.org/format/1.0/) compliant APIs from your application with very little coding.
3
+
4
+ * [Installation](#installation)
5
+ * [Usage](#usage)
6
+ 1. [Set up one API controller per model](#1-set-up-one-api-controller-per-model)
7
+ 2. [Configure your API controller routes](#2-configure-your-api-controller-routes)
8
+ 3. [Verify your setup](#3-verify-your-setup)
9
+ * [Modifying the default API behaviour](#modifying-the-default-api-behaviour)
10
+ * [Client authentication](#client-authentication)
11
+ * [Access control](#access-control)
12
+ * [Overriding an API end-point](#overriding-an-api-end-point)
13
+ * [Implementation status](#implementation-status)
14
+ * [Contributing](#contributing)
15
+ * [License](#license)
3
16
 
4
17
  ## Installation
5
18
 
6
- ### Official version
7
-
8
19
  ```bash
20
+ $ # Optional security step (do this once)
21
+ $ gem cert --add <(curl -Ls https://raw.githubusercontent.com/doga/jsonapi_for_rails/master/certs/doga.pem)
22
+ $
9
23
  $ # Go to the root directory of your existing Rails application
10
24
  $ cd path/to/railsapp
11
25
  $
@@ -14,18 +28,15 @@ $ cat >> Gemfile
14
28
  gem 'jsonapi_for_rails'
15
29
  $
16
30
  $ # Install
17
- $ bundle install
18
- ```
19
-
20
- ### Edge version
21
-
22
- ```bash
23
- $ cd path/to/railsapp
24
- $ cat >> Gemfile
25
- group :development do
26
- gem 'jsonapi_for_rails', git: 'https://github.com/doga/jsonapi_for_rails.git'
27
- end
28
- $ bundle install
31
+ $ # Optional security paramater: --trust-policy MediumSecurity
32
+ $ bundle install --trust-policy MediumSecurity
33
+ $
34
+ $ # Check the used version
35
+ $ bin/rails console
36
+ irb(main):001:0> JsonapiForRails::VERSION
37
+ => "0.1.4"
38
+ irb(main):002:0> exit
39
+ $
29
40
  ```
30
41
 
31
42
  ## Usage
@@ -191,6 +202,7 @@ The `bin/rails routes` shell command shows you the end-points that *jsonapi_for_
191
202
  class ArticlesController < JsonapiResourcesController
192
203
 
193
204
  def index
205
+ # These model-related utility methods are available inside all action methods.
194
206
  jsonapi_model_class # => Article
195
207
  jsonapi_model_type # => :articles
196
208
 
@@ -198,13 +210,16 @@ class ArticlesController < JsonapiResourcesController
198
210
  end
199
211
 
200
212
  def show
213
+ # @jsonapi_record contains the current database record.
214
+ # It is available inside all action methods (including all relationship
215
+ # methods) except :index and :create.
201
216
  @jsonapi_record.to_jsonapi_hash # => {data: {...}}
202
217
 
203
218
  # ...
204
219
  end
205
220
 
206
221
  def relationship_show
207
- # @jsonapi_relationship is available in all relationship actions.
222
+ # @jsonapi_relationship is available in all relationship action methods.
208
223
  # @jsonapi_relationship[:definition] describes the current relationship.
209
224
  @jsonapi_relationship # => {:definition=>{:name=>:author, :type=>:to_one, :receiver=>{:type=>:authors, :class=>Author}}}
210
225
 
@@ -213,9 +228,9 @@ class ArticlesController < JsonapiResourcesController
213
228
 
214
229
  def relationship_update
215
230
  # @jsonapi_relationship[:params] contains the parsed request body.
216
- # It is available for all relationship actions except relationship_show.
217
- # @jsonapi_relationship[:params][:data] behaves like a Hash for relationships of type :to_one,
218
- # and as an Array for relationships of type :to_many.
231
+ # It is available for all relationship action methods except relationship_show.
232
+ # @jsonapi_relationship[:params][:data] behaves like a Hash for relationships
233
+ # of type :to_one, and as an Array for relationships of type :to_many.
219
234
  @jsonapi_relationship # => {:definition=>{...}, :params=>{"data"=>{"type"=>"authors", "id"=>"234455384"}}}
220
235
 
221
236
  # ...
@@ -225,15 +240,18 @@ end
225
240
  ```
226
241
 
227
242
  ## Implementation status
243
+ The internal architecture is sound. Test coverage is currently being bulked up using *Rails 5 beta 2* (but the plugin should be compatible with *Rails 4+*). And missing features are being added. The intention is to release a 1.0 version around mid-2016.
244
+
245
+ Feature support roundup:
246
+
228
247
  * [Inclusion of related resources](http://jsonapi.org/format/1.0/#fetching-includes) is currently only implemented for requests that return a single resource, and relationship paths are not supported.
229
248
  * [Sparse fieldsets](http://jsonapi.org/format/1.0/#fetching-sparse-fieldsets) is currently only implemented for requests that return a single resource.
230
249
  * [Sorting](http://jsonapi.org/format/1.0/#fetching-sorting) is currently not implemented.
231
250
  * [Pagination](http://jsonapi.org/format/1.0/#fetching-pagination) is currently not implemented.
232
251
  * [Deleting resources](http://jsonapi.org/format/1.0/#crud-deleting) is currently not implemented.
233
- * Test coverage is sparse.
234
252
 
235
253
  ## Contributing
236
- If you find a bug in this project, have trouble following the documentation or have a question about the project – create an [issue](https://github.com/doga/jsonapi_for_rails/issues).
254
+ Feel free to share your experience using this software. If you find a bug in this project, have trouble following the documentation or have a question about the project – create an [issue](https://github.com/doga/jsonapi_for_rails/issues).
237
255
 
238
256
  ## License
239
257
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -14,11 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
-
21
-
22
17
  Bundler::GemHelper.install_tasks
23
18
 
24
19
  require 'rake/testtask'
@@ -30,5 +25,4 @@ Rake::TestTask.new(:test) do |t|
30
25
  t.verbose = false
31
26
  end
32
27
 
33
-
34
28
  task default: :test
data/certs/doga.pem ADDED
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDvDCCAqSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBaMRYwFAYDVQQDDA1kb2dh
3
+ LmFybWFuZ2lsMRYwFAYKCZImiZPyLGQBGRYGYWx1bW5pMRQwEgYKCZImiZPyLGQB
4
+ GRYEZXBmbDESMBAGCgmSJomT8ixkARkWAmNoMB4XDTE2MDMwMTE4NTkxNVoXDTE3
5
+ MDMwMTE4NTkxNVowWjEWMBQGA1UEAwwNZG9nYS5hcm1hbmdpbDEWMBQGCgmSJomT
6
+ 8ixkARkWBmFsdW1uaTEUMBIGCgmSJomT8ixkARkWBGVwZmwxEjAQBgoJkiaJk/Is
7
+ ZAEZFgJjaDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO/HdcvdL8y+
8
+ xOpsRnBnu+994HesBTm99Wdu1OMQbEtw/4GaVgMgTYxC2BF7xbX+3GBjc/eqkLA+
9
+ gWM/AUJn7TtWO4GeR19ijOJNyQxsHxcgpY6g3F+xeWHr19G1beyq+w7iBIhEdN/z
10
+ KWx/DwwODbV6aTykrDN/O3k/35oxYV8XQMr+evS6o7JaXtyljhDPWf35hFlURuFq
11
+ La9PtZhY1unxWnGCR+B6tWa24LaIFdeiBwf9pHwXfTwt2ZhZ5irvs83Ky0RXQaRv
12
+ DwC+RTxGRQJJj7BixJahfAWrZWxuz1zTSmQp68AnyN8W4ADxqE3VNBCa6JaAaGOY
13
+ auE8CdBGa7sCAwEAAaOBjDCBiTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
14
+ HQ4EFgQU7XakNR7mnqaRKNxVQp0VN6ALXJYwJwYDVR0RBCAwHoEcZG9nYS5hcm1h
15
+ bmdpbEBhbHVtbmkuZXBmbC5jaDAnBgNVHRIEIDAegRxkb2dhLmFybWFuZ2lsQGFs
16
+ dW1uaS5lcGZsLmNoMA0GCSqGSIb3DQEBBQUAA4IBAQCsvTAMTDeIpCVPNiZZA4Mf
17
+ EY8w+8aqVj61/3PdOHLX5bWlTVh0nRn5bTWzFknYowN+GQIqoChbJRC/qRTxaVYj
18
+ 5rqO5NlAIIqfTDXqMlcd6UjyvoXDyx4eiJ2CEjuGRTj3vrCzu6spFWyQ+Ob7j8pt
19
+ U6NxOu51DyU3Rn3cq95Ov2i8z9hGKgS7bKMNv2y4nVz9MRi3RCJLVUbU0m0roAWO
20
+ DcNXARPdnPlz0VQedZo89pKjngah8Nur01/wD97Q18Mr/av3H4Bg1sTF+RZAplU3
21
+ RX+xYPJjPMyjrD73KZ5UNtXo5jOP1T85SqXOl6ICfedTVgZMk9mzK8+PkP1croHi
22
+ -----END CERTIFICATE-----
@@ -1,5 +1,6 @@
1
1
  module JsonapiForRails
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
+ # 0.1.5: add digital signature
3
4
  # 0.1.4: gem now requires rails >= 4 instead of 5.0.0.beta2
4
5
  # 0.1.3: fix non-string id bug (http://jsonapi.org/format/1.0/#document-resource-object-identification)
5
6
  # 0.1.2: add ruby 2.0 dependency to gem
@@ -1,4 +1,3 @@
1
- # BUG: convert ids to strings in received data
2
1
  # TODO: JSONAPI: adding optional members to documents ('jsonapi', 'meta')
3
2
  # TODO: JSONAPI: return conformant HTTP status codes
4
3
  # TODO: JSONAPI: conformant and rich 'errors' member
@@ -9,8 +8,8 @@
9
8
  # TODO: JSONAPI: Location header
10
9
 
11
10
  # TODO: README.md: double-check the installation instructions
12
- # TODO: README.md: describe @jsonapi_include?
13
- # TODO: README.md: describe @jsonapi_sparse_fieldsets?
11
+ # TODO: README.md: describe @jsonapi_include ?
12
+ # TODO: README.md: describe @jsonapi_sparse_fieldsets ?
14
13
 
15
14
 
16
15
  require "jsonapi_for_rails/version"
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_for_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doga Armangil
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2016-02-27 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDvDCCAqSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBaMRYwFAYDVQQDDA1kb2dh
14
+ LmFybWFuZ2lsMRYwFAYKCZImiZPyLGQBGRYGYWx1bW5pMRQwEgYKCZImiZPyLGQB
15
+ GRYEZXBmbDESMBAGCgmSJomT8ixkARkWAmNoMB4XDTE2MDMwMTE4NTkxNVoXDTE3
16
+ MDMwMTE4NTkxNVowWjEWMBQGA1UEAwwNZG9nYS5hcm1hbmdpbDEWMBQGCgmSJomT
17
+ 8ixkARkWBmFsdW1uaTEUMBIGCgmSJomT8ixkARkWBGVwZmwxEjAQBgoJkiaJk/Is
18
+ ZAEZFgJjaDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO/HdcvdL8y+
19
+ xOpsRnBnu+994HesBTm99Wdu1OMQbEtw/4GaVgMgTYxC2BF7xbX+3GBjc/eqkLA+
20
+ gWM/AUJn7TtWO4GeR19ijOJNyQxsHxcgpY6g3F+xeWHr19G1beyq+w7iBIhEdN/z
21
+ KWx/DwwODbV6aTykrDN/O3k/35oxYV8XQMr+evS6o7JaXtyljhDPWf35hFlURuFq
22
+ La9PtZhY1unxWnGCR+B6tWa24LaIFdeiBwf9pHwXfTwt2ZhZ5irvs83Ky0RXQaRv
23
+ DwC+RTxGRQJJj7BixJahfAWrZWxuz1zTSmQp68AnyN8W4ADxqE3VNBCa6JaAaGOY
24
+ auE8CdBGa7sCAwEAAaOBjDCBiTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
25
+ HQ4EFgQU7XakNR7mnqaRKNxVQp0VN6ALXJYwJwYDVR0RBCAwHoEcZG9nYS5hcm1h
26
+ bmdpbEBhbHVtbmkuZXBmbC5jaDAnBgNVHRIEIDAegRxkb2dhLmFybWFuZ2lsQGFs
27
+ dW1uaS5lcGZsLmNoMA0GCSqGSIb3DQEBBQUAA4IBAQCsvTAMTDeIpCVPNiZZA4Mf
28
+ EY8w+8aqVj61/3PdOHLX5bWlTVh0nRn5bTWzFknYowN+GQIqoChbJRC/qRTxaVYj
29
+ 5rqO5NlAIIqfTDXqMlcd6UjyvoXDyx4eiJ2CEjuGRTj3vrCzu6spFWyQ+Ob7j8pt
30
+ U6NxOu51DyU3Rn3cq95Ov2i8z9hGKgS7bKMNv2y4nVz9MRi3RCJLVUbU0m0roAWO
31
+ DcNXARPdnPlz0VQedZo89pKjngah8Nur01/wD97Q18Mr/av3H4Bg1sTF+RZAplU3
32
+ RX+xYPJjPMyjrD73KZ5UNtXo5jOP1T85SqXOl6ICfedTVgZMk9mzK8+PkP1croHi
33
+ -----END CERTIFICATE-----
34
+ date: 2016-03-02 00:00:00.000000000 Z
12
35
  dependencies:
13
36
  - !ruby/object:Gem::Dependency
14
37
  name: rails
@@ -36,16 +59,15 @@ dependencies:
36
59
  requirements:
37
60
  - - ">="
38
61
  - !ruby/object:Gem::Version
39
- version: '0'
62
+ version: '1.3'
40
63
  type: :development
41
64
  prerelease: false
42
65
  version_requirements: !ruby/object:Gem::Requirement
43
66
  requirements:
44
67
  - - ">="
45
68
  - !ruby/object:Gem::Version
46
- version: '0'
47
- description: Jsonapi for Rails empowers your JSON API compliant APIs. Requires with
48
- very little coding. http://jsonapi.org/format/
69
+ version: '1.3'
70
+ description:
49
71
  email:
50
72
  - doga.armangil@alumni.epfl.ch
51
73
  executables: []
@@ -55,6 +77,7 @@ files:
55
77
  - MIT-LICENSE
56
78
  - README.md
57
79
  - Rakefile
80
+ - certs/doga.pem
58
81
  - lib/jsonapi_for_rails.rb
59
82
  - lib/jsonapi_for_rails/controller.rb
60
83
  - lib/jsonapi_for_rails/controller/actions/object.rb
@@ -72,7 +95,12 @@ files:
72
95
  homepage: https://github.com/doga/jsonapi_for_rails
73
96
  licenses:
74
97
  - MIT
75
- metadata: {}
98
+ metadata:
99
+ code: https://github.com/doga/jsonapi_for_rails
100
+ docs: https://github.com/doga/jsonapi_for_rails#jsonapiforrails
101
+ wiki: ''
102
+ mail: ''
103
+ bugs: https://github.com/doga/jsonapi_for_rails/issues
76
104
  post_install_message:
77
105
  rdoc_options: []
78
106
  require_paths:
@@ -92,5 +120,6 @@ rubyforge_project:
92
120
  rubygems_version: 2.5.1
93
121
  signing_key:
94
122
  specification_version: 4
95
- summary: Jsonapi for Rails empowers your JSON API compliant APIs
123
+ summary: Jsonapi for Rails empowers your JSON API compliant APIs. Requires very little
124
+ coding. http://jsonapi.org/format/
96
125
  test_files: []
metadata.gz.sig ADDED
Binary file