Sha256: 5b8d0df180b896bc2dfc13998add4edfdb8e8a7d35a81fd0c84c3fcdb6fd3a37

Contents?: true

Size: 908 Bytes

Versions: 9

Compression:

Stored size: 908 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

      private

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ahoy_matey-1.5.2 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.5.1 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.5.0 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.4.2 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.4.1 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.4.0 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.3.1 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.3.0 lib/ahoy/deckhands/request_deckhand.rb
ahoy_matey-1.2.2 lib/ahoy/deckhands/request_deckhand.rb