Sha256: 544fdb7a9069c3e99a13c95765594de586a669c0b10e197819bca8dc1decd5ad

Contents?: true

Size: 893 Bytes

Versions: 5

Compression:

Stored size: 893 Bytes

Contents

module Ahoy
  module Deckhands
    class RequestDeckhand
      attr_reader :request

      def initialize(request, options = {})
        @request = request
        @options = options
      end

      def ip
        request.remote_ip
      end

      def user_agent
        request.user_agent
      end

      def referrer
        @options[:api] ? params["referrer"] : request.referer
      end

      def landing_page
        @options[:api] ? params["landing_page"] : request.original_url
      end

      def platform
        params["platform"]
      end

      def app_version
        params["app_version"]
      end

      def os_version
        params["os_version"]
      end

      def screen_height
        params["screen_height"]
      end

      def screen_width
        params["screen_width"]
      end

      def params
        @params ||= request.params
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ahoy_matey-1.6.1 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.6.0 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.5.5 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.5.4 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.5.3 lib/ahoy/deckhands/request_deckhand.rb