currency 0.4.4 → 0.4.5

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.
@@ -1,4 +1,7 @@
1
- This software distribution is Copyrighted (c) 2006-2007 by Kurt Stephens <ruby-currency(at)umleta.com>.
1
+ This software distribution is Copyright (c) 2006-2007
2
+ by Kurt Stephens <ruby-currency(at)umleta.com>.
3
+
4
+ THERE IS ABSOLUTELY NO WARRANTY: SEE COPYING.txt
2
5
 
3
6
  ==================================================================
4
7
 
@@ -1,11 +1,20 @@
1
1
  = Currency Release History
2
2
 
3
+ == Release 0.4.5: 2007/05/29
4
+
5
+ * Historical::Rate table name can be configured in Currency::Config.current.historical_table_name
6
+ * Fixed Rate::Source::TheFinancials.
7
+ * Examples: use Currency.Money(), not Currency::Money.new().
8
+
3
9
  == Release 0.4.4: 2007/04/01
4
10
 
11
+ MAY NOT BE BACKWARDS-COMPATIBLE
12
+
5
13
  * Fixed TimedCache.
6
14
  * Updated documentation.
7
15
  * Added support for Parser#time = :now.
8
16
  * Added support for Time in Formatter and Parser using Time#xmlschema.
17
+ * Money#inspect now appends Money#time, if set.
9
18
 
10
19
  == Release 0.4.3: 2007/04/01
11
20
 
@@ -3,7 +3,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'currency'
4
4
  require 'currency/exchange/rate/source/test'
5
5
 
6
- x = Currency::Money.new("1,203.43", :USD)
6
+ x = Currency.Money("1,203.43", :USD)
7
7
 
8
8
  puts x.to_s
9
9
  puts (x * 10).to_s
@@ -9,7 +9,7 @@ Currency::Exchange::Rate::Source.current = ex
9
9
  puts ex.inspect
10
10
  puts ex.parse_page_rates.inspect
11
11
 
12
- usd = Currency::Money.new("1", 'USD')
12
+ usd = Currency.Money("1", 'USD')
13
13
 
14
14
  puts "usd = #{usd}"
15
15
 
@@ -78,5 +78,14 @@ class Currency::Config
78
78
  def float_ref_filter=(x)
79
79
  @float_ref_filter = x
80
80
  end
81
+
82
+
83
+ # Defines the table name for Historical::Rate records.
84
+ # Defaults to 'currency_historical_rates'.
85
+ attr_accessor :historical_table_name
86
+ def historical_table_name
87
+ @historical_table_name ||= 'currency_historical_rates'
88
+ end
89
+
81
90
  end # module
82
91
 
@@ -1,5 +1,5 @@
1
1
  module Currency
2
- CurrencyVersion = '0.4.4'
2
+ CurrencyVersion = '0.4.5'
3
3
  end
4
4
  # DO NOT EDIT
5
5
  # This file is auto-generated by build scripts.
@@ -5,7 +5,7 @@ require 'currency/exchange/rate/source/base'
5
5
 
6
6
  # Gets historical rates from database using Active::Record.
7
7
  # Rates are retrieved using Currency::Exchange::Rate::Source::Historical::Rate as
8
- # a database proxy.
8
+ # a database record proxy.
9
9
  #
10
10
  # See Currency::Exchange::Rate::Source::Historical::Writer for a rate archiver.
11
11
  #
@@ -6,12 +6,12 @@ require 'currency/exchange/rate/source/historical'
6
6
  # It requires ActiveRecord.
7
7
  #
8
8
  class Currency::Exchange::Rate::Source::Historical::Rate < ::ActiveRecord::Base
9
- TABLE_NAME = 'currency_historical_rates'
10
- set_table_name TABLE_NAME
9
+ @@_table_name ||= Currency::Config.current.historical_table_name
10
+ set_table_name @@_table_name
11
11
 
12
12
  # Can create a table and indices for this class
13
13
  # when passed a Migration.
14
- def self.__create_table(m, table_name = TABLE_NAME)
14
+ def self.__create_table(m, table_name = @@_table_name)
15
15
  table_name = table_name.intern
16
16
  m.instance_eval do
17
17
  create_table table_name do |t|
@@ -14,6 +14,9 @@ class Currency::Exchange::Rate::Source::Provider < Currency::Exchange::Rate::Sou
14
14
  # The URI used to access the rate source.
15
15
  attr_accessor :uri
16
16
 
17
+ # The URI path relative to uri used to access the rate source.
18
+ attr_accessor :uri_path
19
+
17
20
  # The Time used to query the rate source.
18
21
  # Typically set by #load_rates.
19
22
  attr_accessor :date
@@ -17,9 +17,10 @@ class Currency::Exchange::Rate::Source::TheFinancials < ::Currency::Exchange::Ra
17
17
  PIVOT_CURRENCY = :USD
18
18
 
19
19
  def initialize(*opt)
20
- self.uri = 'http://www.thefinancials.com/XXXXXXX'
21
20
  @raw_rates = nil
21
+ self.uri_path = 'syndicated/UNKNOWN/fxrates.xml'
22
22
  super(*opt)
23
+ self.uri = "http://www.thefinancials.com/#{self.uri_path}"
23
24
  end
24
25
 
25
26
 
@@ -29,9 +30,9 @@ class Currency::Exchange::Rate::Source::TheFinancials < ::Currency::Exchange::Ra
29
30
  end
30
31
 
31
32
 
32
- def get_page_content
33
- test_content
34
- end
33
+ # def get_page_content
34
+ # test_content
35
+ # end
35
36
 
36
37
 
37
38
  def clear_rates
@@ -242,7 +242,7 @@ class Currency::Formatter
242
242
  tmpl.code = @code ? _format_Currency(currency) : nil
243
243
 
244
244
  # Add time.
245
- tmpl.time = @time ? time && _format_Time(time) : nil
245
+ tmpl.time = @time && time ? _format_Time(time) : nil
246
246
 
247
247
  # Ask template to format the components.
248
248
  tmpl.format
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.4
7
- date: 2007-04-30 00:00:00 -04:00
6
+ version: 0.4.5
7
+ date: 2007-05-29 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