Bugfix:
- Fix not marking unchanged attributes as dirty (thanks to Khairi Adnan for the bug report).
Bugfix:
- Remove deprecation warning for
URI.escape
on Ruby 2.7.x.
Change:
- Unified the response body to be
body
for all exceptions instead of sometimes beingbody
and sometimes beingraw_response
, although both are available as aliases where they were defined before (thanks to Romain Gisiger for the PR). - Adjust parsing of attributes to be done in a more unified way and lighten the CPU load (thanks to Romain Gisiger for the PR)
Bugfix:
- Prevent crash on JSONAPI invalid error response (thanks to François Ferrandis for the PR).
Bugfix:
- Prevent crash when JSONAPI response["data"] is an empty array (thanks to François Ferrandis for the PR).
Bugfix:
- Correctly handle errors in JSONAPI calls (thanks to François Ferrandis for the PR).
Important: Note, because a gem was accidentally pushed as version 1.9.10 instead of 1.9.0, there will be no 1.9.0 to 1.9.9, to reduce the risk of someone having updated to the accidental high version increase. Sorry about that
Feature:
- Adds proc support to api_auth credentials (thanks to David Underwood for the PR).
Fix:
- Use custom type and name for JSON-API fields (thanks to François Ferrandis for the PR).
- Fix Faraday error classes to match current ones in Faraday (thanks to François Ferrandis for the PR).
Fix:
- URL parameters should be automatically required or you end up requesting incorrect URLs (thanks to Marko Kind, @m-kind for the issue).
Fix:
- Correct HTTP status code for too many requests (thanks to Tomohiko Mimura, @mito5525 for spotting this).
Fix:
- Array and Hash parameters should not have their fieldname CGI escaped, Rails doesn't like it and the RFC doesn't require it
Fix:
- Array and Hash parameters should be accepted in
:form_multipart
Fix:
- Missed dependency that should have been specified.
Features:
- Allowed use of
:form_multipart
as arequest_body_type
to allow uploading files to an API.
Features:
- Added a specific
Flexirest::HTTPTooManyRequestsClientException
for 429 errors, to enable easier trapping
Features:
- For the weird situations where the remote API expects some weird formatted input, you can now specify a
request_body_type
of plain and pass in to the callbody
(and optionallycontent_type
) to pass it untouched to the API. The docs have been updated.
Features:
- The
ignore_root
method now can ignore a tree of labels, rather than just one top level (thanks to gkosmr for the issue and pull request)
Fix:
- plain requests to URLs that are just the domain e.g. "https://www.example.com" should also work (i.e. without any trailing path, even a '/')
Change:
- Set the default charset to UTF-8 for form encoded request bodies, the same as it already was for JSON encoded request bodies.
Feature:
- Changed
Flexirest::HTTPException#message
and#to_s
for a better description of the error than just the class name.
Feature:
- Implemented
Flexirest::ResultIterator#join
for closer to native handling of ActiveModel::Errors in Rails applications.
Feature:
- Returning
:retry
or now raisingFlexirest::CallbackRetryRequestException
from a callback will retry the current request.
Bugfix:
- Form encoded requests should also honour
wrap_root
(thanks to noctivityinc for the issue report)
Feature:
- Returning
false
from a callback will halt the callback chain and cancel the request (thanks to noctivityinc for the feature request)
Bugfix:
- JSON responses containing
null
crashed Flexirest, now they return a valid but empty object (thanks to Thomas Steinhausen for the PR)
Bugfix:
- Fixed fetching nested associations from the compound document when using JsonAPI standard requests (thanks to Mike Voets for the PR)
Feature:
- Allows using a Flexirest instance as a hash key (thanks to René from Crete Media Design for the PR)
Feature:
- Empty response bodies with an unparseable content-type are forced to be JSON with an empty JSON body
Feature:
- A refactoring to allow users to chose to use ActiveModel validation instead of the custom ActiveModel-like validation built in to Flexirest. In a future release this will become the default. (thanks to KARASZI István for the pull request)
Bugfix:
- Returning the string value for a field that looks like a Date/DateTime instead of raising an error when the value can't be parsed (thanks to Give Corps for the pull request)
Feature:
- Username and Password can now take a block/proc for dynamically retrieving the username and password, and will pass in the object if called in a current object context (thanks to Sam Starling for suggesting this lack of functionality)
Bugfix:
- Plain requests were having the URL output to the log twice (thanks to Dan W for reporting this)
Feature:
- Added the ability to automatically change attributes returned from an API like
SomeName
orsomeName
to Ruby-stylesome_name
by setting:rubify_names
when mapping an API call.
Bugfix:
- Allowing instantiating a class if mapped request method is called for "JSON-API" functionality (thanks to Mike Voets for this PR).
Feature:
- Added
where
filtering to result iterators (thanks to Jeljer te Wies for the feature).
Feature:
- APIs that expect request bodies to have a wrapping element can now have this specified at mapping time.
Bugfix:
- Added missing
get?
,post?
,put?
anddelete?
methods to request as they were used in the documentation.
Feature:
- Allow retrying after a failure in an
after_request
callback
Bugfix:
- Exceptions don't display a message if no method was set (internal exception?)
Feature:
- Allow deleting of default headers in
before_request
callbacks
Bugfix:
- Fixing already encoded bodies in plain requests
Feature:
- Changing
_request
to accept options, including:headers
, rather than headers directly
Feature:
- Allow passing custom headers as an option to raw requests.
Bugfix:
- Some APIs return an empty response body even on 200s, so any valid status with an empty body should be handled nicely
Bugfix:
- PUT/POST/PATCH methods called on an instantiated object should merge the objects attributes with specified params.
Bugfix:
- GET requests with the same URL as PUT requests shouldn't use the etag cached version.
Bugfix:
- Responses without content (202, 204) will return an empty object.
Bugfix:
- Responses without content (202, 204) will still make the headers available in
_headers
.
Feature:
- You can define how to handle the body of
delete
requests now with the mapping optionsend_delete_body
.
Bugfix:
- DELETE requests shouldn't send a request body, the body semantics are undefined.
Feature:
- Handling 202s without any content the same as a 204.
Feature:
- Added more client exceptions to allow fine grained exception trapping
Bugfix:
- Breakage in path parameters where the value isn't specified
Bugfix:
- Pluses in URL params are now escaped to %2B (thanks to jan-vitek for the bug report and pull request)
Feature:
- New JSON API support - thanks to Mike Voets for all his hard work!
Bugfix:
- Slashes in URL params are now escaped to %2F (thanks to davidtolsma for the bug report)
Feature:
- Added ActiveRecord/Mongoid style dirty/changed tracking methods (thanks to eshork for the PR)
Bugfix:
- Now can disable caching on subclasses after being enabled on a parent (thanks to yujideveloper for the PR)
Feature:
- Allowed specifying custom message for validation failures
Bugfix:
- Rolled back 1.3.31 - was an error in client code
Bugfix:
- Working with later versions of Faraday where the response seems to have lost response_headers
Bugfix:
- Restoring cached Flexirest::ResultIterators created via a Proxy wasn't restoring correctly
Bugfix:
- Setting
perform_caching
onFlexirest::Base
was being ignored
Feature:
- Implemented delete_if on ResultIterator
Bugfix:
- HTTP GET requests shouldn't send any body, JSON-encoded or otherwise
Bugfix:
- Parameters sent within the URL (e.g. /foo/:bar) should be URI escaped or Flexirest raises an error about unparseable URLs
Feature:
- Improvements in performance due to date parsing (thanks to guanglunw for the PR)
Bugfix:
- Calling class methods on an instance where the instance is cacheable should work (thanks to johnmckinght for the bug report)
Bugfix:
- Should not parse multiline strings as
DateTime
when using the automatica parsing (thanks to execjosh for the PR)
Bugfix:
- Broke a test in v1.3.21 (according to Travis) which was passing locally, updated all my gems and then it broke locally, so reverted the test.
Feature:
- Now any requests returning a 204 with an empty (nil or blank) body return true instead of raising a ParseException
Bugfix:
- Fixed
has_one
association raising an error if there is no associated object (it should just returnnil
) (thanks to Azat Galikhanov for the PR)
Feature:
- Added Headers in to Flexirest::ResponseParseException to aid debugging of why it doesn't work against custom APIs.
Feature:
- Simplistic load balancing of API servers by supplying an array of URLs to
base_url
. It then pulls a random one out for each request.
Bugfix:
- Authentication credentials weren't being passed through proxied classes (thanks to Lukasz Modlinski for the contribution).
Feature:
- Allows disabling of the automatic date parsing with the
Flexirest::Base.disable_automatic_date_parsing
setting and/or specifying it per mapped method with the:parse_fields
option (thanks to Michael Mealling for the request).
Feature:
- Allows setting of the ApiAuth
:digest
or:override_http_method
if v2.0 or above of ApiAuth is installed (thanks to Alan Ruth for the request).
Feature:
- Plain Requests (both using the
plain: true
option to mapped methods and using_plain_request
) return aFlexirest::PlainResponse
which is string-like for all intents and purposes (it's comparable with strings using the body of the response) and also has_status
and_headers
methods (thanks to Rui Ribeiro for the request/inspiration).
Feature:
- The undocumented
plain: true
option to mapped methods was tested and documented.
Bugfix:
- The Travis build was breaking because Guard pulls in Listen, which only runs on Ruby 2.2 and above. So I removed Guard so the gem can be tested to work against older Ruby versions still.
Feature:
- Made the
Flexirest::*Exception#message
much nicer to help debugging applications, e.g.Sending PUT to '/enable' returned a 500 with the body of - {"error":"John doesn't exist", "code":1234}
.
Feature:
- Added per-request params encoding so you can choose between
param[]=foo¶m[]=bar
orparam=foo¶m=bar
(thanks to bkubic for the PR).
Feature:
- Proxying now works for PATCH requests, along with the existing GET, POST, PUT and DELETE (thanks to Andrew Schaper for the PR).
Bugfix:
- Fixing crash when trying to parse a JSON response body for error codes and no translator present.
Bugfix:
- Removed some more warnings about using uninitialized variables (thanks to Joel Low for the heads-up).
Bugfix:
- Removed some warnings about using uninitialized variables (thanks to Joel Low for the heads-up).
Bugfix:
- Deeply nested has_many relationships weren't working (thanks to Lewis Buckley for the bug report, spec and fix).
Features:
- Allows assigning
STDOUT
toFlexirest::Logger.logfile
which can be useful when debugging Flexirest or applications at the console (eitherrails console
from a Rails app orrake console
from within Flexirest's codebase) along with settingverbose!
on the class.
Features:
- New Ruby on Rails integration guide (thanks to Matthias Neumayr)
- New
ignore_root
method to ignore JSON or XML root nodes, deprecatedignore_xml_root
(thanks to dsarhadian for the request)
Features:
- Allow setting the body for a delete request - whether this is within HTTP spec is dubious, but a few APIs require it (thanks to Jeffrey Gu)
Features:
- You can now use
has_many
/has_one
on the class live, more like ActiveRecord
Features:
- Allow a custom name to be set to be used in logging (thanks to Lewis Buckley)
Features:
- Allow procs in defaults to be able to use params (for Michael Mealling)
Features:
- Allow
nil
option in validators (thanks to Jurgen Jocubeit) - Added array feature for returning simple scalar values (thanks to Jurgen Jocubeit)
Bugfixes:
- Corrected parsing of dates/datetimes coming in responses (thanks to Matthias Neumayr)
Feature:
- Replaces URL
:keyed
parameters for direct requests.
Feature:
- Fixing issue when moving from ActiveRestClient to Flexirest - cached responses have the old class in them, so come through as a String
Bugfixes:
- Patch was partially implemented in 2014, but never completed. It should be working now (thanks to Joel Low)
Bugfixes:
- Putting README.md back the way it was regarding ApiAuth (thanks to Kevin Glowacz)
Bugfixes:
- Correcting README.md to make ApiAuth usage clearer (thanks to Jeffrey Gu)
Bugfixes:
- Fixes the usage of :timeout on a per-request basis
Bugfixes:
- Changes the date regexes to not misinterpret strings of 8 digits to be dates (thanks Tom Hoen)
Bugfixes:
- Fixing messages used during validation of maximum numericality (thanks Tom Hoen)
Bugfixes:
- There was a strange problem with Flexirest defining methods on
Class
rather than on the specific class (which only presents itself when another class in the application is making use ofmethod_missing
).
Features:
- Adds a per request
timeout
option, for individually slow calls
Bugfixes:
- Fixes case when
Rails
exists but doesn't declare a.cache
method
Bugfixes:
- Allows setting of
base_url
,username
,password
andrequest_body_type
in a project-specific base class, then using that default in subclasses. - Strings of four digits in the response are no longer treated as (invalid) dates (thanks Tom Hoen)
- 1.2.3 was pushed without a successful Travis build
Features:
- Adds
existence
,numericality
,presence
andinclusion
validations (thanks Tom Hoen) - Adds
full_error_messages
method (thanks Tom Hoen) - Adds
requires
options to the method mapping
Forked Which's ActiveRestClient to be Flexirest
Features:
- Allows for beta-support for XML APIs as well as JSON ones.
Bugfixes:
- In order to allow JRuby to work with Flexirest, the hard-coded dependency on Patron has been removed.
Features:
- Parallel requests can now be made
Bugfixes
- Some work around Faraday's weird method naming
- Start of XML support
- URL encoding username and password
Bugfixes
- Correctly handling invalid cache expiry times
Features:
- Added Api-Auth for authentication against APIs that use it
- Supporting array parameter types
- Relationships for 'has_one' can now be used