Class: ProoflinkConnect::Configuration
- Inherits:
-
Object
- Object
- ProoflinkConnect::Configuration
- Defined in:
- lib/prooflink_connect/configuration.rb
Defined Under Namespace
Classes: InvalidConfigurationError
Constant Summary collapse
- @@defaults =
{ :provider_endpoint => "prooflink.com", :subdomain => "example", :protocol => "https", :locale => "en" }
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#oauth_access_token ⇒ Object
Returns the value of attribute oauth_access_token.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#provider_endpoint ⇒ Object
Returns the value of attribute provider_endpoint.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
- #base_uri ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 |
# File 'lib/prooflink_connect/configuration.rb', line 13 def initialize @@defaults.each_pair{|k,v| self.send("#{k}=",v)} end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def api_key @api_key end |
#locale ⇒ Object
Returns the value of attribute locale.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def locale @locale end |
#oauth_access_token ⇒ Object
Returns the value of attribute oauth_access_token.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def oauth_access_token @oauth_access_token end |
#protocol ⇒ Object
Returns the value of attribute protocol.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def protocol @protocol end |
#provider_endpoint ⇒ Object
Returns the value of attribute provider_endpoint.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def provider_endpoint @provider_endpoint end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
17 18 19 |
# File 'lib/prooflink_connect/configuration.rb', line 17 def subdomain @subdomain end |
Instance Method Details
#base_uri ⇒ Object
23 24 25 |
# File 'lib/prooflink_connect/configuration.rb', line 23 def base_uri "#{protocol}://#{[subdomain, provider_endpoint].compact.join(".")}" end |
#validate! ⇒ Object
19 20 21 |
# File 'lib/prooflink_connect/configuration.rb', line 19 def validate! raise InvalidConfigurationError if [:provider_endpoint, :subdomain, :api_key, :protocol].any?{|option|send(option).blank?} end |