resourcey 0.1.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 +4 -4
- data/README.md +1 -1
- data/lib/resourcey/controller.rb +7 -0
- data/lib/resourcey/controller_model.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 075d460663df6bf6774be36b9dcd6c917ee6cf29
|
4
|
+
data.tar.gz: e0bdca448072bbc9efb19a5207be12c2b51c3f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f311a490673a494c0c118f1eafa79be7874369f189d318377da13bc13eaec6a1761c858530d16a912f60c91d88ded5e415c7357f9b6120cc3cd9a47990f5cbe2
|
7
|
+
data.tar.gz: b174ce9bbc790cfedf83229b1d3e18866ce68f9dba4908b01e5b93f735261187c54d6a3d1d8ef78972607095829df81c3b27e1a476a1b412e51eab553814d412
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Resourcey [](https://badge.fury.io/rb/resourcey) 
|
2
2
|
A lightweight gem for building resource-based APIs.
|
3
3
|
|
4
4
|
## Installation
|
data/lib/resourcey/controller.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'resourcey/controller_pagination'
|
2
|
+
require 'resourcey/controller_model'
|
2
3
|
|
3
4
|
module Resourcey
|
4
5
|
class Controller < ActionController::Base
|
5
6
|
include Resourcey::ControllerPagination
|
7
|
+
include Resourcey::ControllerModel
|
6
8
|
|
7
9
|
def index
|
8
10
|
render json: serialized_collection(paginated_resources)
|
@@ -56,6 +58,11 @@ module Resourcey
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def resource_model
|
61
|
+
return self.controller_model if self.controller_model
|
62
|
+
default_resource_model
|
63
|
+
end
|
64
|
+
|
65
|
+
def default_resource_model
|
59
66
|
name = resource_model_name
|
60
67
|
name.safe_constantize || raise(Errors::ClassNotFound.new(name))
|
61
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resourcey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- polakowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/resourcey.rb
|
91
91
|
- lib/resourcey/config.rb
|
92
92
|
- lib/resourcey/controller.rb
|
93
|
+
- lib/resourcey/controller_model.rb
|
93
94
|
- lib/resourcey/controller_pagination.rb
|
94
95
|
- lib/resourcey/errors.rb
|
95
96
|
- lib/resourcey/paginator.rb
|