Sha256: d446eb52cab44cd54018bd27b76ab2f0d91fa7e98317ae0b489178788debc5bc
Contents?: true
Size: 1.64 KB
Versions: 28
Compression:
Stored size: 1.64 KB
Contents
module ForestLiana class IntercomAttributeSerializer include JSONAPI::Serializer attribute :session_count attribute :last_seen_ip attribute :created_at do object.created_at.try(:utc).try(:iso8601) end attribute :updated_at do object.updated_at.try(:utc).try(:iso8601) end attribute :signed_up_at do object.signed_up_at.try(:utc).try(:iso8601) end attribute :last_request_at do object.last_request_at.try(:utc).try(:iso8601) end attribute :country do object.location_data.country_name end attribute :city do object.location_data.city_name end attribute :user_agent do object.user_agent_data end attribute :companies do object.companies.map(&:name) end attribute :segments do object.segments.map(&:name) end attribute :tags do object.tags.map(&:name) end attribute :browser do useragent = UserAgent.parse(object.user_agent_data) "#{useragent.try(:browser)} #{useragent.try(:version)}" end attribute :platform do UserAgent.parse(object.user_agent_data).try(:platform) end attribute :geoloc do [object.location_data.latitude, object.location_data.longitude] end def self_link "/forest#{super}" end def type 'intercom-attributes' end def format_name(attribute_name) attribute_name.to_s end def unformat_name(attribute_name) attribute_name.to_s.underscore end def relationship_self_link(attribute_name) nil end def relationship_related_link(attribute_name) nil end end end
Version data entries
28 entries across 28 versions & 1 rubygems