diff --git a/lib/calendly/models/model_utils.rb b/lib/calendly/models/model_utils.rb index eeaa358..0090dec 100644 --- a/lib/calendly/models/model_utils.rb +++ b/lib/calendly/models/model_utils.rb @@ -13,6 +13,7 @@ module ModelUtils # @param [Calendly::Client] the api client. def initialize(attrs = nil, client = nil) @client = client + @__data = attrs || {} set_attributes attrs end @@ -47,15 +48,21 @@ def id # @since 0.0.1 def inspect att_info = [] - inspect_attributes.each do |att| + + # Print out all the attributes, showing the key ones (defined in inspect_attributes) first + (inspect_attributes + @__data.keys).uniq.each do |att| next unless respond_to? att att_info << "#{att}=#{send(att).inspect}" end - att_info << '..' + "\#<#{self.class}:#{object_id} #{att_info.join(', ')}>" end + def to_h + @__data + end + module ClassMethods def extract_uuid_match(str) return unless defined? self::UUID_RE