Skip to content

Releases: gamache/hyperresource

0.9.4

25 Nov 14:36
Compare
Choose a tag to compare

Fixes reassignment of attributes with nil values.

0.9.3

25 Nov 14:35
Compare
Choose a tag to compare

Fixes handling of empty response body with 204 No Content status.

0.9.2

25 Nov 14:33
Compare
Choose a tag to compare

Add support for embedded resources that contain no "self" link or no "_links" property at all, as permitted by the HAL spec. Fixes issue #29.

0.9.1

25 Nov 14:32
Compare
Choose a tag to compare

Added:

  • Link#headers, for specifying headers to send when fetching a link. These headers will be merged with link.resource.headers.
  • get_response, post_response, put_response, patch_response, and delete_response for obtaining responses as Faraday::Response objects instead of parsing the responses into objects of HyperResource or one of its subclasses.

0.9.0

29 May 20:36
Compare
Choose a tag to compare

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

10 Nov 19:23
Compare
Choose a tag to compare

Added support for CURIE syntax in link rels.