currency 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Releases.txt CHANGED
@@ -1,5 +1,10 @@
1
1
  = Currency Release History
2
2
 
3
+ == Release 0.4.6: 2007/05/29
4
+
5
+ * NewYorkFed: changed FEXtime to FEXTIME.
6
+ * Fixed Rate#collect_rates, source, rate_date_0, rate_date_1.
7
+
3
8
  == Release 0.4.5: 2007/05/29
4
9
 
5
10
  * Historical::Rate table name can be configured in Currency::Config.current.historical_table_name
@@ -1,5 +1,5 @@
1
1
  module Currency
2
- CurrencyVersion = '0.4.5'
2
+ CurrencyVersion = '0.4.6'
3
3
  end
4
4
  # DO NOT EDIT
5
5
  # This file is auto-generated by build scripts.
@@ -115,7 +115,7 @@ class Currency::Exchange::Rate
115
115
  end
116
116
 
117
117
 
118
- # Collect rate samples into rate_avg, rate_hi, rate_lo, rate_0, rate_1, date_0, date_1.
118
+ # Collect rate samples into rate_avg, rate_hi, rate_lo, rate_date_0, rate_date_1, date_0, date_1.
119
119
  def collect_rates(rates)
120
120
  rates = [ rates ] unless rates.kind_of?(Enumerable)
121
121
  rates.each do | r |
@@ -129,12 +129,11 @@ class Currency::Exchange::Rate
129
129
  # Initial.
130
130
  @rate_samples ||= 0
131
131
  @rate_sum ||= 0
132
- @src ||= rate
132
+ @source ||= rate.source
133
133
  @c1 ||= rate.c1
134
134
  @c2 ||= rate.c2
135
135
  @date ||= rate.date
136
- @src ||= rate.src
137
-
136
+
138
137
  # Reciprocal?
139
138
  if @c1 == rate.c2 && @c2 == rate.c1
140
139
  collect_rate(rate.reciprocal)
@@ -142,7 +141,7 @@ class Currency::Exchange::Rate
142
141
  raise("Cannot collect rates between different currency pairs")
143
142
  else
144
143
  # Multisource?
145
- @src = "<<multiple-sources>>" unless @src == rate.source
144
+ @source = "<<multiple-sources>>" unless @source == rate.source
146
145
 
147
146
  # Calculate rate average.
148
147
  @rate_samples += 1
@@ -164,14 +163,14 @@ class Currency::Exchange::Rate
164
163
  d = rate.date_0 || rate.date
165
164
  unless @date_0 && @date_0 < d
166
165
  @date_0 = d
167
- @rate_0 = r
166
+ @rate_date_0 = r
168
167
  end
169
168
 
170
169
  r = rate.rate_date_1 || rate.rate
171
170
  d = rate.date_1 || rate.date
172
171
  unless @date_1 && @date_1 > d
173
172
  @date_1 = d
174
- @rate_0 = r
173
+ @rate_date_0 = r
175
174
  end
176
175
 
177
176
  @date ||= rate.date || rate.date0 || rate.date1
@@ -181,7 +180,7 @@ class Currency::Exchange::Rate
181
180
 
182
181
 
183
182
  def to_s(extended = false)
184
- extended = "#{date_0} #{rate_0} |< #{rate_lo} #{rate} #{rate_hi} >| #{rate_1} #{date_1}" if extended
183
+ extended = "#{date_0} #{rate_date_0} |< #{rate_lo} #{rate} #{rate_hi} >| #{rate_date_1} #{date_1}" if extended
185
184
  extended ||= ''
186
185
  "#<#{self.class.name} #{c1.code} #{c2.code} #{rate} #{source.inspect} #{date ? date.strftime('%Y/%m/%d-%H:%M:%S') : 'nil'} #{derived && derived.inspect} #{extended}>"
187
186
  end
@@ -18,7 +18,7 @@ class Currency::Exchange::Rate::Source::NewYorkFed < ::Currency::Exchange::Rate:
18
18
  PIVOT_CURRENCY = :USD
19
19
 
20
20
  def initialize(*opt)
21
- self.uri = 'http://www.newyorkfed.org/markets/fxrates/FXtoXML.cfm?FEXdate=#{date_YYYY}%2D#{date_MM}%2D#{date_DD}%2000%3A00%3A00%2E0&FEXtime=1200'
21
+ self.uri = 'http://www.newyorkfed.org/markets/fxrates/FXtoXML.cfm?FEXdate=#{date_YYYY}%2D#{date_MM}%2D#{date_DD}%2000%3A00%3A00%2E0&FEXTIME=1200'
22
22
  @raw_rates = nil
23
23
  super(*opt)
24
24
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: currency
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.5
7
- date: 2007-05-29 00:00:00 -04:00
6
+ version: 0.4.6
7
+ date: 2007-05-30 00:00:00 -04:00
8
8
  summary: "Currency models currencies, monetary values, foreign exchanges rates. Pulls live and historical rates from http://xe.com/, http://newyorkfed.org/, http://thefinancials.com/. Can store/retrieve historical rate data from database using ActiveRecord. Can store/retrieve Money values using ActiveRecord. For more details, see: http://rubyforge.org/projects/currency/ http://currency.rubyforge.org/ http://currency.rubyforge.org/files/README_txt.html"
9
9
  require_paths:
10
10
  - lib