Sha256: a078f97dfeaeac2659360269189afc819877be8cce0b45757ac5c9f063c33141

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

module Applicants
  class ApplicantPanelParameterSet < ActiveRecord::Base
    self.include_root_in_json = false

    # Manager's of panel groups want to be able to launch MyPoints Campaigns.
    #
    # rid is a url parameter for referral ids, for example: mypoints
    #
    # visit_id is a url parameter we're using for MyPoints tracking: http://bit.ly/18iv0k5
    # When a user signs up with rid set to mypoints and visit_id set,
    # we show an image tag with a customized url, using the visit_id, on the Next Steps page.
    REFERRAL_PARAMETER_NAME  = "rid"
    MY_POINTS_PARAMETER_NAME = "visit_id"

    belongs_to :applicant
    belongs_to :panel
    attr_accessible :applicant_id, :panel_id, :parameters

    def rid
      parsed_parameter(REFERRAL_PARAMETER_NAME)
    end

    def visit_id
      parsed_parameter(MY_POINTS_PARAMETER_NAME)
    end

    def parsed_parameter(key)
      parsed_parameters[key]
    end

    def parsed_parameters
      @parsed_parameters ||= JSON.parse(parameters)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
applicants-0.11.0 app/models/applicants/applicant_panel_parameter_set.rb