coins 0.1.2 → 0.1.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/coins +1 -2
  3. data/lib/coins.rb +22 -18
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1951d33225a76cdc69e5085f3538237cb5a11d7
4
- data.tar.gz: 7a48ab04299e370aacf1e6ec009336143cedba9b
3
+ metadata.gz: e7bb004073b510552aa2d44ca26077789f600d2e
4
+ data.tar.gz: a7385ccad00023b74912708055b24b650d82ab40
5
5
  SHA512:
6
- metadata.gz: 215f051426e074dc9ad173e59ba6b603a6132e307cd1b2d114753f90b737cf208911188736da29287f40b19ad1c81b8764009bf1458b7d1ebeb1913f56b770fe
7
- data.tar.gz: 81cd327557da10d4c09b9d8149ac41adcb7510d6f09c95483dc20633a83d4d7c8200363323b3700ef86eaebc4be9c171d8d4a4a449667dc1811e6ff49d7cc208
6
+ metadata.gz: f81a849e500e1a4b011ba96a8bef15cbcd61ca911e85ff6b2668ec9fd9ed332baf95a980e18f1652a3530b9c547545b14e3f6947e811321b2f7d7f42de02c0a4
7
+ data.tar.gz: 06e3a7d290cf5f8b22ac4def775452422f2b628c137288855cc5c67aed0d8016e556a71fdb68fde96e08f06df2777b2701f79e1d7d35997148630d99f560f88b
data/bin/coins CHANGED
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'coins'
3
-
4
- Coins.new
3
+ Coins.new.parseArgs
@@ -2,10 +2,6 @@ require 'net/http'
2
2
  require 'json'
3
3
 
4
4
  class Coins
5
- def initialize
6
- parseArgs
7
- end
8
-
9
5
  def setRate base
10
6
  begin
11
7
  @exchange = JSON.parse Net::HTTP.get(URI 'http://api.fixer.io/latest?base=' + base)
@@ -16,20 +12,28 @@ class Coins
16
12
  end
17
13
 
18
14
  def help
19
- puts "\n A simple live terminal currency exchange rate converter in Ruby\n"\
20
- " The currencies are retrieved from fixer.io which is a\n"\
21
- " 'Foreign exchange rates and currency conversion API'\n"\
22
- " which is a JSON API published by the 'European Central Bank'.\n\n"\
23
- " The rates are updated daily around 4 PM CET\n\n"\
24
- " Usage:\n"\
25
- " \"coins [rate(s)] [base/against] / [from] num(float/int ){CUR} [to] {CUR}\"\n"\
26
- " where CUR is the three letter currency "
27
- " (e.g. USD, GBP NOK, EUR, RUB, etc...)\n\n"\
28
- " use 'from `n` `CUR` to `CUR(other)`' toconvert between currencies.\n\n"\
29
- " use 'rates' to list all rates (see `base` also) or 'rate `CUR`'\n"\
30
- " to see the rate for one single currency.\n\n"\
31
- " use 'base `CUR`' or 'agains `CUR`' to change what the exchange rates compare to.\n"
32
- " Default rate base is USD\n\n"
15
+ help = <<EOF
16
+
17
+ A simple live terminal currency exchange rate converter in Ruby
18
+ The currencies are retrieved from fixer.io which is a
19
+ 'Foreign exchange rates and currency conversion API'
20
+ which is a JSON API published by the 'European Central Bank'.
21
+
22
+ The rates are updated daily around 4 PM CET
23
+
24
+ Usage:
25
+ `coins [rate(s)] [base/against] / [from] num(float/int ){CUR} [to] {CUR}`
26
+ where CUR is the three letter currency
27
+ (e.g. USD, GBP NOK, EUR, RUB, etc...)
28
+ use 'from `n` `CUR` to `CUR(other)`' toconvert between currencies.
29
+ use 'rates' to list all rates (see `base` also) or 'rate `CUR`'
30
+ to see the rate for one single currency.
31
+ use 'base `CUR`' or 'agains `CUR`' to change what the exchange
32
+ rates compare to.
33
+ Default rate base is USD
34
+
35
+ EOF
36
+ puts help
33
37
  end
34
38
 
35
39
  def args? this
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demonstrandum