currency_coin_converter 0.2.2 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48ce21a619c30424491015b4dd7cb14055fb60089b59c898f6d54a5dcba43b1d
4
- data.tar.gz: 80020d418b73c4b8a1125dbe1761993c161d0b02b38776002d8d5ee793a50679
3
+ metadata.gz: 1d1075c2ccce1bb397d4a219bcecd2d60c291eec8d73825119763781b67e9c63
4
+ data.tar.gz: a7ba25a815b3008c7df632099b8b6e29e87f0c8f768cbf8e69d6739c67d652cf
5
5
  SHA512:
6
- metadata.gz: f3d088f5d16af0166bf33c8691fa49c4ad803f4dee99c3cf96179f3319f141ecd851edbe10b39a1405255b2d761563a3503324060b2a6ddedf33dc449efb9bc5
7
- data.tar.gz: 0dd7e3053e879a1c34e6d40a0febce59c285b36facaead1be700837fb2e5a749159efe51a1fe5aa9564c0021770de7f69474c624f83dd19ffd67a171e859fa90
6
+ metadata.gz: a612e5347ed886e5768fbc2b332e0987482573562aba0650c47fdc3a9624aed17769ea5a323934cb8620d5cbc77acfdc9ecc8f0d223d1da828c5f2ff3be7318c
7
+ data.tar.gz: 25307919d3ee45aad6159c1e8b420fde3f5e58b4d201a261ce301db64eab19da32c936c9172e10778f3c417943db945be5f19f043996a6897b9f67bef15c6c4c
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .env
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.2.2] - 2024-09-10
3
+ ## [0.2.4] - 2024-09-10
4
4
 
5
5
  - Initial release
data/Gemfile CHANGED
@@ -7,3 +7,5 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
  gem 'httparty'
10
+ gem 'dotenv'
11
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- currency_coin_converter (0.1.0)
4
+ currency_coin_converter (0.2.2)
5
5
  httparty (~> 0.18)
6
6
 
7
7
  GEM
@@ -9,6 +9,7 @@ GEM
9
9
  specs:
10
10
  bigdecimal (3.1.8)
11
11
  csv (3.3.0)
12
+ dotenv (3.1.2)
12
13
  httparty (0.22.0)
13
14
  csv
14
15
  mini_mime (>= 1.0.0)
@@ -23,6 +24,7 @@ PLATFORMS
23
24
 
24
25
  DEPENDENCIES
25
26
  currency_coin_converter!
27
+ dotenv
26
28
  httparty
27
29
  rake (~> 13.0)
28
30
 
data/README.md CHANGED
@@ -6,26 +6,33 @@ Install the gem and add to the application's Gemfile by executing:
6
6
  $ bundle add currency_coin_converter
7
7
 
8
8
  Or add in your Gemfile
9
- `gem 'currency_coin_converter'`
9
+ ```
10
+ gem 'currency_coin_converter'
11
+ ```
10
12
  Run in console
11
- `bundle install`
13
+ ```
14
+ bundle install
15
+ ```
12
16
 
13
17
  If bundler is not being used to manage dependencies, install the gem by executing:
14
18
 
15
19
  $ gem install currency_coin_converter
16
20
 
17
21
  ## Usage
22
+ To use this gem, you need to set up an environment variable for the Exchange Rate API key:
18
23
 
19
- `require 'currency_coin_converter'`
24
+ ```bash
25
+ export EXCHANGE_RATE_API_KEY='your_api_key_here'
26
+ ```
27
+ <br>
20
28
 
21
- `amount_in_euros = CurrencyCoinConverter.convert(100, from: "USD", to: "EUR")`
22
- `puts amount_in_euros`
29
+ In your main file you can use
30
+ ```
31
+ require 'currency_coin_converter'
23
32
 
24
- ## Development
25
-
26
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
27
-
28
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+ amount_in_euros = CurrencyCoinConverter.convert(100, from: "USD", to: "EUR")
34
+ puts amount_in_euros
35
+ ```
29
36
 
30
37
  ## Contributing
31
38
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Fernanda de Jesus"]
9
9
  spec.email = ["fernandabussular@gmail.com"]
10
10
 
11
- spec.summary = "Uma gem para conversão de moedas usando ExchangeRate-API."
12
- spec.description = "Esta gem permite converter valores entre diferentes moedas usando a API da ExchangeRate."
11
+ spec.summary = "A gem for currency conversion using the ExchangeRate API."
12
+ spec.description = "This gem allows you to convert amounts between different currencies using the ExchangeRate API."
13
13
  spec.homepage = 'https://github.com/bussularf/currency_coin_converter'
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.6.0"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CurrencyCoinConverter
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.4"
5
5
  end
@@ -1,10 +1,11 @@
1
1
  require_relative './currency_coin_converter/version'
2
2
  require 'httparty'
3
+ require 'dotenv/load'
3
4
 
4
5
  module CurrencyCoinConverter
5
6
  class Error < StandardError; end
6
7
 
7
- API_URL = "https://v6.exchangerate-api.com/v6/943cde42b6f9a6628b0900ec/latest/"
8
+ API_URL = "https://v6.exchangerate-api.com/v6/#{ENV['EXCHANGE_RATE_API_KEY']}/latest/"
8
9
 
9
10
  def self.convert(amount, from:, to:)
10
11
  rates = fetch_rates(from)
@@ -1,7 +1,10 @@
1
- # spec/currency_coin_converter_spec.rb
2
1
  require 'currency_coin_converter'
3
2
 
4
3
  RSpec.describe CurrencyCoinConverter do
4
+ before do
5
+ allow(ENV).to receive(:[]).with('EXCHANGE_RATE_API_KEY').and_return('fake_key')
6
+ end
7
+
5
8
  it "converte corretamente entre duas moedas" do
6
9
  allow(CurrencyCoinConverter).to receive(:fetch_rates).with("USD").and_return({"EUR" => 0.85})
7
10
 
@@ -9,3 +12,4 @@ RSpec.describe CurrencyCoinConverter do
9
12
  expect(result).to eq(85.0)
10
13
  end
11
14
  end
15
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_coin_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernanda de Jesus
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.18'
27
- description: Esta gem permite converter valores entre diferentes moedas usando a API
28
- da ExchangeRate.
27
+ description: This gem allows you to convert amounts between different currencies using
28
+ the ExchangeRate API.
29
29
  email:
30
30
  - fernandabussular@gmail.com
31
31
  executables: []
@@ -72,5 +72,5 @@ requirements: []
72
72
  rubygems_version: 3.4.10
73
73
  signing_key:
74
74
  specification_version: 4
75
- summary: Uma gem para conversão de moedas usando ExchangeRate-API.
75
+ summary: A gem for currency conversion using the ExchangeRate API.
76
76
  test_files: []