GMoney

A gem for interacting with the Google Finance API

Install

gem install gmoney

Usage

Login

GMoney::GFSession.('google username', 'password')

Portfolios

Reading
  portfolios = GMoney::Portfolio.all #returns all of a users portfolios
  portfolio = GMoney::Portfolio.find(9) #returns a specific portfolio

  positions = portfolio.positions #returns an Array of the Positions held within a given portfolio

Deleting
  GMoney::Portfolio.delete 2

  or

  portfolio = GMoney::Portfolio.find 2
  portfolio.delete #call delete on an instance of a portfolio

Positions

Reading
  positions = GMoney::Position.find(9) #returns all of a users positions within a given portfolio, i.e. Portfolio "9"
  position = GMoney::Position.find("9/NASDAQ:GOOG") #returns a specific position within a given portfolio

  transactions = position.transactions #returns an Array of the Transactions within a given position

Deleting
  GMoney::Position.delete '2/NASDAQ:GOOG'

  or

  position = GMoney::Position.find '2/NASDAQ:GOOG'
  position.delete #call delete on an instance of a position

Transactions

Reading
  transactions = GMoney::Transaction.find("9/NASDAQ:GOOG") #returns all of a users transactions within a given position
  transaction = GMoney::Transaction.find("9/NASDAQ:GOOG/2") #returns a specific transaction within a given position

Deleting
  GMoney::Transaction.delete '2/NASDAQ:GOOG/1'

  or

  transaction = GMoney::Transaction.find '2/NASDAQ:GOOG/1'
  transaction.delete #call delete on an instance of a transaction

Options parameter

The following methods:
  Portfolio.all
  Portfolio.find
  portfolio.positions #where portfolio is an instance of the Portfolio class

  Position.find
  position.transactions #where position is an instance of the Position class

  Transaction.find

all take a hash as an optional last parameter.  Valid values for this hash are:

* :returns - By default Google does not return a comprehensive list of returns data.  Set this parameter to true to access this information.
* :refresh - GMoney caches the data returned from Google by default.  Set :refresh to true if you would like to get the latest data.
* :eager - GMoney lazily loads children data (i.e. positions for a given Portfolio).  If you would like to load all of this data at once set :eager to true

License

(The MIT License)

Copyright © 2009 Justin Spradlin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.