Skip to content

Commit f4b294a

Browse files
committed
Update README and bump up gem's version
1 parent d1939e9 commit f4b294a

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ end
5454
Support:
5555

5656
* Ruby 1.9+ with Rails 4
57-
* Ruby 2.3+ with Rails 5
57+
* Ruby 2.4+ with Rails 5
5858

5959
For Rails 4 add this to your application's Gemfile:
6060

6161
```ruby
6262
gem 'jsonapi-utils', '~> 0.4.9'
6363
```
6464

65-
For Rails 5:
65+
For Rails 5+:
6666

6767
```ruby
68-
gem 'jsonapi-utils', '~> 0.7.2'
68+
gem 'jsonapi-utils', '~> 0.7.3'
6969
```
7070

7171
And then execute:

lib/jsonapi/utils/response/formatters.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Formatters
1515
# @option options [JSONAPI::Resource] resource: it tells the formatter which resource
1616
# class to be used rather than use an infered one (default behaviour)
1717
#
18-
# @option options [JSONAPI::Resource] source_resource: it tells the formatter that this response is from a related resource
18+
# @option options [JSONAPI::Resource] source: it tells the formatter that this response is from a related resource
1919
# and the result should be interpreted as a related resources response
2020
#
2121
# @option options [String, Symbol] relationship_type: it tells that the formatter which relationship the data is from
@@ -32,7 +32,7 @@ module Formatters
3232
# @api public
3333
def jsonapi_format(object, options = {})
3434
if object.is_a?(Hash)
35-
hash = object.with_indifferent_access
35+
hash = object.with_indifferent_access
3636
object = hash_to_active_record(hash[:data], options[:model])
3737
end
3838
fix_custom_request_options(object)
@@ -133,13 +133,20 @@ def build_response_document(object, options)
133133
#
134134
# @api private
135135
def build_collection_result(object, options)
136-
records = build_collection(object, options)
136+
records = build_collection(object, options)
137137
result_options = result_options(object, options)
138138

139139
if related_resource_operation?(options)
140-
source_resource = turn_source_into_resource(options[:source])
140+
source_resource = turn_source_into_resource(options[:source])
141141
relationship_type = get_source_relationship(options)
142-
JSONAPI::RelatedResourcesOperationResult.new(:ok, source_resource, relationship_type, records, result_options)
142+
143+
JSONAPI::RelatedResourcesOperationResult.new(
144+
:ok,
145+
source_resource,
146+
relationship_type,
147+
records,
148+
result_options
149+
)
143150
else
144151
JSONAPI::ResourcesOperationResult.new(:ok, records, result_options)
145152
end

lib/jsonapi/utils/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module JSONAPI
22
module Utils
3-
VERSION = '0.7.2'.freeze
3+
VERSION = '0.7.3'.freeze
44
end
55
end

spec/support/controllers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def index
1414
jsonapi_render json: @user.posts, options: { count: 100 }
1515
end
1616

17-
# GET /users/:user_id//index_with_hash
17+
# GET /users/:user_id/index_with_hash
1818
def index_with_hash
1919
@posts = { data: [
2020
{ id: 1, title: 'Lorem Ipsum', body: 'Body 4' },

0 commit comments

Comments
 (0)