Sha256: df8909c5e53cece4894f1b98d0eae61ec6078fdd48d606e0c5966ccd6226b9f3

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

module SurveyGizmo; module API
  # @see SurveyGizmo::Resource::ClassMethods
  class Page
    include SurveyGizmo::Resource
    include SurveyGizmo::MultilingualTitle

    attribute :id,            Integer
    attribute :description,   String
    attribute :properties,    Hash
    attribute :after,         Integer
    attribute :survey_id,     Integer

    # routing
    route '/survey/:survey_id/surveypage', via: :create
    route '/survey/:survey_id/surveypage/:id', via: [:get, :update, :delete]

    def survey
      @survey ||= SurveyGizmo::API::Survey.first(id: survey_id)
    end

    def questions
      @questions ||= SurveyGizmo::API::Question.all(survey_id: survey_id, page_id: id, all_pages: true)
    end

    def to_param_options
      { id: self.id, survey_id: self.survey_id }
    end
  end
end; end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
survey-gizmo-ruby-4.1.0 lib/survey_gizmo/api/page.rb