concurrency 0.1.1 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ed83f318b807a88fb5036d8cd669b3d6a2f074a
4
- data.tar.gz: 9e0faff446eb3c76fdee5c914e4461abf993055b
3
+ metadata.gz: c1a602a8ab97c46bd2dcbda2dd955c925220ff81
4
+ data.tar.gz: 2d1241c6210d69d7fc38860853227f153942416d
5
5
  SHA512:
6
- metadata.gz: abcdab96aedcdabcdfaef71d4f49938e11a8599bca8629fd6aa7aa96e5039dab15b1ab9ba8ca81c2e8055388c6e5736af8f3d2ab8594aaed61f2b4334d70a700
7
- data.tar.gz: 080a7a30ce8325401c7e16bc882edccc3a0677ec66a8a8c5912b59257b4d759029cce9578bf2be917eb901dd5fd9201f7f69a678015dd0d411ab80cefbfbe343
6
+ metadata.gz: 7259ba21a20b46817abc466334354761e8adbb096a73dac238d70fb66f58765c3de6e07f9f9b66848e6fca854dd99bbda594a71d5269e68f9462f842956c9755
7
+ data.tar.gz: 38eb0d5ac2798f5a083fab0e101c86805cd902bbbe1a9e3ed7e5abab3a55e6c4b4ddfb487f769ecbac7d5b340aaaa21278fb0398aaa8fb088b00b006bc8acf92
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Concurrency
2
2
 
3
- Concurrency is a lightweight gem that can be deployed for foreign exchange and currency conversion operation complying the latest rates (provided by the [fixer.io](fixer.io) API)
3
+ Concurrency is a lightweight gem that can be deployed for foreign exchange and currency conversion operation complying the latest rates provided by [https://free.currencyconverterapi.com/](https://free.currencyconverterapi.com)
4
+ It should be noted that the rates provided by the parent API are refreshed every 30 minutes and are not in real time.
4
5
 
5
6
  ## Features
6
7
 
@@ -36,7 +37,7 @@ This gem can implement the currency conversion operation for the following natio
36
37
  "THB" - Thai Baht,
37
38
  "TRY" - Turkish Lira,
38
39
  "USD" - United States Dollar,
39
- "ZAR" - South African Rand,
40
+ "ZAR" - South African Rand,
40
41
 
41
42
  This gem requires JSON. If you're using JRuby < 1.7.0 you'll need to add gem "json" to your Gemfile or similar.
42
43
 
@@ -58,14 +59,14 @@ Or install it yourself as:
58
59
 
59
60
  ## Usage
60
61
 
61
- You may use the following functions in your Models, Controllers or Views
62
-
63
62
  ```ruby
64
- Concurrency.convert(ORIGINAL_VALUE, ORIGINAL_CURRENCY, FINAL_CURRENCY)
63
+ Concurrency.convert(AMOUNT_TO_BE_CONVERTED, CONVERT_FROM_CURRENCY, CONVERT_TO_CURRENCY)
65
64
  ```
66
65
 
67
66
  ```ruby
68
67
  Concurrency.convert(100, "NZD", "INR") # would convert 100 New Zealand Dollars to Indian Rupees
68
+ ```
69
+ ```irb
69
70
  <%= Concurrency.convert(100, "NZD", "INR") %>
70
71
  ```
71
72
 
@@ -1,3 +1,3 @@
1
1
  module Concurrency
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/concurrency.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'concurrency/configuration'
2
2
  require "concurrency/version"
3
- require 'net/http'
3
+ require 'net/https'
4
4
  require 'json'
5
5
 
6
6
  module Concurrency
@@ -54,14 +54,14 @@ module Concurrency
54
54
  end
55
55
 
56
56
  def self.get_rate(from, to)
57
- url = "http://api.fixer.io/latest?base=#{from}&symbols=#{to}"
57
+ url = "https://free.currencyconverterapi.com/api/v3/convert?q=#{from}_#{to}&compact=ultra"
58
58
  uri = URI(url)
59
59
  response = Net::HTTP.get(uri)
60
60
  if response == nil
61
61
  return nil
62
62
  else
63
63
  parsed_response = JSON.parse(response)
64
- rate = (parsed_response["rates"]["#{to}"]).to_f
64
+ rate = (parsed_response["#{from}_#{to}"]).to_f
65
65
  return rate
66
66
  end
67
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naman Wadhwa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-04 00:00:00.000000000 Z
11
+ date: 2018-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.5.1
95
+ rubygems_version: 2.6.11
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: A lightweight gem for foreign exchange and currency conversion.