gmoney 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +26 -24
- data/gmoney.gemspec +3 -3
- data/lib/gmoney.rb +1 -1
- data/lib/gmoney/portfolio.rb +1 -1
- data/lib/gmoney/position.rb +3 -3
- data/lib/gmoney/transaction.rb +1 -1
- data/spec/portfolio_spec.rb +2 -2
- data/spec/position_spec.rb +4 -4
- data/spec/transaction_spec.rb +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -9,59 +9,61 @@ A gem for interacting with the Google Finance API
|
|
9
9
|
== Usage
|
10
10
|
|
11
11
|
Login
|
12
|
-
|
12
|
+
|
13
13
|
|
14
14
|
GMoney::GFSession.login('google username', 'password')
|
15
15
|
|
16
16
|
Portfolios
|
17
|
-
|
17
|
+
|
18
18
|
|
19
19
|
Reading
|
20
|
-
|
21
|
-
|
20
|
+
portfolios = GMoney::Portfolio.all #returns all of a users portfolios
|
21
|
+
portfolio = GMoney::Portfolio.find(9) #returns a specific portfolio
|
22
22
|
|
23
|
-
|
23
|
+
positions = portfolio.positions #returns an Array of the Positions held within a given portfolio
|
24
24
|
|
25
25
|
Deleting
|
26
|
-
|
26
|
+
GMoney::Portfolio.delete 2
|
27
27
|
|
28
28
|
or
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
portfolio = GMoney::Portfolio.find 2
|
31
|
+
portfolio.delete #call delete on an instance of a portfolio
|
32
32
|
|
33
33
|
|
34
34
|
Positions
|
35
|
-
--------
|
36
35
|
|
37
|
-
|
38
|
-
|
36
|
+
|
37
|
+
Reading
|
38
|
+
positions = GMoney::Position.find(9) #returns all of a users positions within a given portfolio, i.e. Portfolio "9"
|
39
|
+
position = GMoney::Position.find("9/NASDAQ:GOOG") #returns a specific position within a given portfolio
|
39
40
|
|
40
|
-
|
41
|
+
transactions = position.transactions #returns an Array of the Transactions within a given position
|
41
42
|
|
42
43
|
Deleting
|
43
|
-
|
44
|
+
GMoney::Position.delete '2/NASDAQ:GOOG'
|
44
45
|
|
45
46
|
or
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
position = GMoney::Position.find '2/NASDAQ:GOOG'
|
49
|
+
position.delete #call delete on an instance of a position
|
49
50
|
|
50
51
|
Transactions
|
51
|
-
--------
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
|
54
|
+
Reading
|
55
|
+
transactions = GMoney::Transaction.find("9/NASDAQ:GOOG") #returns all of a users transactions within a given position
|
56
|
+
transaction = GMoney::Transaction.find("9/NASDAQ:GOOG/2") #returns a specific transaction within a given position
|
55
57
|
|
56
58
|
Deleting
|
57
|
-
|
59
|
+
GMoney::Transaction.delete '2/NASDAQ:GOOG/1'
|
58
60
|
|
59
61
|
or
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
+
transaction = GMoney::Transaction.find '2/NASDAQ:GOOG/1'
|
64
|
+
transaction.delete #call delete on an instance of a transaction
|
63
65
|
|
64
|
-
|
66
|
+
|
65
67
|
|
66
68
|
Options parameter
|
67
69
|
|
@@ -79,8 +81,8 @@ Options parameter
|
|
79
81
|
all take a hash as an optional last parameter. Valid values for this hash are:
|
80
82
|
|
81
83
|
* :returns - By default Google does not return a comprehensive list of returns data. Set this parameter to true to access this information.
|
82
|
-
* :refresh - GMoney caches the data returned from Google by default. Set :refresh
|
83
|
-
* :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
|
84
|
+
* :refresh - GMoney caches the data returned from Google by default. Set :refresh to true if you would like to get the latest data.
|
85
|
+
* :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
|
84
86
|
|
85
87
|
== License
|
86
88
|
|
data/gmoney.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gmoney}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Justin Spradlin"]
|
9
|
-
s.date = %q{2009-11-
|
9
|
+
s.date = %q{2009-11-14}
|
10
10
|
s.description = %q{A gem for interacting with the Google Finance API}
|
11
11
|
s.email = %q{jspradlin@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/extensions/fixnum.rb", "lib/extensions/string.rb", "lib/gmoney.rb", "lib/gmoney/authentication_request.rb", "lib/gmoney/feed_parser.rb", "lib/gmoney/gf_request.rb", "lib/gmoney/gf_response.rb", "lib/gmoney/gf_service.rb", "lib/gmoney/gf_session.rb", "lib/gmoney/portfolio.rb", "lib/gmoney/portfolio_feed_parser.rb", "lib/gmoney/position.rb", "lib/gmoney/position_feed_parser.rb", "lib/gmoney/transaction.rb", "lib/gmoney/transaction_feed_parser.rb"]
|
13
13
|
s.files = ["Manifest", "README.rdoc", "Rakefile", "gmoney.gemspec", "lib/extensions/fixnum.rb", "lib/extensions/string.rb", "lib/gmoney.rb", "lib/gmoney/authentication_request.rb", "lib/gmoney/feed_parser.rb", "lib/gmoney/gf_request.rb", "lib/gmoney/gf_response.rb", "lib/gmoney/gf_service.rb", "lib/gmoney/gf_session.rb", "lib/gmoney/portfolio.rb", "lib/gmoney/portfolio_feed_parser.rb", "lib/gmoney/position.rb", "lib/gmoney/position_feed_parser.rb", "lib/gmoney/transaction.rb", "lib/gmoney/transaction_feed_parser.rb", "spec/authentication_request_spec.rb", "spec/fixtures/cacert.pem", "spec/fixtures/default_portfolios_feed.xml", "spec/fixtures/empty_portfolio_feed.xml", "spec/fixtures/portfolio_9_feed.xml", "spec/fixtures/portfolio_feed_with_returns.xml", "spec/fixtures/position_feed_for_9_GOOG.xml", "spec/fixtures/positions_feed_for_portfolio_14.xml", "spec/fixtures/positions_feed_for_portfolio_9.xml", "spec/fixtures/positions_feed_for_portfolio_9r.xml", "spec/fixtures/transaction_feed_for_GOOG_1.xml", "spec/fixtures/transactions_feed_for_GOOG.xml", "spec/gmoney_spec.rb", "spec/portfolio_feed_parser_spec.rb", "spec/portfolio_spec.rb", "spec/position_feed_parser_spec.rb", "spec/position_spec.rb", "spec/request_spec.rb", "spec/response_spec.rb", "spec/service_spec.rb", "spec/session_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "spec/transaction_feed_parser_spec.rb", "spec/transaction_spec.rb"]
|
14
14
|
s.homepage = %q{http://github.com/jspradlin/gmoney}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gmoney", "--main", "README.rdoc"]
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gmoney", "--main", "README.rdoc~"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{gmoney}
|
18
18
|
s.rubygems_version = %q{1.3.4}
|
data/lib/gmoney.rb
CHANGED
@@ -27,7 +27,7 @@ require 'gmoney/transaction'
|
|
27
27
|
require 'gmoney/transaction_feed_parser'
|
28
28
|
|
29
29
|
module GMoney
|
30
|
-
VERSION = '0.2.
|
30
|
+
VERSION = '0.2.1'
|
31
31
|
GF_URL = "https://finance.google.com/finance"
|
32
32
|
GF_FEED_URL = "#{GF_URL}/feeds/default"
|
33
33
|
GF_PORTFOLIO_FEED_URL = "#{GF_FEED_URL}/portfolios"
|
data/lib/gmoney/portfolio.rb
CHANGED
data/lib/gmoney/position.rb
CHANGED
@@ -26,7 +26,7 @@ module GMoney
|
|
26
26
|
delete_position(id)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def delete
|
30
30
|
Position.delete(@id.position_feed_id)
|
31
31
|
freeze
|
32
32
|
end
|
@@ -56,9 +56,9 @@ module GMoney
|
|
56
56
|
begin
|
57
57
|
trans = Transaction.find("#{id.portfolio_id}/#{id.position_id}")
|
58
58
|
if trans.class == Transaction
|
59
|
-
trans.
|
59
|
+
trans.delete
|
60
60
|
else
|
61
|
-
trans.each {|t| t.
|
61
|
+
trans.each {|t| t.delete }
|
62
62
|
end
|
63
63
|
rescue Transaction::TransactionRequestError => e
|
64
64
|
raise PositionDeleteError, e.message
|
data/lib/gmoney/transaction.rb
CHANGED
data/spec/portfolio_spec.rb
CHANGED
@@ -105,7 +105,7 @@ describe GMoney::Portfolio do
|
|
105
105
|
GMoney::Portfolio.delete(19).should be_nil
|
106
106
|
end
|
107
107
|
|
108
|
-
it "should delete portfolios by calling
|
108
|
+
it "should delete portfolios by calling delete on an instance of a portfolio" do
|
109
109
|
@gf_request = GMoney::GFRequest.new(@url)
|
110
110
|
@gf_request.method = :delete
|
111
111
|
|
@@ -117,7 +117,7 @@ describe GMoney::Portfolio do
|
|
117
117
|
|
118
118
|
portfolio_delete_helper("#{@url}/24")
|
119
119
|
|
120
|
-
portfolio_return = portfolio.
|
120
|
+
portfolio_return = portfolio.delete
|
121
121
|
portfolio_return.should be_eql(portfolio)
|
122
122
|
portfolio_return.frozen?.should be_true
|
123
123
|
end
|
data/spec/position_spec.rb
CHANGED
@@ -110,7 +110,7 @@ describe GMoney::Position do
|
|
110
110
|
GMoney::Position.delete('9/NASDAQ:GOOG').should be_nil
|
111
111
|
end
|
112
112
|
|
113
|
-
it "should delete positions when calling
|
113
|
+
it "should delete positions when calling delete on an instance of a position" do
|
114
114
|
position = GMoney::Position.new
|
115
115
|
position.instance_variable_set("@id", "#{@url}/NASDAQ:GOOG")
|
116
116
|
|
@@ -119,7 +119,7 @@ describe GMoney::Position do
|
|
119
119
|
|
120
120
|
position_delete_helper('9/NASDAQ:GOOG')
|
121
121
|
|
122
|
-
position_return = position.
|
122
|
+
position_return = position.delete
|
123
123
|
position_return.should be_eql(position)
|
124
124
|
position_return.frozen?.should be_true
|
125
125
|
end
|
@@ -157,9 +157,9 @@ describe GMoney::Position do
|
|
157
157
|
GMoney::Transaction.should_receive(:find).with(id).and_return(@trans)
|
158
158
|
|
159
159
|
if @trans.class == GMoney::Transaction
|
160
|
-
@trans.should_receive(:
|
160
|
+
@trans.should_receive(:delete)
|
161
161
|
else
|
162
|
-
@trans.each {|t| t.should_receive(:
|
162
|
+
@trans.each {|t| t.should_receive(:delete)}
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
data/spec/transaction_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe GMoney::Transaction do
|
|
55
55
|
GMoney::Transaction.delete('9/NASDAQ:GOOG/24').should be_nil
|
56
56
|
end
|
57
57
|
|
58
|
-
it "should delete transactions when calling
|
58
|
+
it "should delete transactions when calling delete on an instance of a transaction" do
|
59
59
|
@gf_request = GMoney::GFRequest.new("#{@url}/21")
|
60
60
|
@gf_request.method = :post
|
61
61
|
|
@@ -67,7 +67,7 @@ describe GMoney::Transaction do
|
|
67
67
|
|
68
68
|
transaction_delete_helper("#{@url}/21")
|
69
69
|
|
70
|
-
transaction_return = transaction.
|
70
|
+
transaction_return = transaction.delete
|
71
71
|
transaction_return.should be_eql(transaction)
|
72
72
|
transaction_return.frozen?.should be_true
|
73
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmoney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Spradlin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-14 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -93,7 +93,7 @@ rdoc_options:
|
|
93
93
|
- --title
|
94
94
|
- Gmoney
|
95
95
|
- --main
|
96
|
-
- README.rdoc
|
96
|
+
- README.rdoc~
|
97
97
|
require_paths:
|
98
98
|
- lib
|
99
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|