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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d941b72d7db2416895b8934b4acac8fd2739f3e
4
- data.tar.gz: 03e7bd53d1984e7d0e17200f18af2f111e37e407
3
+ metadata.gz: d45725edff9a07f66ded535e222a77108d5745d0
4
+ data.tar.gz: 25963d340bbb1e36f594d05f07949fdd0b0ee693
5
5
  SHA512:
6
- metadata.gz: e9011f2aef8d40a5a1bf471e4f9a85ebeecf693b2c2fa6ccf0927ed4dceb929687deb56f4d04f1f1dacb75aed8e9eaa18c3f91d3dbf3338e072d096ff56d68a1
7
- data.tar.gz: 3e358814142b2d4b06780f0ac742ee6e430af20c04eff51fb99e4d0b80f993e3e7f5d3d57437079fd18f7e5b854af80fba6dc96b5c93ccda88195886b2c6fdad
6
+ metadata.gz: e757987c3a8ea96e2438f55c25d7d0f03573484b3bed1fd14c0514ff8ff24bad9eccf7614abaf18d642f685ebfd742256f3b84083797f5c8e4a78ef6d97d67f1
7
+ data.tar.gz: b7fb3b72320ec2dd523b3a5cfde747d36a535243034bae0dcfae43ad769f3d3168594dfda8c04b4e3aaf1b0d61b6185ee44d15513409f1210c92e2d38564058b
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
4
  - 2.1.0
6
5
  - 2.1.1
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # CurrencyConverter
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/currency_converter.svg)](http://badge.fury.io/rb/currency_converter) [![Build Status](https://travis-ci.org/dark-prince/currency_converter.svg)](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/dark-prince/currency_converter/badge.png?branch=master)](https://coveralls.io/r/dark-prince/currency_converter?branch=master)
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 Google finance currency converter and Yahoo finance currency converter. You can convert currencies directly through this library.
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 Google finance currency converter:
23
+ To convert between two currencies using XE currency converter:
24
24
 
25
- currency_converter = CurrencyConverter::Google.new
25
+ currency_converter = CurrencyConverter::XE.new
26
26
  currency_converter.exchange('EUR', 'USD', 100)
27
27
  => 132.89
28
28
 
@@ -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{Google provides a web site to converts currencies using exchange rates but they have not provided any API for ruby. This is a small library that converts currencies exchange rate. You can convert currencies directly through this library.}
15
- spec.summary = %q{Google provides a web site to converts currencies using exchange rates but they have not provided any API for ruby. This is a small library that converts currencies exchange rate. You can convert currencies directly through this library.}
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($/)
@@ -1,3 +1,3 @@
1
1
  require 'currency_converter/version'
2
- require 'currency_converter/google'
2
+ require 'currency_converter/xe'
3
3
  require 'currency_converter/yahoo'
@@ -1,3 +1,3 @@
1
1
  module CurrencyConverter
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -4,7 +4,7 @@ require 'net/http'
4
4
  require 'nokogiri'
5
5
 
6
6
  module CurrencyConverter
7
- class Google
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::Google.new
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('themoneyconverter.com', 443)
42
- http.use_ssl = true
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('div.cc-rate div#cc-ratebox').first.text
47
+ result = doc.css('span.uccResultAmount').text
49
48
 
50
49
  regexp = Regexp.new('(\\d+(?:\\.\\d+)?)')
51
50
  regexp.match result
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CurrencyConverter::Google do
3
+ describe CurrencyConverter::XE do
4
4
  let(:currency_converter) { described_class.new }
5
5
 
6
6
  context '#exchange' do
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.2
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: 2017-12-21 00:00:00.000000000 Z
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: Google provides a web site to converts currencies using exchange rates
98
- but they have not provided any API for ruby. This is a small library that converts
99
- currencies exchange rate. You can convert currencies directly through this library.
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/google_spec.rb
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: Google provides a web site to converts currencies using exchange rates but
148
- they have not provided any API for ruby. This is a small library that converts currencies
149
- exchange rate. You can convert currencies directly through this library.
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/google_spec.rb
151
+ - spec/currency_converter/xe_spec.rb
152
152
  - spec/currency_converter/yahoo_spec.rb
153
153
  - spec/spec_helper.rb