-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e63caa
commit 9277cf6
Showing
116 changed files
with
52,093 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.env | ||
coverage | ||
Gemfile.lock | ||
spec/examples.txt | ||
spec/vcr_cassettes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
# Declare your dependencies in eml.gemspec | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "http" | ||
|
||
require "eml/version" | ||
require "eml/api_operations" | ||
require "eml/uk" | ||
require "sorbet-runtime" | ||
|
||
module EML | ||
end | ||
|
||
require "eml/data/countries" | ||
require "eml/data/currencies" | ||
require "eml/data/states" | ||
|
||
require "eml/config" | ||
require "eml/environment" | ||
require "eml/error" | ||
require "eml/lib/endpoint_class" | ||
require "eml/parameters" | ||
require "eml/payload" | ||
require "eml/response" | ||
require "eml/uk" | ||
require "eml/version" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# typed: ignore | ||
# frozen_string_literal: true | ||
|
||
module EML | ||
class Config | ||
extend T::Sig | ||
|
||
sig { returns(EML::Environment.class) } | ||
def environment | ||
EML::Environment | ||
end | ||
|
||
sig { params(value: Symbol).void } | ||
def environment=(value) | ||
EML::Environment.set(value) | ||
end | ||
|
||
sig { params(param: Symbol).returns(String) } | ||
def require(param) | ||
value = public_send(param) | ||
return value unless value.nil? || value.empty? | ||
|
||
require_error(param) | ||
end | ||
|
||
sig { params(param: Symbol).returns(String) } | ||
def require_parameter(param) | ||
require(param) | ||
rescue ArgumentError => e | ||
message = e.message + "\n" \ | ||
"Alternatively, you can pass dynamic values with your request " \ | ||
"parameters" | ||
raise ArgumentError, message | ||
end | ||
|
||
private | ||
|
||
sig { params(param: Symbol).void } | ||
def require_error(param) | ||
raise( | ||
ArgumentError, | ||
"#{param} is required but hasn't been set.\n" \ | ||
"EML::Config.configuration do |config|\n" + | ||
%( config.#{param} = "value") + "\n" \ | ||
"end" | ||
) | ||
end | ||
end | ||
end |
Oops, something went wrong.