Skip to content

Commit

Permalink
fix: Rename FastJsonapi::ObjectSerializer to JSONAPI::Serializer
Browse files Browse the repository at this point in the history
As the project has been renamed, its better to reflect it in the source 
code as well.
JSONAPI::Serializer is evaluated from FastJsonapi::ObjectSerializer so 
this change  probably will go unnoticed in gem usage.
  • Loading branch information
KapilSachdev authored and stas committed Aug 27, 2020
1 parent f56a354 commit c32358e
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -677,8 +677,8 @@ require 'fast_jsonapi/instrumentation'
```

The two instrumented notifications are supplied by these two constants:
* `FastJsonapi::ObjectSerializer::SERIALIZABLE_HASH_NOTIFICATION`
* `FastJsonapi::ObjectSerializer::SERIALIZED_JSON_NOTIFICATION`
* `JSONAPI::Serializer::SERIALIZABLE_HASH_NOTIFICATION`
* `JSONAPI::Serializer::SERIALIZED_JSON_NOTIFICATION`

It is also possible to instrument one method without the other by using one of the following require statements:

Expand Down
2 changes: 1 addition & 1 deletion docs/json_serialization.md
Expand Up @@ -13,7 +13,7 @@ require 'oj'
require 'fast_jsonapi'

class BaseSerializer
include FastJsonapi::ObjectSerializer
include JSONAPI::Serializer

def to_json
Oj.dump(serializable_hash)
Expand Down
Expand Up @@ -6,9 +6,9 @@ module Instrumentation
module Skylight
module Normalizers
class SerializableHash < SKYLIGHT_NORMALIZER_BASE_CLASS
register FastJsonapi::ObjectSerializer::SERIALIZABLE_HASH_NOTIFICATION
register JSONAPI::Serializer::SERIALIZABLE_HASH_NOTIFICATION

CAT = "view.#{FastJsonapi::ObjectSerializer::SERIALIZABLE_HASH_NOTIFICATION}".freeze
CAT = "view.#{JSONAPI::Serializer::SERIALIZABLE_HASH_NOTIFICATION}".freeze

def normalize(_trace, _name, payload)
[CAT, payload[:name], nil]
Expand Down
Expand Up @@ -6,9 +6,9 @@ module Instrumentation
module Skylight
module Normalizers
class SerializedJson < SKYLIGHT_NORMALIZER_BASE_CLASS
register FastJsonapi::ObjectSerializer::SERIALIZED_JSON_NOTIFICATION
register JSONAPI::Serializer::SERIALIZED_JSON_NOTIFICATION

CAT = "view.#{FastJsonapi::ObjectSerializer::SERIALIZED_JSON_NOTIFICATION}".freeze
CAT = "view.#{JSONAPI::Serializer::SERIALIZED_JSON_NOTIFICATION}".freeze

def normalize(_trace, _name, payload)
[CAT, payload[:name], nil]
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/serializer/templates/serializer.rb.tt
@@ -1,6 +1,6 @@
<% module_namespacing do -%>
class <%= class_name %>Serializer
include FastJsonapi::ObjectSerializer
include JSONAPI::Serializer
attributes <%= attributes_names.join(", ") %>
end
<% end -%>
2 changes: 1 addition & 1 deletion spec/integration/attributes_fields_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:actor) do
act = Actor.fake
act.movies = [Movie.fake]
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/caching_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:actor) do
faked = Actor.fake
movie = Movie.fake
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/errors_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:actor) { Actor.fake }
let(:params) { {} }

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/key_transform_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:actor) { Actor.fake }
let(:params) { {} }
let(:serialized) do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/links_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:movie) do
faked = Movie.fake
faked.actors = [Actor.fake]
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/meta_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:user) { User.fake }
let(:params) { {} }
let(:serialized) do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/relationships_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe FastJsonapi::ObjectSerializer do
RSpec.describe JSONAPI::Serializer do
let(:movie) do
mov = Movie.fake
mov.actors = rand(2..5).times.map { Actor.fake }
Expand Down

0 comments on commit c32358e

Please sign in to comment.