Module: Workarea::Zipco
- Defined in:
- lib/workarea/zipco.rb,
lib/workarea/zipco/engine.rb,
lib/workarea/zipco/gateway.rb,
lib/workarea/zipco/version.rb,
lib/workarea/zipco/response.rb,
lib/workarea/zipco/bogus_gateway.rb,
app/services/workarea/zipco/order.rb,
app/services/workarea/zipco/setup.rb,
app/services/workarea/zipco/checkout.rb
Defined Under Namespace
Classes: BogusGateway, Checkout, Engine, Gateway, Order, Response, Setup
Constant Summary
collapse
- RETRY_ERROR_STATUSES =
500..599
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
23
24
25
|
# File 'lib/workarea/zipco.rb', line 23
def self.config
Workarea.config.zipco
end
|
.credentials ⇒ Object
19
20
21
|
# File 'lib/workarea/zipco.rb', line 19
def self.credentials
(Rails.application.secrets.zipco || {}).deep_symbolize_keys
end
|
Conditionally use the real gateway when secrets are present. Otherwise, use the bogus gateway.
40
41
42
43
44
45
46
|
# File 'lib/workarea/zipco.rb', line 40
def self.gateway(options = {})
if credentials.present?
Zipco::Gateway.new(secret_key: secret_key, api_version: config.api_version)
else
Zipco::BogusGateway.new
end
end
|
.secret_key ⇒ Object
27
28
29
30
|
# File 'lib/workarea/zipco.rb', line 27
def self.secret_key
return unless credentials.present?
credentials[:secret_key]
end
|
.test? ⇒ Boolean
32
33
34
|
# File 'lib/workarea/zipco.rb', line 32
def self.test?
config[:test]
end
|