concurrency 0.2.0 → 1.0.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: c1a602a8ab97c46bd2dcbda2dd955c925220ff81
4
- data.tar.gz: 2d1241c6210d69d7fc38860853227f153942416d
3
+ metadata.gz: 3fd59ff0ae8e42e480f8a6047fe9c8954700efed
4
+ data.tar.gz: a0be999cdfd213deba0506d7b21a702194764ddf
5
5
  SHA512:
6
- metadata.gz: 7259ba21a20b46817abc466334354761e8adbb096a73dac238d70fb66f58765c3de6e07f9f9b66848e6fca854dd99bbda594a71d5269e68f9462f842956c9755
7
- data.tar.gz: 38eb0d5ac2798f5a083fab0e101c86805cd902bbbe1a9e3ed7e5abab3a55e6c4b4ddfb487f769ecbac7d5b340aaaa21278fb0398aaa8fb088b00b006bc8acf92
6
+ metadata.gz: 05c26eec8ea8c8175de5a290f109f39ef376611ae3824a7762e0a5ae3896be99c77adf6a6faeb1303d8d5957debbe7fe1f49dd3f618dc956686f76b6885138a1
7
+ data.tar.gz: 7eef3c9893dcdf5ca4fee13d3252e728d7e3b6ce5681d5a1d36bfd13acdade1792c8a144f089f5a970c57919b35807896a0167f53cad50f1d3409919502309e5
data/README.md CHANGED
@@ -80,6 +80,7 @@ In order to establish default conversion currencies, paste the following code in
80
80
  Concurrency.configure do |config|
81
81
  config.from_currency = "USD" #Default value
82
82
  config.to_currency = "INR" #Default value
83
+ config.api_key = ENV['CONCURRENCY_APIKEY'] #Mandatory value
83
84
  end
84
85
  ```
85
86
  ```ruby
@@ -94,6 +95,9 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
94
95
 
95
96
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
96
97
 
98
+ Get your API Key here https://free.currencyconverterapi.com/
99
+ API Key is mandatory to get the converstion rates.
100
+
97
101
  ## Contributing
98
102
 
99
103
  Bug reports and pull requests are welcome on GitHub at https://github.com/naman2202/concurrency. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/Rakefile CHANGED
@@ -4,4 +4,8 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
- task :test => :spec
7
+ task :test => :spec
8
+
9
+ task :console do
10
+ exec "irb -r mygem -I ./lib"
11
+ end
@@ -6,7 +6,7 @@ require 'json'
6
6
  module Concurrency
7
7
  class << self
8
8
  attr_accessor :configuration
9
- end
9
+ end
10
10
 
11
11
  def self.configuration
12
12
  @configuration ||= Configuration.new
@@ -54,7 +54,11 @@ module Concurrency
54
54
  end
55
55
 
56
56
  def self.get_rate(from, to)
57
- url = "https://free.currencyconverterapi.com/api/v3/convert?q=#{from}_#{to}&compact=ultra"
57
+ puts "From:#{from}>>TO:#{to}>>APIKEY:#{Concurrency.configuration.api_key}"
58
+ if Concurrency.configuration.api_key.nil?
59
+ raise "API Key is missing. Kindly set API key CONCURRENCY_APIKEY."
60
+ end
61
+ url = "https://free.currencyconverterapi.com/api/v6/convert?q=#{from}_#{to}&compact=ultra&apiKey=#{Concurrency.configuration.api_key}"
58
62
  uri = URI(url)
59
63
  response = Net::HTTP.get(uri)
60
64
  if response == nil
@@ -64,6 +68,5 @@ module Concurrency
64
68
  rate = (parsed_response["#{from}_#{to}"]).to_f
65
69
  return rate
66
70
  end
67
- end
68
-
71
+ end
69
72
  end
@@ -1,10 +1,11 @@
1
1
  module Concurrency
2
2
  class Configuration
3
- attr_accessor :from_currency, :to_currency
3
+ attr_accessor :from_currency, :to_currency, :api_key
4
4
 
5
5
  def initialize
6
6
  @from_currency = "USD"
7
7
  @to_currency = "INR"
8
+ @api_key = ENV['CONCURRENCY_APIKEY']
8
9
  end
9
10
  end
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module Concurrency
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.0"
3
3
  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.2.0
4
+ version: 1.0.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: 2018-03-05 00:00:00.000000000 Z
11
+ date: 2019-03-27 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.6.11
95
+ rubygems_version: 2.6.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: A lightweight gem for foreign exchange and currency conversion.