Releases: gamache/hyperresource
Releases · gamache/hyperresource
0.9.4
0.9.3
0.9.2
0.9.1
Added:
Link#headers
, for specifying headers to send when fetching a link. These headers will be merged withlink.resource.headers
.get_response
,post_response
,put_response
,patch_response
, anddelete_response
for obtaining responses asFaraday::Response
objects instead of parsing the responses into objects ofHyperResource
or one of its subclasses.
0.9.0
The release of 0.9 represents a significant jump in quality and completeness from 0.2.x. The interface to HyperResource is largely solidified, and the internal and user-facing code has been significantly improved since earlier versions.
Changes from 0.2:
- Automatic method creation doesn't happen anymore.
method_missing
now handles all method calls for link, object, and attribute names. Creating instance methods on the resource's class was error-prone, it could violate the principle of HATEOAS by misleading the end user about links or attributes or objects that don't exist on a particular resource, and most egregiously of all, it completely busts Ruby's method resolution cache, causing absolutely all method calls to incur a ~1ms penalty the first time they're called after the cache is cleared.method_missing
has always done a fine job; removing_hr_create_methods!
improves real world performance and simplifies the HR code. - Resource instantiation is cleaner. Previously, calling an HTTP method on a HyperResource would change its state, then return a different object. Now HTTP is delegated to Link objects, and HyperResource#to_link handles instantiating a link from a resource (in the background, of course). The resulting logic is cleaner, inheritance is easier to track, and object state is easier to comprehend.
- #create and #update are deprecated. Just use #post, #put, or #patch.
- Introducing hostmasked config variables. HyperResource 0.9 adds the feature that configuration parameters (namespace, auth, header, faraday_options, and default_attributes) can now be scoped by hostmask. This opens the way for seamless integration with an ecosystem of separate APIs which point to each others' resources (well... seamless for the client, anyway). Look at
test/live/two_server_test.rb
to see what it's all about.
(Side note: the hostmasking logic became heavy enough that I spun it out into its own gem, FuzzyURL. Check it out if you like non-strict URL parsing, construction, or wildcard matching.)
release v0.2.1
Added support for CURIE syntax in link rels.