Class: Lpt::Environment
- Inherits:
-
Object
- Object
- Lpt::Environment
- Defined in:
- lib/lpt/environment.rb
Constant Summary collapse
- PRODUCTION =
90- DEMO =
80- STAGING =
60- SANDBOX =
50- NEXT =
40- IVV =
30- TEST =
20- DEV =
10- ENVIRONMENTS =
{ "production" => PRODUCTION, "demo" => DEMO, "staging" => STAGING, "sandbox" => SANDBOX, "next" => NEXT, "ivv" => IVV, "test" => TEST, "dev" => DEV }.freeze
- BASE_DOMAINS =
{ PRODUCTION => "lacorepayments.com", DEMO => "dmo.lacorepayments.com", STAGING => "lacorepayments.com", SANDBOX => "sbx.lacorepayments.com", NEXT => "nxt.lacorepayments.com", IVV => "ivv.lacorepayments.com", TEST => "test.lpt.local", DEV => "lpt.local" }.freeze
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Returns the value of attribute api_base.
-
#base_domain ⇒ Object
Returns the value of attribute base_domain.
-
#cx_api_base ⇒ Object
Returns the value of attribute cx_api_base.
-
#cx_base ⇒ Object
Returns the value of attribute cx_base.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #api_base_url(with_protocol: true) ⇒ Object
- #cx_api_base_url ⇒ Object
- #cx_base_url ⇒ Object
-
#initialize(api_base: "", cx_base: "", cx_api_base: "", base_domain: "") ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(api_base: "", cx_base: "", cx_api_base: "", base_domain: "") ⇒ Environment
Returns a new instance of Environment.
38 39 40 41 42 43 |
# File 'lib/lpt/environment.rb', line 38 def initialize(api_base: "", cx_base: "", cx_api_base: "", base_domain: "") @api_base = api_base @cx_base = cx_base @cx_api_base = cx_api_base @base_domain = base_domain end |
Instance Attribute Details
#api_base ⇒ Object
Returns the value of attribute api_base.
36 37 38 |
# File 'lib/lpt/environment.rb', line 36 def api_base @api_base end |
#base_domain ⇒ Object
Returns the value of attribute base_domain.
36 37 38 |
# File 'lib/lpt/environment.rb', line 36 def base_domain @base_domain end |
#cx_api_base ⇒ Object
Returns the value of attribute cx_api_base.
36 37 38 |
# File 'lib/lpt/environment.rb', line 36 def cx_api_base @cx_api_base end |
#cx_base ⇒ Object
Returns the value of attribute cx_base.
36 37 38 |
# File 'lib/lpt/environment.rb', line 36 def cx_base @cx_base end |
Class Method Details
.factory(environment: DEV) ⇒ Object
71 72 73 74 75 |
# File 'lib/lpt/environment.rb', line 71 def factory(environment: DEV) args = Lpt.base_addresses(environment: environment) args[:base_domain] = BASE_DOMAINS[environment] new(**args) end |
.production ⇒ Object
67 68 69 |
# File 'lib/lpt/environment.rb', line 67 def production factory(environment: PRODUCTION) end |
.staging ⇒ Object
63 64 65 |
# File 'lib/lpt/environment.rb', line 63 def staging factory(environment: STAGING) end |
Instance Method Details
#==(other) ⇒ Object
45 46 47 48 |
# File 'lib/lpt/environment.rb', line 45 def ==(other) api_base == other.api_base && base_domain == other.base_domain && cx_base == other.cx_base && cx_api_base == other.cx_api_base end |
#api_base_url(with_protocol: true) ⇒ Object
50 51 52 |
# File 'lib/lpt/environment.rb', line 50 def api_base_url(with_protocol: true) base_url(api_base, with_protocol: with_protocol) end |
#cx_api_base_url ⇒ Object
58 59 60 |
# File 'lib/lpt/environment.rb', line 58 def cx_api_base_url base_url(cx_api_base) end |
#cx_base_url ⇒ Object
54 55 56 |
# File 'lib/lpt/environment.rb', line 54 def cx_base_url base_url(cx_base) end |