omni_exchange 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3d30d7e4e3e64ec5ad04a09977b9320fc3fa057b6467522f69e13f8b7449086d
4
+ data.tar.gz: ebfc182f603c08030550a23be4348f6126cfaa83cced86bd4af73fe7d2f485df
5
+ SHA512:
6
+ metadata.gz: 94df50122f3b0f827111c2b8ea5af33fafc4ef3c3202a80b1d8de0170113283f2bcbb2f8216de175bb2e3bb584231e68b5be3687be4185fb3faac73748dd7658
7
+ data.tar.gz: e2aaa25ab94143cf25fb3b86ee659df937f75f197e0d48c06d0bb561dd732d7d6eff79ada826dad10accb17589900a1cb74190a7167fb3a931f8ccc39f041e6a
data/.DS_Store ADDED
Binary file
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.3
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.3
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ #Ignore .env file
14
+ .env
15
+
16
+ sandbox.rb
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,113 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ Layout/BeginEndAlignment: # (new in 0.91)
6
+ Enabled: true
7
+ Layout/EmptyLinesAroundAttributeAccessor: # (new in 0.83)
8
+ Enabled: true
9
+ Layout/SpaceAroundMethodCallOperator: # (new in 0.82)
10
+ Enabled: true
11
+ Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
12
+ Enabled: true
13
+ Lint/ConstantDefinitionInBlock: # (new in 0.91)
14
+ Enabled: true
15
+ Lint/DeprecatedOpenSSLConstant: # (new in 0.84)
16
+ Enabled: true
17
+ Lint/DuplicateElsifCondition: # (new in 0.88)
18
+ Enabled: true
19
+ Lint/DuplicateRequire: # (new in 0.90)
20
+ Enabled: true
21
+ Lint/DuplicateRescueException: # (new in 0.89)
22
+ Enabled: true
23
+ Lint/EmptyConditionalBody: # (new in 0.89)
24
+ Enabled: true
25
+ Lint/EmptyFile: # (new in 0.90)
26
+ Enabled: true
27
+ Lint/FloatComparison: # (new in 0.89)
28
+ Enabled: true
29
+ Lint/HashCompareByIdentity: # (new in 0.93)
30
+ Enabled: true
31
+ Lint/IdentityComparison: # (new in 0.91)
32
+ Enabled: true
33
+ Lint/MissingSuper: # (new in 0.89)
34
+ Enabled: true
35
+ Lint/MixedRegexpCaptureTypes: # (new in 0.85)
36
+ Enabled: true
37
+ Lint/OutOfRangeRegexpRef: # (new in 0.89)
38
+ Enabled: true
39
+ Lint/RaiseException: # (new in 0.81)
40
+ Enabled: true
41
+ Lint/RedundantSafeNavigation: # (new in 0.93)
42
+ Enabled: true
43
+ Lint/SelfAssignment: # (new in 0.89)
44
+ Enabled: true
45
+ Lint/StructNewOverride: # (new in 0.81)
46
+ Enabled: true
47
+ Lint/TopLevelReturnWithArgument: # (new in 0.89)
48
+ Enabled: true
49
+ Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
50
+ Enabled: true
51
+ Lint/UnreachableLoop: # (new in 0.89)
52
+ Enabled: true
53
+ Lint/UselessMethodDefinition: # (new in 0.90)
54
+ Enabled: true
55
+ Lint/UselessTimes: # (new in 0.91)
56
+ Enabled: true
57
+ Style/AccessorGrouping: # (new in 0.87)
58
+ Enabled: true
59
+ Style/BisectedAttrAccessor: # (new in 0.87)
60
+ Enabled: true
61
+ Style/CaseLikeIf: # (new in 0.88)
62
+ Enabled: true
63
+ Style/ClassEqualityComparison: # (new in 0.93)
64
+ Enabled: true
65
+ Style/CombinableLoops: # (new in 0.90)
66
+ Enabled: true
67
+ Style/ExplicitBlockArgument: # (new in 0.89)
68
+ Enabled: true
69
+ Style/ExponentialNotation: # (new in 0.82)
70
+ Enabled: true
71
+ Style/GlobalStdStream: # (new in 0.89)
72
+ Enabled: true
73
+ Style/HashAsLastArrayItem: # (new in 0.88)
74
+ Enabled: true
75
+ Style/HashEachMethods: # (new in 0.80)
76
+ Enabled: true
77
+ Style/HashLikeCase: # (new in 0.88)
78
+ Enabled: true
79
+ Style/HashTransformKeys: # (new in 0.80)
80
+ Enabled: true
81
+ Style/HashTransformValues: # (new in 0.80)
82
+ Enabled: true
83
+ Style/KeywordParametersOrder: # (new in 0.90)
84
+ Enabled: true
85
+ Style/OptionalBooleanParameter: # (new in 0.89)
86
+ Enabled: true
87
+ Style/RedundantAssignment: # (new in 0.87)
88
+ Enabled: true
89
+ Style/RedundantFetchBlock: # (new in 0.86)
90
+ Enabled: true
91
+ Style/RedundantFileExtensionInRequire: # (new in 0.88)
92
+ Enabled: true
93
+ Style/RedundantRegexpCharacterClass: # (new in 0.85)
94
+ Enabled: true
95
+ Style/RedundantRegexpEscape: # (new in 0.85)
96
+ Enabled: true
97
+ Style/RedundantSelfAssignment: # (new in 0.90)
98
+ Enabled: true
99
+ Style/SingleArgumentDig: # (new in 0.89)
100
+ Enabled: true
101
+ Style/SlicingWithRange: # (new in 0.83)
102
+ Enabled: true
103
+ Style/SoleNestedConditional: # (new in 0.89)
104
+ Enabled: true
105
+ Style/StringConcatenation: # (new in 0.89)
106
+ Enabled: true
107
+ Metrics/BlockLength:
108
+ Exclude:
109
+ - 'spec/**/*'
110
+ Metrics/MethodLength:
111
+ Max: 50
112
+ Gemspec/RequiredRubyVersion:
113
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,47 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-06-20 08:25:31 UTC using RuboCop version 0.93.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: IgnoredMethods.
11
+ Metrics/AbcSize:
12
+ Max: 27
13
+
14
+ # Offense count: 1
15
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
16
+ # ExcludedMethods: refine
17
+ Metrics/BlockLength:
18
+ Max: 26
19
+
20
+ # Offense count: 1
21
+ Naming/AccessorMethodName:
22
+ Exclude:
23
+ - 'lib/omni_exchange/provider.rb'
24
+
25
+ # Offense count: 4
26
+ Style/Documentation:
27
+ Exclude:
28
+ - 'spec/**/*'
29
+ - 'test/**/*'
30
+ - 'lib/omni_exchange/configuration.rb'
31
+ - 'lib/omni_exchange/provider.rb'
32
+ - 'lib/omni_exchange/providers/open_exchange_rates.rb'
33
+ - 'lib/omni_exchange/providers/xe.rb'
34
+
35
+ # Offense count: 1
36
+ # Configuration parameters: EnforcedStyle.
37
+ # SupportedStyles: scientific, engineering, integral
38
+ Style/ExponentialNotation:
39
+ Exclude:
40
+ - 'spec/omni_exchange_spec.rb'
41
+
42
+ # Offense count: 13
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
45
+ # URISchemes: http, https
46
+ Layout/LineLength:
47
+ Max: 226
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at yunseok_chung@degica.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in omni_exchange.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omni_exchange (0.1.0)
5
+ faraday
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.5.0)
13
+ dotenv (2.7.6)
14
+ faraday (2.3.0)
15
+ faraday-net_http (~> 2.0)
16
+ ruby2_keywords (>= 0.0.4)
17
+ faraday-net_http (2.0.3)
18
+ method_source (1.0.0)
19
+ parallel (1.22.1)
20
+ parser (3.1.2.0)
21
+ ast (~> 2.4.1)
22
+ pry (0.14.1)
23
+ coderay (~> 1.1)
24
+ method_source (~> 1.0)
25
+ rainbow (3.1.1)
26
+ rake (10.5.0)
27
+ regexp_parser (2.5.0)
28
+ rexml (3.2.5)
29
+ rspec (3.11.0)
30
+ rspec-core (~> 3.11.0)
31
+ rspec-expectations (~> 3.11.0)
32
+ rspec-mocks (~> 3.11.0)
33
+ rspec-core (3.11.0)
34
+ rspec-support (~> 3.11.0)
35
+ rspec-expectations (3.11.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.11.0)
38
+ rspec-mocks (3.11.1)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-support (3.11.0)
42
+ rubocop (0.93.1)
43
+ parallel (~> 1.10)
44
+ parser (>= 2.7.1.5)
45
+ rainbow (>= 2.2.2, < 4.0)
46
+ regexp_parser (>= 1.8)
47
+ rexml
48
+ rubocop-ast (>= 0.6.0)
49
+ ruby-progressbar (~> 1.7)
50
+ unicode-display_width (>= 1.4.0, < 2.0)
51
+ rubocop-ast (1.18.0)
52
+ parser (>= 3.1.1.0)
53
+ ruby-progressbar (1.11.0)
54
+ ruby2_keywords (0.0.5)
55
+ unicode-display_width (1.8.0)
56
+ vcr (6.1.0)
57
+
58
+ PLATFORMS
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ dotenv
63
+ omni_exchange!
64
+ pry
65
+ rake (~> 10.0)
66
+ rspec (~> 3.0)
67
+ rubocop (~> 0.80)
68
+ vcr
69
+
70
+ BUNDLED WITH
71
+ 2.3.9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Yun Chung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # OmniExchange
2
+
3
+ OmniExchange converts currencies using up-to-the-minute foreign exchange rates data.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omni_exchange'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omni_exchange
20
+
21
+ ## Usage
22
+
23
+ #### **Step 1) Create an XE and/or Open Exchange Rates Account**
24
+
25
+ OmniExchange currently supports the ability to fetch foreign exchange rates data from XE and Open Exchange Rates. So, in order to use OmniExchange, you will need to sign up for either [XE](https://www.xe.com/xecurrencydata/), [Open Exchange Rates](https://openexchangerates.org/), or both.
26
+
27
+ #### **Step 2) Configure**
28
+
29
+ ```ruby
30
+ OmniExchange.configure do |config|
31
+ config.provider_config = {
32
+ xe: {
33
+ api_id: 'your XE api id here as a string', # REQUIRED TO USE XE
34
+ api_key: 'your XE api id here as a string', # REQUIRED TO USE XE
35
+ # read_timeout: 5, # OPTIONAL; by default, OmniExchange will try to read API data for 5 seconds before timing out
36
+ # connect_timeout: 2 # OPTIONAL; by default, OmniExchange will try to connect to XE for 2 seconds before timing out
37
+ },
38
+ open_exchange_rates: {
39
+ app_id: 'your Open Exchange Rates app id here as a string' # REQUIRED TO USE OPEN EXCHANGE RATES
40
+ # read_timeout: 5, # OPTIONAL; by default, OmniExchange will try to read API data for 5 seconds before timing out
41
+ # connect_timeout: 2 # OPTIONAL; by default, OmniExchange will try to connect to Open Exchange Rates for 2 seconds before timing out
42
+ }
43
+ }
44
+ end
45
+ ```
46
+
47
+ #### **Step 3) Convert Currency**
48
+
49
+ To convert currency, all you have to do is call `OmniExchange.exchange_currency()`. This method requires you to pass the following four named parameters:
50
+ 1. amount: (Integer)the amount of the currency you want to convert. NOTE: OmniExchange will read this amount as being the smallest unit of a currency. In other words, if you pass `10` as the amount for USD, OmniExchange will read this as 10 cents, not 10 dollars.
51
+ 2. base_currency: (String) the ISO Currency Code of the currency that you're exchanging from. ie. 'USD', 'JPY'
52
+ 3. target_currency: (String) the ISO Currency Code of the currency that you're exchanging to. ie. 'EUR', 'KRW'
53
+ 4. providers: (Array) the keys of the API providers that you want data from in order of preference. ie. [:xe, :open_exchange_rates]
54
+
55
+ [For the sake of precise calculation](https://www.bigbinary.com/blog/handling-money-in-ruby), you'll get back a BigDecimal. Simply call `.to_f` to the result if you'd like to see a number that is easier to read.
56
+
57
+
58
+ Here is an example. Lets say I want to convert $10.00 US Dollars to Japanese Yen, and I want it converted using exchange rate data from Open Exchange Rates. If Open Exchange Rates fails, I'd like OmniExchange to try to use exchange rate data from Xe as a fallback.
59
+
60
+ ```ruby
61
+ USD_to_JPY = OmniExchange.exchange_currency(amount: 1000, base_currency: "USD", target_currency: "JPY", providers: [:open_exchange_rates, :xe])
62
+
63
+ puts USD_to_JPY # => 0.1345807e4
64
+ puts USD_to_JPY.to_f # => 1345.807
65
+
66
+ ```
67
+
68
+ ## Development
69
+
70
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
71
+
72
+ 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).
73
+
74
+ ## Contributing
75
+
76
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omni_exchange. 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]/omni_exchange/blob/master/CODE_OF_CONDUCT.md).
77
+
78
+ ## License
79
+
80
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
81
+
82
+ ## Code of Conduct
83
+
84
+ Everyone interacting in the OmniExchange project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/omni_exchange/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'omni_exchange'
6
+ require 'dotenv/load'
7
+ require 'faraday'
8
+ require_relative '../lib/omni_exchange/provider'
9
+ require_relative '../lib/omni_exchange/configuration'
10
+ require_relative '../lib/omni_exchange/providers/xe'
11
+ require_relative '../lib/omni_exchange/providers/open_exchange_rates'
12
+
13
+ # You can add fixtures and/or initialization code here to make experimenting
14
+ # with your gem easier. You can also use a different console, if you like.
15
+
16
+ # (If you use this, don't forget to add pry to your Gemfile!)
17
+ # require 'pry'
18
+ # Pry.start
19
+
20
+ require 'irb'
21
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniExchange
4
+ class Configuration
5
+ attr_accessor :provider_config
6
+
7
+ # unless a read_timeout has been set in :provider_config, a provider
8
+ # will attempt to read an API response for the amount of seconds
9
+ # set as the DEFAULT_READ_TIMEOUT before timing out
10
+ DEFAULT_READ_TIMEOUT = 5
11
+
12
+ # unless a connect_timeout has been set in :provider_config, a provider
13
+ # will attempt to connect to an API for the amount of seconds
14
+ # set as the DEFAULT_CONNECTION_TIMEOUT before timing out
15
+ DEFAULT_CONNECTION_TIMEOUT = 2
16
+
17
+ # an new Configuration instance is instantiated when
18
+ # OmniExchange.configure is called (see lib/omni_exchange.rb)
19
+ def initialize
20
+ @provider_config = nil
21
+ end
22
+ end
23
+ end