gmoney 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/Rakefile +1 -1
- data/gmoney.gemspec +3 -3
- data/lib/gmoney.rb +3 -2
- data/lib/gmoney/gf_request.rb +2 -1
- data/lib/gmoney/portfolio.rb +0 -1
- data/spec/portfolio_spec.rb +3 -3
- data/spec/request_spec.rb +1 -1
- data/spec/service_spec.rb +2 -1
- data/spec/transaction_spec.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -82,6 +82,9 @@ Transactions
|
|
82
82
|
> transaction.price = 3.50
|
83
83
|
> transaction.save #returns transaction object
|
84
84
|
|
85
|
+
Note: While updating transactions it is not possible to change the portfolio or ticker property as these values are used
|
86
|
+
by Google to identify specific transactions.
|
87
|
+
|
85
88
|
Deleting
|
86
89
|
> GMoney::Transaction.delete '2/NASDAQ:GOOG/1'
|
87
90
|
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ desc "Gemify GMoney"
|
|
20
20
|
namespace :gemify do
|
21
21
|
Echoe.new('gmoney', GMoney.version) do |p|
|
22
22
|
p.description = "A gem for interacting with the Google Finance API"
|
23
|
-
p.url = "http://
|
23
|
+
p.url = "http://www.justinspradlin.com/programming/introducing-gmoney-a-rubygem-for-interacting-with-the-google-finance-api/"
|
24
24
|
p.author = "Justin Spradlin"
|
25
25
|
p.email = "jspradlin@gmail.com"
|
26
26
|
p.ignore_pattern = ["coverage/*", "*~"]
|
data/gmoney.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gmoney}
|
5
|
-
s.version = "0.4.
|
5
|
+
s.version = "0.4.3"
|
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{2010-
|
9
|
+
s.date = %q{2010-03-02}
|
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/nil_class.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/nil_class.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/new_portfolio_feed.xml", "spec/fixtures/new_transaction_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/fixtures/updated_portfolio_feed.xml", "spec/gmoney_spec.rb", "spec/nil_class_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
|
-
s.homepage = %q{http://
|
14
|
+
s.homepage = %q{http://www.justinspradlin.com/programming/introducing-gmoney-a-rubygem-for-interacting-with-the-google-finance-api/}
|
15
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}
|
data/lib/gmoney.rb
CHANGED
@@ -28,10 +28,11 @@ require 'gmoney/transaction'
|
|
28
28
|
require 'gmoney/transaction_feed_parser'
|
29
29
|
|
30
30
|
module GMoney
|
31
|
-
VERSION = '0.4.
|
32
|
-
GF_URL = "
|
31
|
+
VERSION = '0.4.3'
|
32
|
+
GF_URL = "http://finance.google.com/finance"
|
33
33
|
GF_FEED_URL = "#{GF_URL}/feeds/default"
|
34
34
|
GF_PORTFOLIO_FEED_URL = "#{GF_FEED_URL}/portfolios"
|
35
|
+
GF_GOOGLE_DATA_VERSION = 2
|
35
36
|
|
36
37
|
HTTPOK = 200
|
37
38
|
HTTPCreated = 201
|
data/lib/gmoney/gf_request.rb
CHANGED
data/lib/gmoney/portfolio.rb
CHANGED
@@ -71,7 +71,6 @@ module GMoney
|
|
71
71
|
|
72
72
|
@currency_code ||= 'USD'
|
73
73
|
|
74
|
-
#Rcov hates multi-line strings and I hate red on my test coverage report.
|
75
74
|
atom_string = "<?xml version='1.0'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gf='http://schemas.google.com/finance/2007' xmlns:gd='http://schemas.google.com/g/2005'><title type='text'>#{title}</title> <gf:portfolioData currencyCode='#{currency_code}'/></entry>"
|
76
75
|
|
77
76
|
url = @id ? @id : GF_PORTFOLIO_FEED_URL
|
data/spec/portfolio_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe GMoney::Portfolio do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
before(:each) do
|
14
|
-
@url =
|
14
|
+
@url = "#{GMoney::GF_URL}/feeds/default/portfolios"
|
15
15
|
|
16
16
|
@gf_request = GMoney::GFRequest.new(@url)
|
17
17
|
@gf_request.method = :get
|
@@ -40,7 +40,7 @@ describe GMoney::Portfolio do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should return a portfolio with returns data is :returns == true" do
|
43
|
-
@url =
|
43
|
+
@url = "#{GMoney::GF_URL}/feeds/default/portfolios?returns=true"
|
44
44
|
@gf_response.body = @feed_with_returns
|
45
45
|
|
46
46
|
portfolios = portfolio_helper(@url, :all, {:returns => true})
|
@@ -158,7 +158,7 @@ describe GMoney::Portfolio do
|
|
158
158
|
|
159
159
|
portfolio_return = portfolio.save
|
160
160
|
|
161
|
-
portfolio_return.id.should be_eql(
|
161
|
+
portfolio_return.id.should be_eql("#{GMoney::GF_URL}/feeds/user@example.com/portfolios/38")
|
162
162
|
portfolio_return.title.should be_eql("New Portfolio")
|
163
163
|
end
|
164
164
|
|
data/spec/request_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe GMoney::GFRequest do
|
|
18
18
|
|
19
19
|
it "should be able to take header parameters as a Hash" do
|
20
20
|
gfrequest_with_header_hash = GMoney::GFRequest.new('http://someurl.com', {:headers => {:header1 => 'some header'}})
|
21
|
-
gfrequest_with_header_hash.headers.should == {:header1 => 'some header'}
|
21
|
+
gfrequest_with_header_hash.headers.should == {:header1 => 'some header', "GData-Version" => 2}
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should not accept random options" do
|
data/spec/service_spec.rb
CHANGED
@@ -74,7 +74,7 @@ describe GMoney::GFService do
|
|
74
74
|
set_url_expectations
|
75
75
|
http = set_http_expectations
|
76
76
|
request = set_request_expecations(class_type)
|
77
|
-
set_header_expectations(request)
|
77
|
+
set_header_expectations(request)
|
78
78
|
res = set_response_expecations
|
79
79
|
|
80
80
|
http.should_receive(:request).with(request).and_return(res)
|
@@ -123,5 +123,6 @@ describe GMoney::GFService do
|
|
123
123
|
def set_header_expectations(req)
|
124
124
|
req.should_receive(:[]=).with(:h1, "header 1").any_number_of_times
|
125
125
|
req.should_receive(:[]=).with(:h2, "header 2").any_number_of_times
|
126
|
+
req.should_receive(:[]=).with("GData-Version", 2).any_number_of_times
|
126
127
|
end
|
127
128
|
end
|
data/spec/transaction_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe GMoney::Transaction do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
before(:each) do
|
11
|
-
@url =
|
11
|
+
@url = "#{GMoney::GF_URL}/feeds/default/portfolios/9/positions/NASDAQ:GOOG/transactions"
|
12
12
|
@transaction_id = '9/NASDAQ:GOOG'
|
13
13
|
|
14
14
|
@gf_request = GMoney::GFRequest.new(@url)
|
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.4.
|
4
|
+
version: 0.4.3
|
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: 2010-
|
12
|
+
date: 2010-03-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -89,7 +89,7 @@ files:
|
|
89
89
|
- spec/transaction_feed_parser_spec.rb
|
90
90
|
- spec/transaction_spec.rb
|
91
91
|
has_rdoc: true
|
92
|
-
homepage: http://
|
92
|
+
homepage: http://www.justinspradlin.com/programming/introducing-gmoney-a-rubygem-for-interacting-with-the-google-finance-api/
|
93
93
|
licenses: []
|
94
94
|
|
95
95
|
post_install_message:
|