lib/unsplash/client.rb in unsplash-1.3.1 vs lib/unsplash/client.rb in unsplash-1.4.0

- old
+ new

@@ -2,11 +2,11 @@ # Common functionality across Unsplash API objects. class Client # Build an Unsplash object with the given attributes. - # @param attrs [Hash] + # @param attrs [Hash] def initialize(attrs = {}) @attributes = OpenStruct.new(attrs) end # (Re)load full object details from Unsplash. @@ -21,19 +21,20 @@ end end # @private def method_missing(method, *args, &block) - @attributes.send(method, *args, &block) + attribute = @attributes.send(method, *args, &block) + attribute.is_a?(Hash) ? Client.new(attribute) : attribute end # The connection object being used to communicate with Unsplash. # @return [Unsplash::Connection] the connection def connection self.class.connection end - class << self + class << self # The connection object being used to communicate with Unsplash. # @return [Unsplash::Connection] the connection def connection @@connection ||= Connection.new end \ No newline at end of file