Class: FatZebra::Config
- Inherits:
-
Object
- Object
- FatZebra::Config
- Defined in:
- lib/fat_zebra/config.rb
Overview
FatZebra Config
Represent the FatZebra configuration for the API
Instance Attribute Summary collapse
-
#api_version ⇒ String
Api version.
-
#gateway ⇒ String
Gateway url.
-
#http_secure ⇒ String
Http secure.
-
#options ⇒ String
Options.
-
#proxy ⇒ String
Proxy url.
-
#sandbox ⇒ String
Sandbox.
-
#test_mode ⇒ String
Test mode.
-
#token ⇒ String
Token.
-
#username ⇒ String
Username.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
Initialize and validate the configuration.
-
#valid! ⇒ Boolean
validate the configuration Raise when configuration is not valid.
Constructor Details
#initialize(options = {}) ⇒ Config
Initialize and validate the configuration
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fat_zebra/config.rb', line 47 def initialize( = {}) self.token = [:token] self.username = [:username] self.gateway = [:gateway] || 'gateway.fatzebra.com.au' self.test_mode = [:test_mode] || false self.http_secure = [:http_secure] || true self.api_version = [:api_version] || 'v1.0' self.sandbox = [:sandbox] self. = [:options] self.proxy = [:proxy] end |
Instance Attribute Details
#api_version ⇒ String
Returns api version.
42 43 44 |
# File 'lib/fat_zebra/config.rb', line 42 def api_version @api_version end |
#gateway ⇒ String
Returns Gateway url.
30 31 32 |
# File 'lib/fat_zebra/config.rb', line 30 def gateway @gateway end |
#http_secure ⇒ String
Returns http secure.
38 39 40 |
# File 'lib/fat_zebra/config.rb', line 38 def http_secure @http_secure end |
#options ⇒ String
Returns Options.
26 27 28 |
# File 'lib/fat_zebra/config.rb', line 26 def @options end |
#proxy ⇒ String
Returns Proxy url.
34 35 36 |
# File 'lib/fat_zebra/config.rb', line 34 def proxy @proxy end |
#sandbox ⇒ String
Returns Sandbox.
22 23 24 |
# File 'lib/fat_zebra/config.rb', line 22 def sandbox @sandbox end |
#test_mode ⇒ String
Returns Test mode.
18 19 20 |
# File 'lib/fat_zebra/config.rb', line 18 def test_mode @test_mode end |
#token ⇒ String
Returns Token.
14 15 16 |
# File 'lib/fat_zebra/config.rb', line 14 def token @token end |
#username ⇒ String
Returns Username.
10 11 12 |
# File 'lib/fat_zebra/config.rb', line 10 def username @username end |
Instance Method Details
#valid! ⇒ Boolean
validate the configuration Raise when configuration is not valid
63 64 65 66 67 68 69 |
# File 'lib/fat_zebra/config.rb', line 63 def valid! %i[username token].each do |field| validate_presence(field) end true end |