Class: Kameleoon::Geolocation
- Inherits:
-
DuplicationUnsafeData
- Object
- Data
- DuplicationUnsafeData
- Kameleoon::Geolocation
- Defined in:
- lib/kameleoon/data/geolocation.rb
Overview
Geolocation contains the visitor’s geolocation details
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Attributes inherited from Data
Instance Method Summary collapse
-
#initialize(country, region = nil, city = nil, postal_code = nil, latitude = Float::NAN, longitude = Float::NAN) ⇒ Geolocation
constructor
A new instance of Geolocation.
- #obtain_full_post_text_line ⇒ Object
Methods inherited from Data
Constructor Details
#initialize(country, region = nil, city = nil, postal_code = nil, latitude = Float::NAN, longitude = Float::NAN) ⇒ Geolocation
Returns a new instance of Geolocation.
14 15 16 17 18 19 20 21 22 |
# File 'lib/kameleoon/data/geolocation.rb', line 14 def initialize(country, region = nil, city = nil, postal_code = nil, latitude = Float::NAN, longitude = Float::NAN) super(DataType::GEOLOCATION) @country = country @region = region @city = city @postal_code = postal_code @latitude = latitude @longitude = longitude end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def country @country end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def longitude @longitude end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def postal_code @postal_code end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
6 7 8 |
# File 'lib/kameleoon/data/geolocation.rb', line 6 def region @region end |
Instance Method Details
#obtain_full_post_text_line ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kameleoon/data/geolocation.rb', line 24 def obtain_full_post_text_line params = { eventType: 'staticData', nonce: nonce } params[:country] = @country if @country.is_a?(String) params[:region] = @region if @region.is_a?(String) params[:city] = @city if @city.is_a?(String) params[:postalCode] = @postal_code if @postal_code.is_a?(String) params[:latitude] = @latitude if valid_number?(@latitude) params[:longitude] = @longitude if valid_number?(@longitude) Kameleoon::Network::UriHelper.encode_query(params) end |