Prev | Current Page 240 | Next

David Berube

"Practical Reporting with Ruby and Rails"

If you don??™t have a Fidelity account or would prefer to use other data, you
can download a sample file from the Source/Downloads area of the Apress web site
(http://www.apress.com) or http://rubyreporting.com/examples/example_fidelity.csv.
Creating an XML Server with Mongrel
To create the server, you need three gems installed: mongrel, fastercsv, and remarkably.
FasterCSV, introduced in Chapter 7, is a fast CSV-parsing library for Ruby. Remarkably is
a library designed to help you output XML using Ruby code. It??™s loosely based on the
Markaby library, which was also introduced in Chapter 7. You can install the gems as
follows:
gem install -y mongrel fastercsv remarkably
Then create the XML server script shown in Listing 9-1.
Listing 9-1. Fidelity Investments XML Loader and Server (xml_server.rb)
require 'mongrel'
require 'fastercsv'
require 'remarkably/engines/xml'
CHAPTER 9 n INVESTMENT TRACKING WITH FIDELITY 173
(puts "usage: #{$0} csv_file_1 csv_file_2..."; exit) unless ARGV.length >=1
class StocksList
def initialize
@symbols = [] # Holds our list of symbols
end
def load_csv(files)
valid_symbol_labels = ['Symbol']
files.


Pages:
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
ATB prezenty mieszkania szczecin A*Teens grafika białystok