lib/api-client/class_methods.rb in api-client-2.0.0.rc1 vs lib/api-client/class_methods.rb in api-client-2.0.0.rc2

- old
+ new

@@ -1,11 +1,11 @@ module ApiClient # This module handles the logic to make an api call and initialize an object with the response. module ClassMethods # Initialize an object based on a hash of attributes. # - # @param [Hash] attributes hash of attributes. + # @param [Hash] params hash of attributes. # @return [Base] the object initialized. def build(params) if params.key?(remote_object) new(params[remote_object].merge(:response => params)) else @@ -23,8 +23,18 @@ url = "#{ApiClient.config.path}#{self.path}" "#{url}/#{id}" unless id.nil? response = ApiClient::Dispatcher.send(method_name.to_sym, url, *args) params = ApiClient::Parser.response(response, url) build(params) + end + + # Overwrite respond_to? default behavior + # + # @param [Symbol] method_name the name of the method. + # @param [Boolean] include_private if it does work to private methods as well. + # @return [Boolean] if it responds to the method or not. + def respond_to_missing?(method_name, include_private = false) + return true if ApiClient::Dispatcher.respond_to?(method_name) + super end end end \ No newline at end of file