Class: YoutrackOnRails::Responses::CollectionResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/youtrack_on_rails/responses/collection_response.rb

Direct Known Subclasses

ListProjects

Constant Summary

Constants inherited from Base

Base::SUCCESSFUL_RESPONSE_CODES

Instance Attribute Summary

Attributes inherited from Base

#code, #http_response, #xml

Instance Method Summary collapse

Methods inherited from Base

#cookie, #errors, #initialize, #success?

Constructor Details

This class inherits a constructor from YoutrackOnRails::Responses::Base

Instance Method Details

#processObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/youtrack_on_rails/responses/collection_response.rb', line 4

def process
  xml.xpath('//projects/project').map do |project_node|
    @attributes ||= project_node.attributes.keys

    hash = @attributes.each_with_object({}) do |attribute_key, hash|
      hash[attribute_key.underscore] = project_node[attribute_key]
    end

    Dish(hash)
  end
end