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
- #to_s ⇒ Object
Methods inherited from Data
#mark_as_sent, #mark_as_transmitting, #mark_as_unsent, #sent, #transmitting, #unsent
Constructor Details
#initialize(country, region = nil, city = nil, postal_code = nil, latitude = Float::NAN, longitude = Float::NAN) ⇒ Geolocation
Returns a new instance of Geolocation.
19 20 21 22 23 24 25 26 27 |
# File 'lib/kameleoon/data/geolocation.rb', line 19 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
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/kameleoon/data/geolocation.rb', line 29 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 |
#to_s ⇒ Object
8 9 10 11 |
# File 'lib/kameleoon/data/geolocation.rb', line 8 def to_s "Geolocation{country:'#{@country}',region:'#{@region}',city:'#{@city}',postal_code:'#{@postal_code}'," \ "latitude:#{@latitude},longitude:#{@longitude}}" end |