currency_coin_converter 0.2.1 → 0.2.3

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: a182369e128d660b9dc7b36a9ad44a50437cf7444e95b0acc6ff13f0678718c6
4
- data.tar.gz: 7a8d8e49d56ee1e4fed8ae7c3883be607ef735313585c5632145c3ef181e3a9e
3
+ metadata.gz: 2c7cfcbcd10be6520f28a5d4f1303ffda17fa230a32952c4175fb60edf7b933f
4
+ data.tar.gz: a2df0e5b994fd39c75cd61508bd367886464e152c71ef808eff207ea6fabb8d1
5
5
  SHA512:
6
- metadata.gz: 262c7636e14cabe669a70277dd130206f1ca975a757cb9e354302b70629b5c3cb1d1c84b52e360e7a6c1dc542892c0dff07d112d0d459cc3bd53f6aee2fb1d1f
7
- data.tar.gz: '09641cac7e13f00a21cd5195d54057bc67ad998aa8bda0164547f739476faaec32ce0e1c372524d7c1d68fcbeebc4bcc39201fccfe5edf79d195ee4f8ef80f68'
6
+ metadata.gz: 0225af8e138fcdfb33143d93c6b4df92acd6a757ad40efe51337d23cac1cca34c6ca10760fe3a5b3a73c587d10486675164e843f4cf4a0807ad5b9c5db13b3fd
7
+ data.tar.gz: 0d8a720960595f48fc6e872c491a2c49ffefee5aa027a6da60d47b76f9ea1dc2c78b4f3e71c6717c7363011ffcdcaaecb1ed18041420098c79553c38dde161ab
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.1] - 2024-09-10
3
+ ## [0.2.3] - 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
@@ -1,34 +1,42 @@
1
1
  # CurrencyCoinConverter
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/currency_converter`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
3
  ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
4
  Install the gem and add to the application's Gemfile by executing:
12
5
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
6
+ $ bundle add currency_coin_converter
7
+
8
+ Or add in your Gemfile
9
+ ```
10
+ gem 'currency_coin_converter'
11
+ ```
12
+ Run in console
13
+ ```
14
+ bundle install
15
+ ```
14
16
 
15
17
  If bundler is not being used to manage dependencies, install the gem by executing:
16
18
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
19
+ $ gem install currency_coin_converter
18
20
 
19
21
  ## Usage
22
+ To use this gem, you need to set up an environment variable for the Exchange Rate API key:
20
23
 
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
+ ```bash
25
+ export EXCHANGE_RATE_API_KEY='your_api_key_here'
26
+ ```
27
+ <br>
24
28
 
25
- 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.
29
+ In your main file you can use
30
+ ```
31
+ require 'currency_coin_converter'
26
32
 
27
- 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
+ ```
28
36
 
29
37
  ## Contributing
30
38
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/currency_converter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/currency_converter/blob/master/CODE_OF_CONDUCT.md).
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bussularf/currency_coin_converter.
32
40
 
33
41
  ## License
34
42
 
@@ -36,4 +44,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
36
44
 
37
45
  ## Code of Conduct
38
46
 
39
- Everyone interacting in the CurrencyConverter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/currency_converter/blob/master/CODE_OF_CONDUCT.md).
47
+ Everyone interacting in the CurrencyConverter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bussularf/currency_coin_converter/blob/master/CODE_OF_CONDUCT.md).
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "Uma gem para conversão de moedas usando ExchangeRate-API."
12
12
  spec.description = "Esta gem permite converter valores entre diferentes moedas usando a API da ExchangeRate."
13
- spec.homepage = 'https://github.com/bussularf/currency_converter'
13
+ spec.homepage = 'https://github.com/bussularf/currency_coin_converter'
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.6.0"
16
16
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  # URL do projeto no GitHub
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = 'https://github.com/bussularf/currency_converter'
21
+ spec.metadata["source_code_uri"] = 'https://github.com/bussularf/currency_coin_converter'
22
22
 
23
23
  # Arquivos incluídos na gem
24
24
  spec.files = Dir.chdir(__dir__) do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CurrencyCoinConverter
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
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.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernanda de Jesus
@@ -47,13 +47,13 @@ files:
47
47
  - lib/currency_coin_converter/version.rb
48
48
  - sig/currency_coin_converter.rbs
49
49
  - spec/currency_coin_converter_spec.rb
50
- homepage: https://github.com/bussularf/currency_converter
50
+ homepage: https://github.com/bussularf/currency_coin_converter
51
51
  licenses:
52
52
  - MIT
53
53
  metadata:
54
54
  allowed_push_host: https://rubygems.org
55
- homepage_uri: https://github.com/bussularf/currency_converter
56
- source_code_uri: https://github.com/bussularf/currency_converter
55
+ homepage_uri: https://github.com/bussularf/currency_coin_converter
56
+ source_code_uri: https://github.com/bussularf/currency_coin_converter
57
57
  post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths: