exchange 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +262 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/exchange.gemspec +102 -0
- data/lib/core_extensions/conversability.rb +32 -0
- data/lib/exchange.rb +11 -0
- data/lib/exchange/cache.rb +4 -0
- data/lib/exchange/cache/base.rb +51 -0
- data/lib/exchange/cache/memcached.rb +52 -0
- data/lib/exchange/cache/rails.rb +45 -0
- data/lib/exchange/cache/redis.rb +54 -0
- data/lib/exchange/configuration.rb +72 -0
- data/lib/exchange/currency.rb +237 -0
- data/lib/exchange/external_api.rb +4 -0
- data/lib/exchange/external_api/base.rb +114 -0
- data/lib/exchange/external_api/call.rb +76 -0
- data/lib/exchange/external_api/currency_bot.rb +47 -0
- data/lib/exchange/external_api/xavier_media.rb +47 -0
- data/spec/core_extensions/conversability_spec.rb +64 -0
- data/spec/exchange/cache/base_spec.rb +29 -0
- data/spec/exchange/cache/memcached_spec.rb +72 -0
- data/spec/exchange/cache/rails_spec.rb +67 -0
- data/spec/exchange/cache/redis_spec.rb +76 -0
- data/spec/exchange/configuration_spec.rb +47 -0
- data/spec/exchange/currency_spec.rb +219 -0
- data/spec/exchange/external_api/base_spec.rb +31 -0
- data/spec/exchange/external_api/call_spec.rb +68 -0
- data/spec/exchange/external_api/currency_bot_spec.rb +61 -0
- data/spec/exchange/external_api/xavier_media_spec.rb +59 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/api_responses/example_historic_json.json +167 -0
- data/spec/support/api_responses/example_json_api.json +167 -0
- data/spec/support/api_responses/example_xml_api.xml +156 -0
- metadata +191 -0
data/.document
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
gem "nokogiri", ">= 1.4.0"
|
5
|
+
gem "json", ">= 1.6.5"
|
6
|
+
gem "memcached", ">= 1.3.0"
|
7
|
+
gem "redis", ">= 2.2.0"
|
8
|
+
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "shoulda", ">= 0"
|
13
|
+
gem "yard", "~> 0.7.4"
|
14
|
+
gem "bundler", "~> 1.0.0"
|
15
|
+
gem "jeweler", "~> 1.8.3"
|
16
|
+
gem "rspec"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.8.3)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rdoc
|
11
|
+
json (1.6.5)
|
12
|
+
memcached (1.3.6)
|
13
|
+
nokogiri (1.5.0)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
rdoc (3.12)
|
16
|
+
json (~> 1.4)
|
17
|
+
redis (2.2.2)
|
18
|
+
rspec (2.8.0)
|
19
|
+
rspec-core (~> 2.8.0)
|
20
|
+
rspec-expectations (~> 2.8.0)
|
21
|
+
rspec-mocks (~> 2.8.0)
|
22
|
+
rspec-core (2.8.0)
|
23
|
+
rspec-expectations (2.8.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.8.0)
|
26
|
+
shoulda (2.11.3)
|
27
|
+
yard (0.7.5)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 1.0.0)
|
34
|
+
jeweler (~> 1.8.3)
|
35
|
+
json (>= 1.6.5)
|
36
|
+
memcached (>= 1.3.0)
|
37
|
+
nokogiri (>= 1.4.0)
|
38
|
+
redis (>= 2.2.0)
|
39
|
+
rspec
|
40
|
+
shoulda
|
41
|
+
yard (~> 0.7.4)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 beatrichartz
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
= exchange {<img src="https://secure.travis-ci.org/beatrichartz/exchange.png" />}[http://travis-ci.org/beatrichartz/exchange]
|
2
|
+
|
3
|
+
The Exchange Gem gives you easy access to currency functions directly on your Numbers. It has been tested against ruby 1.8.7, ruby 1.9.2 and 1.9.3. You can use it with just plain ruby projects, in Rails 2 and 3, Sinatra, Padrino or whatever Framework you like.
|
4
|
+
|
5
|
+
=== Easy Conversion
|
6
|
+
|
7
|
+
Imagine a conversion as easy as
|
8
|
+
1.eur.to_usd
|
9
|
+
or even better
|
10
|
+
1.eur.to_usd(:at => Time.now - 84600)
|
11
|
+
which gets you an exchange at the rates of yesterday.
|
12
|
+
|
13
|
+
=== Only one request per day to keep you up to date
|
14
|
+
|
15
|
+
Imagine the exchange rates getting cached, and you hitting the internet only daily to get new rates (hourly if you're eager to have the absolutely newest ones)
|
16
|
+
|
17
|
+
=== Use two great APIs or your own
|
18
|
+
|
19
|
+
Two open APIs are already included: Currency Bot (http://currencybot.github.com/) and Xaviermedia (http://www.xavierforum.com/viewtopic.php?f=5&t=10979&sid=671a685edbfa5dbec219fbc6793d5057)
|
20
|
+
but if you have another API you like to use, it becomes as easy as writing one Class and two methods to use it with the Exchange gem. Just visit the documentation here: http://rubydoc.info/github/beatrichartz/exchange/Exchange/ExternalAPI to see an example of a custom API Extension
|
21
|
+
|
22
|
+
=== Use great caches or your own
|
23
|
+
|
24
|
+
Also, the gem allows you to use one of three available caching solutions: Memcached via the Memcached gem, Redis via the redis gem or the Rails cache.
|
25
|
+
But, same here, if you don't like any of these or want to use your own caching solution, it is as easy as writing one Class and two methods to use it with Exchange. Just visit the documentation here: http://rubydoc.info/github/beatrichartz/exchange/Exchange/Cache for an example of a cache extension
|
26
|
+
|
27
|
+
== Installation
|
28
|
+
=== Bundler / Rails
|
29
|
+
Add it to your Gemfile
|
30
|
+
gem "exchange", ">=0.2.5"
|
31
|
+
=== Manually
|
32
|
+
Just install it as a gem :)
|
33
|
+
gem install exchange
|
34
|
+
|
35
|
+
== Basic Operations
|
36
|
+
|
37
|
+
=== Convert
|
38
|
+
|
39
|
+
Converting one currency to another is as easy as 1,2,3. Don't be afraid, even if it returns a currency object, all Fixed and Float operations can be applied as method missing routes to the value
|
40
|
+
|
41
|
+
1.usd.to_eur #=> #<Exchange::Currency @value=0.93 @currency=:eur>
|
42
|
+
2.3.dkk.to_sek #=> #<Exchange::Currency @value=3.33 @currency=:sek>
|
43
|
+
45.54.nok.to_sek #=> #<Exchange::Currency @value=3.33 @currency=:sek>
|
44
|
+
|
45
|
+
Easily convert one currency to another at a historical rate
|
46
|
+
|
47
|
+
1.52.usd.to_eur :at => '2011-01-01' #=> #<Exchange::Currency @value=1.23 @currency=:eur>
|
48
|
+
3.45.eur.to_sek :at => Time.gm(2011,3,3) #=> #<Exchange::Currency @value=19.23 @currency=:sek>
|
49
|
+
345.sek.to_nok :at => Time.gm(2011,3,3) #=> #<Exchange::Currency @value=348 @currency=:nok>
|
50
|
+
|
51
|
+
Or even define an instance of currency as historic by adding a time.
|
52
|
+
|
53
|
+
1.52.usd(:at => '2011-01-01').to_eur #=> #<Exchange::Currency @value=1.23 @currency=:eur>
|
54
|
+
3.45.eur(:at => Time.gm(2011,3,3)).to_sek #=> #<Exchange::Currency @value=19.23 @currency=:sek>
|
55
|
+
345.sek(:at => Time.gm(2011,3,3)).to_nok #=> #<Exchange::Currency @value=348 @currency=:nok>
|
56
|
+
|
57
|
+
Do multiple conversion steps at once (if in any way useful)
|
58
|
+
|
59
|
+
3.chf.to_eur(:at => '2011-02-04').to_usd #=> #<Exchange::Currency @value=5.3 @currency=:eur>
|
60
|
+
|
61
|
+
|
62
|
+
=== Compare
|
63
|
+
|
64
|
+
Compare Currencies, they will convert implicitly
|
65
|
+
|
66
|
+
2.eur > 2.usd #=> true (2.usd get converted to eur and compared)
|
67
|
+
2.nok < 2.sek #=> false (2.sek get converted to nok and compared)
|
68
|
+
5.eur == 4.34.chf #=> true
|
69
|
+
50.eur == 4.34.chf #=> false
|
70
|
+
50.eur.to_sek == 50.eur #=> true
|
71
|
+
50.eur(:at => '2011-1-1') == 50.sek #=> false
|
72
|
+
|
73
|
+
Sort multiple currencies at once
|
74
|
+
|
75
|
+
[5.eur, 4.usd, 4.chf(:at => '2010-01-01')].sort #=> [#<Exchange::Currency @value=4 @currency=:usd>, #<Exchange::Currency @value=4 @currency=:chf>, #<Exchange::Currency @value=5 @currency=:eur>]
|
76
|
+
|
77
|
+
This is true, because it uses the same historic conversion rate
|
78
|
+
|
79
|
+
3.eur(:at => '201-01-01').to_usd == 3.eur.to_usd(:at => '201-01-01')
|
80
|
+
|
81
|
+
But this is false, obviously, because the second instance uses the present exchange rate
|
82
|
+
|
83
|
+
3.eur(:at => '201-01-01').to_usd == 3.eur.to_usd
|
84
|
+
|
85
|
+
=== Operate
|
86
|
+
|
87
|
+
Add, Subtract, Multiply, Divide Currencies and don't lose a dime. The result will get returned in the currency of the first argument
|
88
|
+
|
89
|
+
1.usd + 1.32.eur #=> #<Exchange::Currency @value=2.54 @currency=:usd>
|
90
|
+
1.usd - 1.32.eur #=> #<Exchange::Currency @value=-0.2 @currency=:usd>
|
91
|
+
1.usd * 1.32.eur #=> #<Exchange::Currency @value=3.44 @currency=:usd>
|
92
|
+
1.usd / 1.32.eur #=> #<Exchange::Currency @value=0.89 @currency=:usd>
|
93
|
+
|
94
|
+
|
95
|
+
If you define a currency object as historic. It will use historic conversion if it gets converted (in this example, the 1.32 eur will get converted to usd at the rate of January 1 2008)
|
96
|
+
|
97
|
+
1.usd - 1.32.eur(:at => '2008-1-1') #=> #<Exchange::Currency @value=2.54 @currency=:usd>
|
98
|
+
|
99
|
+
You can just instantiate currencies and apply operations
|
100
|
+
|
101
|
+
3.1.eur.round #=> #<Exchange::Currency @value=3 @currency=:eur>
|
102
|
+
|
103
|
+
Convert one currency to another and round, ceil or floor it, it still retains currency information of the actual and previous currency
|
104
|
+
|
105
|
+
1.34.usd.to_eur.round #=> #<Exchange::Currency @value=1 @currency=:eur>
|
106
|
+
10.34.usd.to_nok.ceil #=> #<Exchange::Currency @value=45 @currency=:nok>
|
107
|
+
5.34.usd.to_eur.floor #=> #<Exchange::Currency @value=4 @currency=:eur>
|
108
|
+
5.34.usd.to_eur.floor.from #=> #<Exchange::Currency @value=5.34 @currency=:usd>
|
109
|
+
|
110
|
+
|
111
|
+
=== Retain Information
|
112
|
+
|
113
|
+
Access the original currency and its value after conversion, even over multiple steps
|
114
|
+
converted = 2.eur.to_usd #=> #<Exchange::Currency @value=2.12 @currency=:usd>
|
115
|
+
converted.from #=> #<Exchange::Currency @value=2 @currency=:eur>
|
116
|
+
converted2 = converted.to_nok #=> #<Exchange::Currency @value=22.12 @currency=:nok>
|
117
|
+
converted2.from #=> #<Exchange::Currency @value=2.12 @currency=:usd>
|
118
|
+
|
119
|
+
== Configuration
|
120
|
+
|
121
|
+
You can configure the exchange gem to a variety of options, allowing you to control restrictions on operations, caching and which API the gem uses. Just set the configuration with
|
122
|
+
|
123
|
+
Exchange::Configuration.define do |c|
|
124
|
+
# your configuration goes here
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
=== Options
|
129
|
+
|
130
|
+
The options available are
|
131
|
+
|
132
|
+
:cache (default :memcached) The cache type to use. Possible Values: :redis, :memcached or :rails or false to disable caching
|
133
|
+
:cache_host (default '127.0.0.1') A string with the hostname or IP to set the cache host to. Does not have to be set for Rails cache
|
134
|
+
:cache_port (default 11211) An integer for the cache port. Does not have to be set for Rails cache
|
135
|
+
:api (default :currency_bot) The API to use. Possible Values: :currency_bot (Open Source currency bot API) or :xavier_media (Xavier Media API)
|
136
|
+
:retries (default 5) The number of times the gem should retry to connect to the api host
|
137
|
+
:allow_mixed_opterations (default true) If set to false, Operations with with different currencies raise errors.
|
138
|
+
:update (default :daily) The regularity of updates for the API. Possible values: :daily, :hourly.
|
139
|
+
|
140
|
+
If your afraid of mixed currency operations, just don't allow them
|
141
|
+
Exchange::Configuration.allow_mixed_operations = false
|
142
|
+
1.usd + 1.eur #=> MixedCurrencyError
|
143
|
+
|
144
|
+
=== Caching Options
|
145
|
+
|
146
|
+
Use Memcached to cache the result (default). Exchange will cache the API files with a key starting with 'exchange_'
|
147
|
+
Exchange::Configuration.define do |c|
|
148
|
+
c.cache = :memcached
|
149
|
+
c.cache_host = 'yourhost'
|
150
|
+
c.cache_port = 2423 #your port
|
151
|
+
end
|
152
|
+
|
153
|
+
Use Redis to cache the result. Exchange will cache the API files with a key starting with 'exchange_'
|
154
|
+
Exchange::Configuration.define do |c|
|
155
|
+
c.cache = :redis
|
156
|
+
c.cache_host = 'yourhost'
|
157
|
+
c.cache_port = 2423 #your port
|
158
|
+
end
|
159
|
+
|
160
|
+
Use Rails to cache the result. Exchange will cache the API files with a key starting with 'exchange_'
|
161
|
+
Exchange::Configuration.define do |c|
|
162
|
+
c.cache = :rails
|
163
|
+
end
|
164
|
+
|
165
|
+
=== API Options
|
166
|
+
|
167
|
+
Use the currencybot Open Source API as a source of your conversion rates (default)
|
168
|
+
Exchange::Configuration.define do |c|
|
169
|
+
c.api = :currency_bot
|
170
|
+
end
|
171
|
+
|
172
|
+
Use the Xaviermedia API as the source of your conversion rates
|
173
|
+
Exchange::Configuration.define do |c|
|
174
|
+
c.api = :xavier_media
|
175
|
+
end
|
176
|
+
|
177
|
+
== Connect your own API and Cache
|
178
|
+
|
179
|
+
=== Your own API
|
180
|
+
|
181
|
+
Easily connect to your custom API by writing an ExternalAPI Class, or use your own caching solution to cache. Please note that only open source APIs can be accepted as contributions to this gem. Private / Premium APIs have to be written as your own.
|
182
|
+
module Exchange
|
183
|
+
module ExternalAPI
|
184
|
+
class MyCustom < Base
|
185
|
+
# Define here which currencies your API can handle
|
186
|
+
CURRENCIES = %W(usd chf)
|
187
|
+
|
188
|
+
# Every instance of ExternalAPI Class has to have an update function which gets the rates from the API
|
189
|
+
def update(opts={})
|
190
|
+
# assure that you will get a Time object for the historical dates
|
191
|
+
time = assure_time(opts[:at])
|
192
|
+
|
193
|
+
# call your API (shown here with a helper function that builds your API URL). Like this, your calls will get cached.
|
194
|
+
Call.new(api_url(time), :at => time) do |result|
|
195
|
+
|
196
|
+
# assign the currency conversion base, attention, this is readonly, so don't do self.base =
|
197
|
+
@base = result['base']
|
198
|
+
|
199
|
+
# assign the rates, this has to be a hash with the following format: {'USD' => 1.23242, 'CHF' => 1.34323}. Attention, this is readonly.
|
200
|
+
@rates = result['rates']
|
201
|
+
|
202
|
+
# timestamp the api call result. This may come in handy to assure you have the right result. Attention, this is readonly.
|
203
|
+
@timestamp = result['timestamp'].to_i
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
private
|
208
|
+
|
209
|
+
def api_url(time)
|
210
|
+
# code a helper function that builds your api url for the specified time
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
Now, you can configure your API in the configuration. The Symbol will get camelcased and constantized
|
218
|
+
|
219
|
+
Exchange::Configuration.api = :my_custom
|
220
|
+
|
221
|
+
Have fun, and don't forget to write tests.
|
222
|
+
|
223
|
+
=== Your own Cache
|
224
|
+
|
225
|
+
Write your own caching module to use the gem with your own custom caching solution.
|
226
|
+
module Cache
|
227
|
+
class MyCustomCache < Base
|
228
|
+
class << self
|
229
|
+
# a cache class has to have the class method "cached"
|
230
|
+
def cached api, opts={}, &block
|
231
|
+
# generate the key with key(api, opts[:at]) and you will get a unique key to store in your cache
|
232
|
+
# Your code goes here
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
Now, you can configure your Caching solution in the configuration. The Symbol will get camelcased and constantized
|
239
|
+
|
240
|
+
Exchange::Configuration.cache = :my_custom_cache
|
241
|
+
|
242
|
+
Have fun, and don't forget to write tests.
|
243
|
+
|
244
|
+
|
245
|
+
== Contributing to exchange
|
246
|
+
|
247
|
+
Please note that only open source APIs can be accepted as contributions to this gem. Private / Premium APIs have to be written as your own extension and will not be added to the gem code.
|
248
|
+
|
249
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
250
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
251
|
+
* Fork the project.
|
252
|
+
* Start a feature/bugfix branch.
|
253
|
+
* Commit and push until you are happy with your contribution.
|
254
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
255
|
+
* Make sure to add documentation for it. This is important so everyone else can see what your code can do.
|
256
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
257
|
+
|
258
|
+
== Copyright
|
259
|
+
|
260
|
+
Copyright (c) 2012 Beat Richartz. See LICENSE.txt for
|
261
|
+
further details.
|
262
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "exchange"
|
18
|
+
gem.homepage = "http://github.com/beatrichartz/exchange"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Simple Exchange Rate operations for your ruby app}
|
21
|
+
gem.description = %Q{The Exchange Gem gives you easy access to currency functions directly on your Numbers. Imagine a conversion as easy as
|
22
|
+
1.eur.to_usd
|
23
|
+
or even better
|
24
|
+
1.eur.to_usd(:at => Time.now - 84600)
|
25
|
+
which gets you an exchange at the rates of yesterday.}
|
26
|
+
gem.email = "exchange_gem@gmail.com"
|
27
|
+
gem.authors = ["Beat Richartz"]
|
28
|
+
# dependencies defined in Gemfile
|
29
|
+
end
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
task :default => :test
|
33
|
+
|
34
|
+
require 'rspec/core'
|
35
|
+
require 'rspec/core/rake_task'
|
36
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
37
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
38
|
+
end
|
39
|
+
|
40
|
+
require 'yard'
|
41
|
+
YARD::Rake::YardocTask.new
|
42
|
+
|
43
|
+
# RSpec::Core::RakeTask.new(:rcov) do |spec|
|
44
|
+
# spec.pattern = 'spec/**/*_spec.rb'
|
45
|
+
# spec.rcov = true
|
46
|
+
# end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.6
|
data/exchange.gemspec
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "exchange"
|
8
|
+
s.version = "0.2.6"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Beat Richartz"]
|
12
|
+
s.date = "2012-02-03"
|
13
|
+
s.description = "The Exchange Gem gives you easy access to currency functions directly on your Numbers. Imagine a conversion as easy as \n 1.eur.to_usd\n or even better \n 1.eur.to_usd(:at => Time.now - 84600)\n which gets you an exchange at the rates of yesterday."
|
14
|
+
s.email = "exchange_gem@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"exchange.gemspec",
|
30
|
+
"lib/core_extensions/conversability.rb",
|
31
|
+
"lib/exchange.rb",
|
32
|
+
"lib/exchange/cache.rb",
|
33
|
+
"lib/exchange/cache/base.rb",
|
34
|
+
"lib/exchange/cache/memcached.rb",
|
35
|
+
"lib/exchange/cache/rails.rb",
|
36
|
+
"lib/exchange/cache/redis.rb",
|
37
|
+
"lib/exchange/configuration.rb",
|
38
|
+
"lib/exchange/currency.rb",
|
39
|
+
"lib/exchange/external_api.rb",
|
40
|
+
"lib/exchange/external_api/base.rb",
|
41
|
+
"lib/exchange/external_api/call.rb",
|
42
|
+
"lib/exchange/external_api/currency_bot.rb",
|
43
|
+
"lib/exchange/external_api/xavier_media.rb",
|
44
|
+
"spec/core_extensions/conversability_spec.rb",
|
45
|
+
"spec/exchange/cache/base_spec.rb",
|
46
|
+
"spec/exchange/cache/memcached_spec.rb",
|
47
|
+
"spec/exchange/cache/rails_spec.rb",
|
48
|
+
"spec/exchange/cache/redis_spec.rb",
|
49
|
+
"spec/exchange/configuration_spec.rb",
|
50
|
+
"spec/exchange/currency_spec.rb",
|
51
|
+
"spec/exchange/external_api/base_spec.rb",
|
52
|
+
"spec/exchange/external_api/call_spec.rb",
|
53
|
+
"spec/exchange/external_api/currency_bot_spec.rb",
|
54
|
+
"spec/exchange/external_api/xavier_media_spec.rb",
|
55
|
+
"spec/spec_helper.rb",
|
56
|
+
"spec/support/api_responses/example_historic_json.json",
|
57
|
+
"spec/support/api_responses/example_json_api.json",
|
58
|
+
"spec/support/api_responses/example_xml_api.xml"
|
59
|
+
]
|
60
|
+
s.homepage = "http://github.com/beatrichartz/exchange"
|
61
|
+
s.licenses = ["MIT"]
|
62
|
+
s.require_paths = ["lib"]
|
63
|
+
s.rubygems_version = "1.8.11"
|
64
|
+
s.summary = "Simple Exchange Rate operations for your ruby app"
|
65
|
+
|
66
|
+
if s.respond_to? :specification_version then
|
67
|
+
s.specification_version = 3
|
68
|
+
|
69
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
70
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.0"])
|
71
|
+
s.add_runtime_dependency(%q<json>, [">= 1.6.5"])
|
72
|
+
s.add_runtime_dependency(%q<memcached>, [">= 1.3.0"])
|
73
|
+
s.add_runtime_dependency(%q<redis>, [">= 2.2.0"])
|
74
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
75
|
+
s.add_development_dependency(%q<yard>, ["~> 0.7.4"])
|
76
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
77
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
78
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
|
81
|
+
s.add_dependency(%q<json>, [">= 1.6.5"])
|
82
|
+
s.add_dependency(%q<memcached>, [">= 1.3.0"])
|
83
|
+
s.add_dependency(%q<redis>, [">= 2.2.0"])
|
84
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
85
|
+
s.add_dependency(%q<yard>, ["~> 0.7.4"])
|
86
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
87
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
88
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
89
|
+
end
|
90
|
+
else
|
91
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
|
92
|
+
s.add_dependency(%q<json>, [">= 1.6.5"])
|
93
|
+
s.add_dependency(%q<memcached>, [">= 1.3.0"])
|
94
|
+
s.add_dependency(%q<redis>, [">= 2.2.0"])
|
95
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
96
|
+
s.add_dependency(%q<yard>, ["~> 0.7.4"])
|
97
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
98
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
99
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|