active_model_serializers-namespaces 1.0.0.rc
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +34 -0
- data/Gemfile +4 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +119 -0
- data/Rakefile +2 -0
- data/active_model_serializers-namespaces.gemspec +33 -0
- data/gemfiles/Rails-3.2.gemfile +6 -0
- data/gemfiles/Rails-4.0.gemfile +5 -0
- data/gemfiles/Rails-4.1.gemfile +5 -0
- data/gemfiles/Rails-4.2.gemfile +5 -0
- data/gemfiles/common.gemfile +5 -0
- data/lib/active_model_serializers/namespaces.rb +64 -0
- data/lib/active_model_serializers/namespaces/version.rb +5 -0
- data/spec/application_fake.rb +23 -0
- data/spec/features_spec.rb +142 -0
- data/spec/spec_helper.rb +38 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31ba8a1ed28fad0641a19bbc9f37f4e26b8e8d01
|
4
|
+
data.tar.gz: 2511eb2f9af6a7dc3a5ec8c834586d7416cd9427
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b536f8f88c33d3e2a883391fe7282157282e917fd602ccdc1ac1cf7794359e8291afaf20afdccd2d5268f7946d04d51b38d5eb3d704ef8a710924f95bab01edf
|
7
|
+
data.tar.gz: a5b05cc1d04d5cbe2955486d0d30a4555fb9992dd4de9b9070d1cd140f2b93f32031c1ae2b5a40ced4b74913f8865ba5ce122cb980dce63380cd9aa94fd51361
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
script: bundle exec rspec
|
4
|
+
|
5
|
+
rvm:
|
6
|
+
- 1.9.3
|
7
|
+
- "2.0"
|
8
|
+
- "2.1"
|
9
|
+
- rbx-2
|
10
|
+
- jruby-19mode
|
11
|
+
- ruby-head
|
12
|
+
- jruby-head
|
13
|
+
|
14
|
+
gemfile:
|
15
|
+
- gemfiles/Rails-4.2.gemfile
|
16
|
+
|
17
|
+
matrix:
|
18
|
+
include:
|
19
|
+
- rvm: "2.2"
|
20
|
+
gemfile: gemfiles/Rails-4.2.gemfile
|
21
|
+
env: RUN_COVERALLS=true
|
22
|
+
|
23
|
+
- rvm: "2.2"
|
24
|
+
gemfile: gemfiles/Rails-4.1.gemfile
|
25
|
+
|
26
|
+
- rvm: "2.2"
|
27
|
+
gemfile: gemfiles/Rails-4.0.gemfile
|
28
|
+
|
29
|
+
- rvm: "1.9.3"
|
30
|
+
gemfile: gemfiles/Rails-3.2.gemfile
|
31
|
+
|
32
|
+
allow_failures:
|
33
|
+
- rvm: ruby-head
|
34
|
+
- rvm: jruby-head
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Sebastian Skałacki
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# ActiveModelSerializer::Namespaces
|
2
|
+
|
3
|
+
[![Version][badge-version]][about-version]
|
4
|
+
[![Issues][badge-issues]][about-issues]
|
5
|
+
[![Build][badge-travis]][about-travis]
|
6
|
+
[![Climate][badge-climate]][about-climate]
|
7
|
+
[![Coverage][badge-coverage]][about-coverage]
|
8
|
+
|
9
|
+
## Compatibility note
|
10
|
+
|
11
|
+
This gem is designed for Active Model Serializers 0.8.x only.
|
12
|
+
|
13
|
+
Although newer versions of AMS are also available, currently 0.8.x is
|
14
|
+
[most recommended for new projects][ams-maintenance].
|
15
|
+
|
16
|
+
## When is it useful?
|
17
|
+
|
18
|
+
Short answer: when you need more than one way to serialize your models and
|
19
|
+
you want to organize that in namespaces.
|
20
|
+
|
21
|
+
For example, your application is serving a versioned API. You want to
|
22
|
+
freeze the old API formats and actively develop upcoming version.
|
23
|
+
|
24
|
+
For example, your application is utilizing few 3rd-party services which expect
|
25
|
+
JSONs as input, so you need to convert your models somehow, preferably avoiding
|
26
|
+
mixing these integrations.
|
27
|
+
|
28
|
+
In all these cases the most natural approach is to define a separate set of
|
29
|
+
serializers for every API version or integration. But then you discover that
|
30
|
+
you need to pass serializer name every time you use it. Even `#has_many`
|
31
|
+
declarations in serializers require that. And what will you do to serialize
|
32
|
+
a collection of objects of different classes?
|
33
|
+
|
34
|
+
With ActiveModelSerializer-Namespaces you can nest your serializers in modules
|
35
|
+
with no pain. Just pass namespace of your choice and it will be used throughout
|
36
|
+
complex models and collections. What's more, you don't need to type it in
|
37
|
+
actions, just specify it as default for the whole API version.
|
38
|
+
|
39
|
+
Creating brand new API version is again as easy as copying code to new location.
|
40
|
+
|
41
|
+
## How do I use it?
|
42
|
+
|
43
|
+
Given:
|
44
|
+
|
45
|
+
class Article < ActiveRecord::Base
|
46
|
+
end
|
47
|
+
|
48
|
+
module V1
|
49
|
+
class ArticleSerializer < ActiveModel::Serializer
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
Either specify namespace directly at `render` call:
|
54
|
+
|
55
|
+
def some_action
|
56
|
+
render json: article, serialization_namespace: Ver1
|
57
|
+
end
|
58
|
+
|
59
|
+
Or set it as a default option in controller:
|
60
|
+
|
61
|
+
def some_action
|
62
|
+
render json: article
|
63
|
+
end
|
64
|
+
|
65
|
+
def default_serializer_options
|
66
|
+
{serialization_namespace: Ver1}
|
67
|
+
end
|
68
|
+
|
69
|
+
See [`spec/features_spec.rb`][spec-features] for more detailed examples.
|
70
|
+
|
71
|
+
## How does it works (caveats)?
|
72
|
+
|
73
|
+
The trick is to delay inferring serializer class until `#new` is called and
|
74
|
+
options hash is available.
|
75
|
+
|
76
|
+
To achieve that, `::active_model_serializer` is defined for all models, however
|
77
|
+
it returns a finder proxy object instead of serializer class. The finder
|
78
|
+
instance performs lookup for serializer class and instantiates the serializer
|
79
|
+
in the response to `#new` call, therefore it's transparent for
|
80
|
+
Active Model Serializer internals.
|
81
|
+
|
82
|
+
As a consequence, overriding `#active_model_serializer`
|
83
|
+
or `::active_model_serializer` disables this gem for given model.
|
84
|
+
|
85
|
+
## Why it is a separate gem?
|
86
|
+
|
87
|
+
I did want to solve one of the biggest drawbacks of Active Model Serializers
|
88
|
+
0.8. I didn't want to introduce backwards-incompatible changes into it's API.
|
89
|
+
|
90
|
+
## Contributing
|
91
|
+
|
92
|
+
Fork it, improve it then create a pull request. You know the drill.
|
93
|
+
|
94
|
+
## See also
|
95
|
+
|
96
|
+
* Active Model Serializers issue tracker, particularly [#144][ams-issue-144],
|
97
|
+
but also: [#562][ams-issue-562], [#671][ams-issue-671],
|
98
|
+
[#735][ams-issue-735] and more.
|
99
|
+
* [ActiveModel::VersionSerializer][ams-contrib-version] — different approach
|
100
|
+
to solve the problem
|
101
|
+
|
102
|
+
[ams-maintenance]: https://github.com/rails-api/active_model_serializers#maintenance-please-read
|
103
|
+
[ams-contrib-version]: https://github.com/hookercookerman/active_model_version_serializers
|
104
|
+
[ams-issue-144]: https://github.com/rails-api/active_model_serializers/issues/144
|
105
|
+
[ams-issue-562]: https://github.com/rails-api/active_model_serializers/issues/562
|
106
|
+
[ams-issue-671]: https://github.com/rails-api/active_model_serializers/issues/671
|
107
|
+
[ams-issue-735]: https://github.com/rails-api/active_model_serializers/issues/735
|
108
|
+
[spec-features]: https://github.com/skalee/active_model_serializers-namespaces/blob/master/spec/features_spec.rb
|
109
|
+
|
110
|
+
[about-climate]: https://codeclimate.com/github/skalee/active_model_serializers-namespaces
|
111
|
+
[about-coverage]: https://coveralls.io/r/skalee/active_model_serializers-namespaces
|
112
|
+
[about-issues]: https://github.com/skalee/active_model_serializers-namespaces/issues
|
113
|
+
[about-travis]: https://travis-ci.org/skalee/active_model_serializers-namespaces
|
114
|
+
[about-version]: https://rubygems.org/gems/active_model_serializer-namespaces
|
115
|
+
[badge-climate]: https://img.shields.io/codeclimate/github/skalee/active_model_serializers-namespaces.svg
|
116
|
+
[badge-coverage]: https://img.shields.io/coveralls/skalee/active_model_serializers-namespaces.svg
|
117
|
+
[badge-issues]: https://img.shields.io/github/issues-raw/skalee/active_model_serializers-namespaces.svg
|
118
|
+
[badge-travis]: https://img.shields.io/travis/skalee/active_model_serializers-namespaces.svg
|
119
|
+
[badge-version]: https://img.shields.io/gem/v/active_model_serializer-namespaces.svg
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'active_model_serializers/namespaces/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "active_model_serializers-namespaces"
|
8
|
+
spec.version = ActiveModelSerializers::Namespaces::VERSION
|
9
|
+
spec.authors = ["Sebastian Skałacki"]
|
10
|
+
spec.email = ["skalee@gmail.com"]
|
11
|
+
spec.summary = %q{Namespaces support for ActiveModel::Serializers.}
|
12
|
+
spec.description = %q{Enhances ActiveModel::Serializers gem by adding } +
|
13
|
+
%q{support for serializers namespacing. This makes } +
|
14
|
+
%q{developing versioned APIs super easy. Works with } +
|
15
|
+
%q{ActiveModel::Serializers 0.8.x series.}
|
16
|
+
spec.homepage = "https://github.com/skalee/active_model_serializers-namespaces"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "active_model_serializers", "~> 0.8.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "guard"
|
29
|
+
spec.add_development_dependency "guard-rspec"
|
30
|
+
|
31
|
+
spec.add_development_dependency "rspec-rails", "~> 3.0"
|
32
|
+
spec.add_development_dependency "rails", ">= 3.2"
|
33
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "active_model_serializers/namespaces/version"
|
2
|
+
|
3
|
+
module ActiveModelSerializers
|
4
|
+
module Namespaces
|
5
|
+
class NamespacedSerializerFinder
|
6
|
+
|
7
|
+
def initialize unscoped_name
|
8
|
+
@unscoped_name = unscoped_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def new *args
|
12
|
+
found_class = nil
|
13
|
+
|
14
|
+
options = (args.last.kind_of?(Hash) ? args.last : {})
|
15
|
+
prefix = options[:serialization_namespace]
|
16
|
+
|
17
|
+
namespaced_name = [prefix, @unscoped_name].compact.join("::")
|
18
|
+
|
19
|
+
if namespaced_name.respond_to?(:safe_constantize)
|
20
|
+
found_class = namespaced_name.safe_constantize
|
21
|
+
else
|
22
|
+
begin
|
23
|
+
found_class = namespaced_name.constantize
|
24
|
+
rescue NameError => e
|
25
|
+
raise unless e.message =~ /uninitialized constant/
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
found_class ||= ActiveModelSerializers::Namespaces::DefaultSerializer
|
30
|
+
found_class.new *args
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
class DefaultSerializer < ActiveModel::DefaultSerializer
|
37
|
+
|
38
|
+
def to_json *args
|
39
|
+
serializable_hash.to_json *args
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_xml *args
|
43
|
+
serializable_hash.to_xml *args
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
module ActiveModel
|
52
|
+
module SerializerSupport
|
53
|
+
extend ActiveSupport::Concern
|
54
|
+
|
55
|
+
module ClassMethods #:nodoc:
|
56
|
+
|
57
|
+
def active_model_serializer
|
58
|
+
@namespaced_serializer_finder ||=
|
59
|
+
ActiveModelSerializers::Namespaces::NamespacedSerializerFinder.new("#{self.name}Serializer")
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Thank you!
|
2
|
+
# http://say26.com/rspec-testing-controllers-outside-of-a-rails-application
|
3
|
+
# https://github.com/hashrocket/decent_exposure/blob/ea02571938865fe60f86d2e4b37807062a3a7988/spec/fixtures/fake_rails_application.rb
|
4
|
+
|
5
|
+
require "rails"
|
6
|
+
require "active_support/all"
|
7
|
+
require "action_controller/railtie"
|
8
|
+
require "action_dispatch/railtie"
|
9
|
+
|
10
|
+
module Rails
|
11
|
+
class FakeApplication
|
12
|
+
def env_config; {} end
|
13
|
+
|
14
|
+
def routes
|
15
|
+
return @routes if defined?(@routes)
|
16
|
+
@routes = ActionDispatch::Routing::RouteSet.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.application
|
21
|
+
@app ||= FakeApplication.new
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "When serializing objects in controller's #render method", type: :controller do
|
4
|
+
|
5
|
+
class Model
|
6
|
+
include ActiveModel::Serializers::JSON
|
7
|
+
include ActiveModel::SerializerSupport
|
8
|
+
|
9
|
+
def name
|
10
|
+
"I'm a PORO model!"
|
11
|
+
end
|
12
|
+
|
13
|
+
def serializable_hash options = {}
|
14
|
+
{name: name, serialized_by: "Skipping AMS"}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class AnotherModel
|
19
|
+
include ActiveModel::Serializers::JSON
|
20
|
+
include ActiveModel::SerializerSupport
|
21
|
+
|
22
|
+
def name
|
23
|
+
"Yet another PORO model!"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class ModelSerializer < ActiveModel::Serializer
|
28
|
+
attributes :name, :serialized_by
|
29
|
+
|
30
|
+
def serialized_by
|
31
|
+
"Unscoped"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class AnotherModelSerializer < ActiveModel::Serializer
|
36
|
+
attributes :name, :serialized_by
|
37
|
+
|
38
|
+
def serialized_by
|
39
|
+
"Unscoped"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module Version1
|
44
|
+
class Version1::ModelSerializer < ActiveModel::Serializer
|
45
|
+
attributes :name, :serialized_by
|
46
|
+
|
47
|
+
def serialized_by
|
48
|
+
"Version 1"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class Version1::AnotherModelSerializer < ActiveModel::Serializer
|
53
|
+
attributes :name, :serialized_by
|
54
|
+
|
55
|
+
def serialized_by
|
56
|
+
"Version 1"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
module Version2
|
62
|
+
end
|
63
|
+
|
64
|
+
#####
|
65
|
+
|
66
|
+
controller do
|
67
|
+
include Rails.application.routes.url_helpers
|
68
|
+
|
69
|
+
def show
|
70
|
+
render json: Model.new
|
71
|
+
end
|
72
|
+
|
73
|
+
def index
|
74
|
+
render json: [Model.new, AnotherModel.new]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
before do
|
79
|
+
routes.draw do
|
80
|
+
get ':controller/:action', format: :json
|
81
|
+
end
|
82
|
+
|
83
|
+
allow(controller).to receive(:default_serializer_options){ options }
|
84
|
+
end
|
85
|
+
|
86
|
+
#####
|
87
|
+
|
88
|
+
let(:serialization_result){ JSON.parse response.body, symbolize_names: true }
|
89
|
+
let(:options){ {root: false} }
|
90
|
+
|
91
|
+
|
92
|
+
context "and when :serialization_namespace is unspecified" do
|
93
|
+
it "searches for serializer in the root namespace" do
|
94
|
+
get :show
|
95
|
+
expect(serialization_result).to eq(name: "I'm a PORO model!", serialized_by: "Unscoped")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "always uses serializer specified with :serializer when such option is present" do
|
99
|
+
options.merge! serializer: ::ModelSerializer
|
100
|
+
get :show
|
101
|
+
expect(serialization_result).to eq(name: "I'm a PORO model!", serialized_by: "Unscoped")
|
102
|
+
end
|
103
|
+
|
104
|
+
it "searches for serializer in the root namespace for every object in collection" do
|
105
|
+
get :index
|
106
|
+
expect(serialization_result).to eq([
|
107
|
+
{name: "I'm a PORO model!", serialized_by: "Unscoped"},
|
108
|
+
{name: "Yet another PORO model!", serialized_by: "Unscoped"},
|
109
|
+
])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "and when :serialization_namespace is specified" do
|
114
|
+
it "searches for serializer in that namespace and uses it when found" do
|
115
|
+
options.merge! serialization_namespace: Version1
|
116
|
+
get :show
|
117
|
+
expect(serialization_result).to eq(name: "I'm a PORO model!", serialized_by: "Version 1")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "searches for serializer in that namespace and uses a default serializer when not found" do
|
121
|
+
options.merge! serialization_namespace: Version2
|
122
|
+
get :show
|
123
|
+
expect(serialization_result).to eq(name: "I'm a PORO model!", serialized_by: "Skipping AMS")
|
124
|
+
end
|
125
|
+
|
126
|
+
it "always uses serializer specified with :serializer when such option is present" do
|
127
|
+
options.merge! serialization_namespace: Version1, serializer: ::ModelSerializer
|
128
|
+
get :show
|
129
|
+
expect(serialization_result).to eq(name: "I'm a PORO model!", serialized_by: "Unscoped")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "searches for serializer in that namespace for every object in collection" do
|
133
|
+
options.merge! serialization_namespace: Version1
|
134
|
+
get :index
|
135
|
+
expect(serialization_result).to eq([
|
136
|
+
{name: "I'm a PORO model!", serialized_by: "Version 1"},
|
137
|
+
{name: "Yet another PORO model!", serialized_by: "Version 1"},
|
138
|
+
])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "application_fake"
|
2
|
+
|
3
|
+
require "rspec/rails"
|
4
|
+
|
5
|
+
require "active_model_serializers"
|
6
|
+
require "active_model_serializers/namespaces"
|
7
|
+
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
|
11
|
+
config.expect_with :rspec do |expectations|
|
12
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
13
|
+
# and `failure_message` of custom matchers include text for helper methods
|
14
|
+
# defined using `chain`, e.g.:
|
15
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
16
|
+
# # => "be bigger than 2 and smaller than 4"
|
17
|
+
# ...rather than:
|
18
|
+
# # => "be bigger than 2"
|
19
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
20
|
+
end
|
21
|
+
|
22
|
+
config.mock_with :rspec do |mocks|
|
23
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
24
|
+
# a real object. This is generally recommended, and will default to
|
25
|
+
# `true` in RSpec 4.
|
26
|
+
mocks.verify_partial_doubles = true
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO Enable it when the gem starts working properly.
|
30
|
+
# config.warnings = true
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
if ENV["RUN_COVERALLS"]
|
36
|
+
require "coveralls"
|
37
|
+
Coveralls.wear!
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_model_serializers-namespaces
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastian Skałacki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active_model_serializers
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.2'
|
111
|
+
description: Enhances ActiveModel::Serializers gem by adding support for serializers
|
112
|
+
namespacing. This makes developing versioned APIs super easy. Works with ActiveModel::Serializers
|
113
|
+
0.8.x series.
|
114
|
+
email:
|
115
|
+
- skalee@gmail.com
|
116
|
+
executables: []
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
123
|
+
- Gemfile
|
124
|
+
- Guardfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- active_model_serializers-namespaces.gemspec
|
129
|
+
- gemfiles/Rails-3.2.gemfile
|
130
|
+
- gemfiles/Rails-4.0.gemfile
|
131
|
+
- gemfiles/Rails-4.1.gemfile
|
132
|
+
- gemfiles/Rails-4.2.gemfile
|
133
|
+
- gemfiles/common.gemfile
|
134
|
+
- lib/active_model_serializers/namespaces.rb
|
135
|
+
- lib/active_model_serializers/namespaces/version.rb
|
136
|
+
- spec/application_fake.rb
|
137
|
+
- spec/features_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
homepage: https://github.com/skalee/active_model_serializers-namespaces
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: 1.3.1
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.4.5
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: Namespaces support for ActiveModel::Serializers.
|
163
|
+
test_files:
|
164
|
+
- spec/application_fake.rb
|
165
|
+
- spec/features_spec.rb
|
166
|
+
- spec/spec_helper.rb
|
167
|
+
has_rdoc:
|