Module: FatZebra
- Extended by:
- FatZebra, Forwardable
- Included in:
- FatZebra
- Defined in:
- lib/fat_zebra.rb,
lib/fat_zebra/config.rb,
lib/fat_zebra/errors.rb,
lib/fat_zebra/gateway.rb,
lib/fat_zebra/version.rb,
lib/fat_zebra/models/base.rb,
lib/fat_zebra/models/card.rb,
lib/fat_zebra/models/refund.rb,
lib/fat_zebra/models/purchase.rb,
lib/fat_zebra/models/response.rb
Defined Under Namespace
Modules: Models Classes: Config, Gateway, GatewayError, InvalidArgumentError, RequestError
Constant Summary collapse
- VERSION =
"2.0.0"
Instance Attribute Summary collapse
-
#_gateway ⇒ Object
Returns the value of attribute _gateway.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#configure(auth = nil, &block) ⇒ Object
Configure the Fat Zebra gateway.
- #configure_gateway ⇒ Object
- #gateway ⇒ Object
Instance Attribute Details
#_gateway ⇒ Object
Returns the value of attribute _gateway.
22 23 24 |
# File 'lib/fat_zebra.rb', line 22 def _gateway @_gateway end |
#config ⇒ Object
Returns the value of attribute config.
21 22 23 |
# File 'lib/fat_zebra.rb', line 21 def config @config end |
Instance Method Details
#configure(auth = nil, &block) ⇒ Object
Configure the Fat Zebra gateway
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fat_zebra.rb', line 25 def configure(auth = nil, &block) raise ArgumentError, "missing authentication parameters or block" unless auth || block_given? if !auth self.config = Config.new if (block.arity > 0) block.call(self.config) else self.config.instance_eval(&block) end else self.config = Config.from_hash(auth) end self.config.validate! self.configure_gateway self.config end |
#configure_gateway ⇒ Object
46 47 48 |
# File 'lib/fat_zebra.rb', line 46 def configure_gateway self._gateway = Gateway.configure(self.config) end |
#gateway ⇒ Object
50 51 52 53 |
# File 'lib/fat_zebra.rb', line 50 def gateway raise GatewayError.new("Please configure the Gateway before use. See FatZebra.configure { }") if self.config.nil? self._gateway end |