currency_converter 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +4 -4
- data/currency_converter.gemspec +2 -2
- data/lib/currency_converter.rb +1 -1
- data/lib/currency_converter/version.rb +1 -1
- data/lib/currency_converter/{google.rb → xe.rb} +5 -6
- data/spec/currency_converter/{google_spec.rb → xe_spec.rb} +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d45725edff9a07f66ded535e222a77108d5745d0
|
4
|
+
data.tar.gz: 25963d340bbb1e36f594d05f07949fdd0b0ee693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e757987c3a8ea96e2438f55c25d7d0f03573484b3bed1fd14c0514ff8ff24bad9eccf7614abaf18d642f685ebfd742256f3b84083797f5c8e4a78ef6d97d67f1
|
7
|
+
data.tar.gz: b7fb3b72320ec2dd523b3a5cfde747d36a535243034bae0dcfae43ad769f3d3168594dfda8c04b4e3aaf1b0d61b6185ee44d15513409f1210c92e2d38564058b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# CurrencyConverter
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/currency_converter.svg)](
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/currency_converter.svg)](https://badge.fury.io/rb/currency_converter) [![Build Status](https://travis-ci.org/dark-prince/currency_converter.svg?branch=master)](https://travis-ci.org/dark-prince/currency_converter) [![Code Climate](https://codeclimate.com/github/dark-prince/currency_converter.png)](https://codeclimate.com/github/dark-prince/currency_converter) [![Dependency Status](https://gemnasium.com/dark-prince/currency_converter.svg)](https://gemnasium.com/dark-prince/currency_converter) [![License](http://img.shields.io/license/MIT.png)](http://opensource.org/licenses/MIT) [![Coverage Status](https://coveralls.io/repos/github/dark-prince/currency_converter/badge.svg?branch=master)](https://coveralls.io/github/dark-prince/currency_converter?branch=master)
|
4
4
|
|
5
|
-
Simple Ruby API to get exchange rates from currencies using
|
5
|
+
Simple Ruby API to get exchange rates from currencies using Yahoo finance currency converter and XE currency converter. You can convert currencies directly through this library.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -20,9 +20,9 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
To convert between two currencies using
|
23
|
+
To convert between two currencies using XE currency converter:
|
24
24
|
|
25
|
-
currency_converter = CurrencyConverter::
|
25
|
+
currency_converter = CurrencyConverter::XE.new
|
26
26
|
currency_converter.exchange('EUR', 'USD', 100)
|
27
27
|
=> 132.89
|
28
28
|
|
data/currency_converter.gemspec
CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.authors = ['Diganta Mandal']
|
13
13
|
spec.email = ['urs.diganta@gmail.com']
|
14
|
-
spec.description = %q{
|
15
|
-
spec.summary = %q{
|
14
|
+
spec.description = %q{Simple Ruby API to get exchange rates from currencies using Yahoo finance currency converter and XE currency converter. You can convert currencies directly through this library.}
|
15
|
+
spec.summary = %q{Simple Ruby API to get exchange rates from currencies using Yahoo finance currency converter and XE currency converter. You can convert currencies directly through this library.}
|
16
16
|
spec.homepage = 'https://github.com/dark-prince/currency_converter'
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($/)
|
data/lib/currency_converter.rb
CHANGED
@@ -4,7 +4,7 @@ require 'net/http'
|
|
4
4
|
require 'nokogiri'
|
5
5
|
|
6
6
|
module CurrencyConverter
|
7
|
-
class
|
7
|
+
class XE
|
8
8
|
# Returns the Symbol of 'from' currency
|
9
9
|
attr_reader :from_currency
|
10
10
|
|
@@ -18,7 +18,7 @@ module CurrencyConverter
|
|
18
18
|
# @return [amount]
|
19
19
|
#
|
20
20
|
# @example
|
21
|
-
# currency_converter = CurrencyConverter::
|
21
|
+
# currency_converter = CurrencyConverter::XE.new
|
22
22
|
# currency_converter.exchange('USD', 'EUR', 100)
|
23
23
|
# currency_converter.exchange('USD', 'INR', 100)
|
24
24
|
def exchange(from, to, fixnum)
|
@@ -38,14 +38,13 @@ module CurrencyConverter
|
|
38
38
|
|
39
39
|
# Returns the Float value of rate or nil
|
40
40
|
def exchange_rate
|
41
|
-
http = Net::HTTP.new('
|
42
|
-
|
41
|
+
http = Net::HTTP.new('www.xe.com', 80)
|
42
|
+
url = "/currencyconverter/convert/?Amount=1&From=#{from_currency.to_s.upcase}&To=#{to_currency.to_s.upcase}"
|
43
43
|
|
44
|
-
url = "/CurrencyConverter.aspx?from=#{from_currency.to_s.upcase}&to=#{to_currency.to_s.upcase}"
|
45
44
|
response = http.get(url)
|
46
45
|
|
47
46
|
doc = Nokogiri::HTML(response.body)
|
48
|
-
result = doc.css('
|
47
|
+
result = doc.css('span.uccResultAmount').text
|
49
48
|
|
50
49
|
regexp = Regexp.new('(\\d+(?:\\.\\d+)?)')
|
51
50
|
regexp.match result
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diganta Mandal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -94,9 +94,9 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
98
|
-
|
99
|
-
|
97
|
+
description: Simple Ruby API to get exchange rates from currencies using Yahoo finance
|
98
|
+
currency converter and XE currency converter. You can convert currencies directly
|
99
|
+
through this library.
|
100
100
|
email:
|
101
101
|
- urs.diganta@gmail.com
|
102
102
|
executables: []
|
@@ -115,10 +115,10 @@ files:
|
|
115
115
|
- lib/currency_converter.rb
|
116
116
|
- lib/currency_converter/currencies.rb
|
117
117
|
- lib/currency_converter/exceptions.rb
|
118
|
-
- lib/currency_converter/google.rb
|
119
118
|
- lib/currency_converter/version.rb
|
119
|
+
- lib/currency_converter/xe.rb
|
120
120
|
- lib/currency_converter/yahoo.rb
|
121
|
-
- spec/currency_converter/
|
121
|
+
- spec/currency_converter/xe_spec.rb
|
122
122
|
- spec/currency_converter/yahoo_spec.rb
|
123
123
|
- spec/spec_helper.rb
|
124
124
|
homepage: https://github.com/dark-prince/currency_converter
|
@@ -144,10 +144,10 @@ rubyforge_project:
|
|
144
144
|
rubygems_version: 2.6.14
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
|
-
summary:
|
148
|
-
|
149
|
-
|
147
|
+
summary: Simple Ruby API to get exchange rates from currencies using Yahoo finance
|
148
|
+
currency converter and XE currency converter. You can convert currencies directly
|
149
|
+
through this library.
|
150
150
|
test_files:
|
151
|
-
- spec/currency_converter/
|
151
|
+
- spec/currency_converter/xe_spec.rb
|
152
152
|
- spec/currency_converter/yahoo_spec.rb
|
153
153
|
- spec/spec_helper.rb
|