openexchangerates 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5ad184a4401e48b91d5f702cfad79640d5723d3
4
- data.tar.gz: 9b7808468a8f66b03f80c6ae5c883b7f260d7c6c
3
+ metadata.gz: cf4cfe33f88cb15f7aac7664538030eb1e641583
4
+ data.tar.gz: b351fc413bb57cb5133e9e776c4e7812906fb64f
5
5
  SHA512:
6
- metadata.gz: 83596f0c83b1cc258efcc56629d4437a1920431223f9c30e050dcc30f07d2229400d5920124fce4f51b5431bc00af5068292b1459fc500f71e0eaa9df7173f16
7
- data.tar.gz: 8f382404e453ae87fe9370f79ac4bbaa0f0f62fdaed291bd48c803ab43cb663106994783fc60338121be8cad475e536b0e014b24c7a9baa0176139e4cfde5b3e
6
+ metadata.gz: 8342df7e4a1b05524709f4e999b1e8d4bc241638551fc62063450a32cf5f2d3354085b5f0bf5b5263ba7e005af554498b0f51b993d0da2e627bcc1ac24e4315c
7
+ data.tar.gz: dfe39dce443625f2e1bd9463c4b835b025363aaeeec064b6c4cb94b0e5a30d496e793155a52b4605f92ff87edf5ef1af9a379bd745e669abfcc68e6ec0bd1843
data/README.md CHANGED
@@ -1,4 +1,12 @@
1
- openexchangerates
2
- =================
3
-
1
+ ### openexchangerates ###
4
2
  Implementation API openexchangerates.org on Ruby
3
+
4
+ ### methods ###
5
+ **1.** `get_latest()`
6
+ Get the most recent exchange rates
7
+
8
+ **2.** `get_currencies`
9
+ get list of currency codes and names
10
+
11
+ **3.** `get_old(date)`
12
+ get rates for any given day, where available
data/example.rb CHANGED
@@ -4,9 +4,11 @@ require 'openexchangerates'
4
4
 
5
5
  currency = OpenExchange.new('586ee899f7eb4f79861589a1f00a8630')
6
6
  cur = JSON.parse(currency.get_latest)
7
+ cur_old = JSON.parse(currency.get_old('2010-12-31'))
7
8
 
8
9
  cur_show = 'RUB'
9
10
 
10
- puts "Latest update: #{Time.at(cur['timestamp'])}"
11
- puts "1 USD = #{cur['rates'][cur_show]} \
12
- (#{JSON.parse(currency.get_currencies)[cur_show]})"
11
+ puts "#{Time.at(cur_old['timestamp'])} \n\t1 USD = #{cur['rates'][cur_show]} \
12
+ #{JSON.parse(currency.get_currencies)[cur_show]}"
13
+ puts "#{Time.at(cur['timestamp'])} \n\t1 USD = #{cur_old['rates'][cur_show]} \
14
+ #{JSON.parse(currency.get_currencies)[cur_show]}"
@@ -21,6 +21,7 @@ class OpenExchange
21
21
  def get_old(date) # YYYY-MM-DD
22
22
  json = open("#{@@url}historical/#{date}.json?app_id=#{@api_key}",
23
23
  'User-Agent' => @user_agent).read
24
+ return json
24
25
  end
25
26
 
26
27
  def get_currencies()
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'openexchangerates'
3
- s.version = '0.0.1'
3
+ s.version = '0.1.0'
4
4
  s.date = '2012-12-06'
5
5
  s.summary = 'Implementation API openexchangerates.org on Ruby'
6
- s.description = 'Implementation API openexchangerates.org on Ruby'
6
+ s.description = '...'
7
7
  s.authors = ['Alexander Popov']
8
8
  s.email = ['iiiypuk@iiiypuk.me']
9
9
  s.homepage = 'https://github.com/IIIypuk/openexchangerates'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openexchangerates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2012-12-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Implementation API openexchangerates.org on Ruby
13
+ description: '...'
14
14
  email:
15
15
  - iiiypuk@iiiypuk.me
16
16
  executables: []