Sha256: 664691e46a108718e10d5c21b33cfdfc70c19f2c51c7a5b70c98351d6e2decfc

Contents?: true

Size: 779 Bytes

Versions: 20

Compression:

Stored size: 779 Bytes

Contents

# Add Ruport (http://rubyreports.org/) support to the RallyRestAPI.
# This will add a method, #to_table, to QueryResult
#
# For example:
#  table = rally_api.find(:defect) { equal :state, "Open" }.to_table([:formatted_i_d, :name, :owner])
#  table.to_pdf
#

# Ruport can deal with anything that has a #to_hash
class RestObject
  def to_hash # :nodoc
    elements
  end
end

class QueryResult
  # return a Ruport::Data::Table. Takes an array of columns for the report
  #    defects = rally.find(:defect, :fetch => true) { equal :state, "Open }
  #    table = defects.to_table([:name, :severity, :priority, :owner])
  #    table.to_pdf
  def to_table(columns = [])
    table = Ruport::Data::Table.new(:column_names => columns)
    self.each { |i| table << i }
    table
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rally_rest_api-1.1.0 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.6 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.5 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.4 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.3 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.2 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.1 lib/rally_rest_api/ruport.rb
rally_rest_api-0.9.0 lib/rally_rest_api/ruport.rb
rally_rest_api-1.0.0 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.1 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.3 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.2 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.10 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.7 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.4 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.5 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.8 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.6 lib/rally_rest_api/ruport.rb
rally_rest_api-0.7.9 lib/rally_rest_api/ruport.rb
rally_rest_api-0.8.0 lib/rally_rest_api/ruport.rb