def initialize_from_response_data # :nodoc:
        run_callbacks :initialize_from_response_data do
          self.class.attribute_options_including_superclasses.each do |name, options|
            value = if options[:type] == :key
              self[name].blank? ? options[:default] : self[name]
            elsif options[:type] == :one
              hash = self[name.to_s]
              hash && hash['@type'] ? self.class.new_from_response_data(hash) : nil
            elsif options[:type] == :many
              response_data[name] && response_data[name].map{|hash| self.class.new_from_response_data(hash)} || []
            else
              raise "Invalid type: #{options[:type]}"
            end

            send("#{name}=", value)
          end
        end
      end
def initialize_from_response_data # :nodoc:
        run_callbacks :initialize_from_response_data do
          self.class.attribute_options_including_superclasses.each do |name, options|
            value = if options[:type] == :key
              self[name].blank? ? options[:default] : self[name]
            elsif options[:type] == :one
              hash = self[name.to_s]
              hash && hash['@type'] ? self.class.new_from_response_data(hash) : nil
            elsif options[:type] == :many
              response_data[name] && response_data[name].map{|hash| self.class.new_from_response_data(hash)} || []
            else
              raise "Invalid type: #{options[:type]}"
            end

            send("#{name}=", value)
          end
        end
      end
Iterate over the response data and initialize the attributes