resourcey 0.3.0 → 0.4.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 +4 -4
- data/README.md +12 -5
- data/lib/resourcey/config.rb +14 -0
- data/lib/resourcey/controller.rb +1 -1
- data/lib/resourcey/errors.rb +1 -0
- data/lib/resourcey/initializer.rb +7 -0
- data/lib/resourcey.rb +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08220e7540269d7c02a3058371dbc684b12769b2
|
4
|
+
data.tar.gz: ff2a774f66ebce7bf4b0126dcea60d57a9c7c0fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ac82cee0ce23c84eec113fc7a949cb6c5b0167ae549ee9d939416ca8a28eca76feedf0a847ca02e8a5ddd0e88e438f1261e9e466ebdef25e7372a699cabca6b
|
7
|
+
data.tar.gz: 8920071fe981a532febb3248a650ec750ab89de5b7b7a95cfc63e17f090e63b0670efdfa1482d4e94ce656256a8de8247225d087d83eae4d5b6d33fd6f365877
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# Resourcey
|
2
|
-
 
|
2
|
+
  
|
3
3
|
|
4
4
|
A lightweight rails gem for building resource-based APIs.
|
5
5
|
|
6
6
|
### Table of contents
|
7
|
+
- [Requirements](#requirements)
|
7
8
|
- [Installation](#installation)
|
8
9
|
- [Usage](#usage)
|
9
10
|
- [Controller](#controller)
|
@@ -14,6 +15,9 @@ A lightweight rails gem for building resource-based APIs.
|
|
14
15
|
- [Configuration](#configuration)
|
15
16
|
- [Contributing](#contributing)
|
16
17
|
|
18
|
+
## Requirements
|
19
|
+
Resourcey requires ruby 2.2.2 or higher.
|
20
|
+
|
17
21
|
## Installation
|
18
22
|
Add Resourcey to your `Gemfile`:
|
19
23
|
```ruby
|
@@ -104,15 +108,18 @@ Resourcey.configure do |config|
|
|
104
108
|
end
|
105
109
|
```
|
106
110
|
|
107
|
-
|
108
|
-
|
111
|
+
#### Available config variables
|
112
|
+
| **config var** | **description**| **default** |
|
113
|
+
| --- | --- | --- |
|
114
|
+
| `default_paginator` | Name of paginator that will be used in every controller, if not configured on controller-level. Click [here](/docs/PAGINATION.md) for details. | `:paged`
|
115
|
+
| `controller_parent` | Class or class name of controller, that `Resourcey::Controller` will inherit from. | `ActionController::Base` |
|
109
116
|
|
110
117
|
## Contributing
|
111
118
|
If you want to take part in developing resourcey, fork this repository, commit your code, and create pull request.
|
112
119
|
|
113
120
|
### Requirements
|
114
|
-
- ruby 2.
|
115
|
-
- bundler
|
121
|
+
- ruby 2.2.2 or higher
|
122
|
+
- bundler gem
|
116
123
|
|
117
124
|
### Running local tests
|
118
125
|
- rspec
|
data/lib/resourcey/config.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
+
require 'action_controller'
|
2
|
+
|
1
3
|
module Resourcey
|
2
4
|
class Config
|
3
5
|
attr_accessor :default_paginator
|
6
|
+
attr_reader :controller_parent
|
4
7
|
|
5
8
|
def initialize
|
6
9
|
self.default_paginator = :paged
|
10
|
+
self.controller_parent = ActionController::Base
|
11
|
+
end
|
12
|
+
|
13
|
+
def controller_parent=(value)
|
14
|
+
return @controller_parent = value if value.class == Class
|
15
|
+
|
16
|
+
begin
|
17
|
+
@controller_parent = value.to_s.constantize
|
18
|
+
rescue
|
19
|
+
raise Errors::RuntimeError.new("#{value} is not a valid class name")
|
20
|
+
end
|
7
21
|
end
|
8
22
|
end
|
9
23
|
|
data/lib/resourcey/controller.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'resourcey/controller_modules'
|
2
2
|
|
3
3
|
module Resourcey
|
4
|
-
class Controller <
|
4
|
+
class Controller < Resourcey.config.controller_parent
|
5
5
|
include Resourcey::ControllerFiltering
|
6
6
|
include Resourcey::ControllerPagination
|
7
7
|
include Resourcey::ControllerModel
|
data/lib/resourcey/errors.rb
CHANGED
data/lib/resourcey.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'rails'
|
2
2
|
|
3
3
|
require 'resourcey/errors'
|
4
4
|
require 'resourcey/config'
|
5
|
-
require 'resourcey/controller'
|
6
5
|
require 'resourcey/serializer'
|
7
6
|
require 'resourcey/paginator'
|
8
7
|
require 'resourcey/filter'
|
9
8
|
require 'resourcey/filter_processor'
|
9
|
+
require 'resourcey/initializer'
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- polakowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/resourcey/errors.rb
|
98
98
|
- lib/resourcey/filter.rb
|
99
99
|
- lib/resourcey/filter_processor.rb
|
100
|
+
- lib/resourcey/initializer.rb
|
100
101
|
- lib/resourcey/paginator.rb
|
101
102
|
- lib/resourcey/serializer.rb
|
102
103
|
homepage: https://github.com/polakowski/resourcey
|
@@ -111,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
112
|
requirements:
|
112
113
|
- - ">="
|
113
114
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
115
|
+
version: 2.2.2
|
115
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
117
|
requirements:
|
117
118
|
- - ">="
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.4.8
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: resourcey
|