Class: Jirafe::Configuration
- Inherits:
-
Object
- Object
- Jirafe::Configuration
- Includes:
- Singleton
- Defined in:
- lib/jirafe/configuration.rb
Constant Summary collapse
- DEFAULT_URL =
"https://api.jirafe.com/v1"
- DEFAULT_CALLBACK_URL =
"https://data.jirafe.com"
- DEFAULT_ASSETS_URL =
"https://jirafe.com"
- DEFAULT_TRACKING_URL =
"https://c.jirafe.com"
- TEST_URL =
"https://test-api.jirafe.com/v1"
- TEST_CALLBACK_URL =
"https://test-data.jirafe.com"
- TEST_ASSETS_URL =
"https://test.jirafe.com"
- TEST_TRACKING_URL =
"https://test-c.jirafe.com"
- DEFAULT_CONTENT_TYPE =
"application/json"
Instance Attribute Summary collapse
-
#assets_url ⇒ Object
Returns the value of attribute assets_url.
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#test ⇒ Object
Returns the value of attribute test.
-
#token ⇒ Object
Returns the value of attribute token.
-
#tracking_url ⇒ Object
Returns the value of attribute tracking_url.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #data_path ⇒ Object
- #default? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset! ⇒ Object
- #tracking_path ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 22 23 24 25 |
# File 'lib/jirafe/configuration.rb', line 17 def initialize @url = DEFAULT_URL @callback_url = DEFAULT_CALLBACK_URL @assets_url = DEFAULT_ASSETS_URL @tracking_url = DEFAULT_TRACKING_URL @content_type = DEFAULT_CONTENT_TYPE @token = nil @test = false end |
Instance Attribute Details
#assets_url ⇒ Object
Returns the value of attribute assets_url.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def assets_url @assets_url end |
#callback_url ⇒ Object
Returns the value of attribute callback_url.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def callback_url @callback_url end |
#content_type ⇒ Object
Returns the value of attribute content_type.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def content_type @content_type end |
#logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def logger @logger end |
#test ⇒ Object
Returns the value of attribute test.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def test @test end |
#token ⇒ Object
Returns the value of attribute token.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def token @token end |
#tracking_url ⇒ Object
Returns the value of attribute tracking_url.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def tracking_url @tracking_url end |
#url ⇒ Object
Returns the value of attribute url.
15 16 17 |
# File 'lib/jirafe/configuration.rb', line 15 def url @url end |
Instance Method Details
#data_path ⇒ Object
46 47 48 49 |
# File 'lib/jirafe/configuration.rb', line 46 def data_path uri = URI.parse(callback_url) [uri.host, uri.path].join("") end |
#default? ⇒ Boolean
51 52 53 54 55 56 |
# File 'lib/jirafe/configuration.rb', line 51 def default? self.url == DEFAULT_URL && self.callback_url == DEFAULT_CALLBACK_URL && self.assets_url == DEFAULT_ASSETS_URL && self.tracking_url == DEFAULT_TRACKING_URL end |
#reset! ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/jirafe/configuration.rb', line 58 def reset! self.url = DEFAULT_URL self.callback_url = DEFAULT_CALLBACK_URL self.assets_url = DEFAULT_ASSETS_URL self.tracking_url = DEFAULT_TRACKING_URL self.content_type = DEFAULT_CONTENT_TYPE self.token = nil self.test = false self.logger = nil end |
#tracking_path ⇒ Object
41 42 43 44 |
# File 'lib/jirafe/configuration.rb', line 41 def tracking_path uri = URI.parse(tracking_url) [uri.host, uri.path].join("") end |