Skip to content

Releases: Manfred/Reynard

v0.10.0

07 Aug 13:07
f21309f
Compare
Choose a tag to compare
  • Updates model naming to reduce the changes of model name collisions
  • Increases the minimal supported Ruby version to 3.1

Upgrade notes

Model naming has been changed slightly so if you take advantage of shadow definiting certain models (ie. if your code defines anything in Reynard::Models), you may have to rename that model to make it match the new model naming rules.

v0.9.0

28 Feb 09:03
9d87f8d
Compare
Choose a tag to compare
  • Make Reynard::Model a subclass of BasicObject so we get less in the way of potential attribute names like display.
  • Added Model#empty? for testing if the attributes are empty.
  • Improved error message when Reynard model is instantiated with an array instead of a hash.

v0.8.2

26 Jul 09:28
abb8ae4
Compare
Choose a tag to compare
  • Return nil when attempting to cast a nil value for an attribute with an object in the schema.
  • Raise a more useful exception when attempting to build an object with a nil value.

v0.8.1

14 Jul 08:20
13a406f
Compare
Choose a tag to compare
  • Fix: allow model attributes to be false or nil

v0.8.0

07 Jul 10:53
c7bbdd1
Compare
Choose a tag to compare
  • Property values from a payload are now stored as a Hash in the model instance to support multiple access methods.
  • Added an inflector so properties which don't use snake_case like firstName can now be accessed through the first_name method.
  • Added a way to register irregular snake-cases with the inflector, for example: reynard.snake_cases({ '1st-class' => 'first_class' }). This particular example allows the 1st-class property on a model to be accessed through the first_class method. See the README for more examples and details.

Upgrade notes

It's possible that Reynard now throws a NoMethodError where it previously returned nil, this may be caused by the fact that the payload is missing an optional value. You can either use try(:method_name) in Ruby on Rails, check if the attribute is accessible with respond_to?(:method_name) or use the [] accessor ["method_name"], note that you probably have to use a string in the last example.

v0.7.0

28 Mar 14:09
a84b31f
Compare
Choose a tag to compare
  • Revert some changes to syntax to go back to supporting Ruby 3.0.

v0.6.0

24 Nov 14:19
21e4223
Compare
Choose a tag to compare
  • Added Reynard::Http::Response#parsed_body so consumers don't have to parse response bodies to access the raw data.
  • Added status accessors to Reynard::Http::Response, accessors are: informational?, success?, redirection?, client_error?, and server_error?. These test respectively for 1xx, 2xx, 3xx, 4xx, and 5xx response codes.
  • Changed Reynard::ObjectBuilder to build instantiated models based on schemas in the specification and support nested resources.

Upgrade notes

If you are already using Reynard::Http::Response#object for responses that aren't just one deep arrays or objects you will notice that propery accesors will now return Reynard::Model instances instead of of Hash.

For example:

def print_books
  response = request.perform
  return unless response.success

  response.object.books.each do |book|
    puts "#{book.title} (#{book.author.name})"
  end
end