rupee 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rupee/quote.rb +7 -0
- data/lib/rupee/version.rb +1 -1
- data/spec/import/quote_spec.rb +8 -0
- metadata +7 -7
data/lib/rupee/quote.rb
CHANGED
@@ -14,8 +14,10 @@ module Rupee
|
|
14
14
|
# The cached HTML
|
15
15
|
attr :html
|
16
16
|
|
17
|
+
# The frequency in seconds that a quote's information should be updated
|
17
18
|
attr_accessor :frequency
|
18
19
|
|
20
|
+
# The time at which the next pull from the online quote source will occur
|
19
21
|
attr :next_pull
|
20
22
|
|
21
23
|
def initialize(ticker, opts = {})
|
@@ -63,6 +65,11 @@ module Rupee
|
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
68
|
+
def frequency=(x)
|
69
|
+
@next_pull += (x - @frequency)
|
70
|
+
@frequency = x
|
71
|
+
end
|
72
|
+
|
66
73
|
private
|
67
74
|
|
68
75
|
# The URL for Bloomberg's quotes service
|
data/lib/rupee/version.rb
CHANGED
data/spec/import/quote_spec.rb
CHANGED
@@ -18,6 +18,14 @@ describe Rupee::Quote do
|
|
18
18
|
it "should return a price" do
|
19
19
|
@wfc.price.should be_a_kind_of Float
|
20
20
|
end
|
21
|
+
|
22
|
+
it "should reflect changes to frequency in next pull time" do
|
23
|
+
freq_change = 5
|
24
|
+
orig_freq = @wfc.frequency
|
25
|
+
orig_pull = @wfc.next_pull
|
26
|
+
@wfc.frequency -= freq_change
|
27
|
+
@wfc.next_pull.should == orig_pull - freq_change
|
28
|
+
end
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rupee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &79757030 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *79757030
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &79755150 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *79755150
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: autotest
|
38
|
-
requirement: &
|
38
|
+
requirement: &79754560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '4.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *79754560
|
47
47
|
description: rupee aims to provide user-friendly tools for use in financial gems and
|
48
48
|
applications.
|
49
49
|
email:
|