Class: Analytics::Config
- Inherits:
-
Struct
- Object
- Struct
- Analytics::Config
- Defined in:
- lib/api_analytics.rb
Instance Attribute Summary collapse
-
#get_hostname ⇒ Object
Returns the value of attribute get_hostname.
-
#get_ip_address ⇒ Object
Returns the value of attribute get_ip_address.
-
#get_path ⇒ Object
Returns the value of attribute get_path.
-
#get_user_agent ⇒ Object
Returns the value of attribute get_user_agent.
-
#get_user_id ⇒ Object
Returns the value of attribute get_user_id.
-
#privacy_level ⇒ Object
Returns the value of attribute privacy_level.
-
#server_url ⇒ Object
Returns the value of attribute server_url.
Instance Method Summary collapse
Constructor Details
#initialize(privacy_level = 0, server_url = 'https://www.apianalytics-server.com', get_path = ->(env) { env['REQUEST_PATH'] }, get_ip_address = lambda { |env| env['HTTP_CF_CONNECTING_IP'] || (env['HTTP_X_FORWARDED_FOR'] && env['HTTP_X_FORWARDED_FOR'].split(',').first&.strip) || env['HTTP_X_REAL_IP'] || env['REMOTE_ADDR'] }, get_hostname = ->(env) { env['HTTP_HOST'] }, get_user_agent = ->(env) { env['HTTP_USER_AGENT'] }, get_user_id = ->(_env) { nil }) ⇒ Config
Returns a new instance of Config.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/api_analytics.rb', line 87 def initialize( privacy_level = 0, server_url = 'https://www.apianalytics-server.com', get_path = ->(env) { env['REQUEST_PATH'] }, get_ip_address = lambda { |env| env['HTTP_CF_CONNECTING_IP'] || (env['HTTP_X_FORWARDED_FOR'] && env['HTTP_X_FORWARDED_FOR'].split(',').first&.strip) || env['HTTP_X_REAL_IP'] || env['REMOTE_ADDR'] }, get_hostname = ->(env) { env['HTTP_HOST'] }, get_user_agent = ->(env) { env['HTTP_USER_AGENT'] }, get_user_id = ->(_env) { nil } ) self.privacy_level = privacy_level self.server_url = server_url self.get_path = get_path self.get_ip_address = get_ip_address self.get_hostname = get_hostname self.get_user_agent = get_user_agent self.get_user_id = get_user_id end |
Instance Attribute Details
#get_hostname ⇒ Object
Returns the value of attribute get_hostname
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def get_hostname @get_hostname end |
#get_ip_address ⇒ Object
Returns the value of attribute get_ip_address
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def get_ip_address @get_ip_address end |
#get_path ⇒ Object
Returns the value of attribute get_path
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def get_path @get_path end |
#get_user_agent ⇒ Object
Returns the value of attribute get_user_agent
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def get_user_agent @get_user_agent end |
#get_user_id ⇒ Object
Returns the value of attribute get_user_id
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def get_user_id @get_user_id end |
#privacy_level ⇒ Object
Returns the value of attribute privacy_level
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def privacy_level @privacy_level end |
#server_url ⇒ Object
Returns the value of attribute server_url
86 87 88 |
# File 'lib/api_analytics.rb', line 86 def server_url @server_url end |