Skip to content

Releases: jsmestad/jsonapi-consumer

Thread-safe custom headers for Rails users

05 Jun 17:20
Compare
Choose a tag to compare

The changes are not expected to impact users of v1.x, but since it's technically changing the API v2.x is appropriate.

Enhancements

  • Allow message to be passed in when raising any JSONAPI::Consumer::Error class.
    • This is handy when a client wants to re-raise an error with additional information.
  • Remove all Object#send in favor of the "more secure" Object#public_send

Bugfixes

  • Custom Headers will now work correctly with threaded servers such as Puma or Unicorn thanks to the added request_store dependency.
  • A custom_method will now obey Resource#route_formatter setting when generating custom endpoint paths.
    • For example: custom_endpoint :publish_now, on: :member, request_method: :post will now generate http://example.com/countries/1/publish-now when route_formatter is set to :dasherized_route

Bugfix for class_attribute not defined

13 Apr 20:24
Compare
Choose a tag to compare

Bugfixes

  • class_attribute needs to be included from ActiveSupport before trying to call it inside Paginator class.

v1.0.0

13 Apr 19:21
Compare
Choose a tag to compare

Changes

Performance

Dynamic attribute definitions improvement (PR JsonApiClient/json_api_client#281)

Before:

       user     system      total        real
read:   1.090000   0.010000   1.100000 (  1.091464)
write:  1.130000   0.000000   1.130000 (  1.136750)

After:

       user     system      total        real
read:   0.020000   0.000000   0.020000 (  0.016366)
write:  0.690000   0.000000   0.690000 (  0.687914)

Features

  • Return a QueryBuilder from HasMany associations instead of an Array (PR JsonApiClient/json_api_client#274 and Issue JsonApiClient/json_api_client#270)
  • Support for custom header inheritance (PR JsonApiClient/json_api_client#280)
  • Add Authorization helpers to base Resource:
    • JSONAPI::Consumer::Resource.authorize_with= sets Authorization=Bearer #{val} header
    • JSONAPI::Consumer::Resource.authorize_with(jwt, &block) same as above, but for only a single request.
    • JSONAPI::Consumer::Resource.authorized? returns true/false if Authorization is not empty
    • JSONAPI::Consumer::Resource.clear_authorization! clears the Authorization header
    • JSONAPI::Consumer::Resource.authorized_as returns the Authorization header

Bugfixes