Sha256: aa4c022ccc638a81da61b8d2114aff5be9a879b4f6e884d0aebfffac623b325d

Contents?: true

Size: 1005 Bytes

Versions: 4

Compression:

Stored size: 1005 Bytes

Contents

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

    # @macro [attach] virtus_attribute
    #   @return [$2]
    attribute :id,            Integer
    attribute :title,         Hash
    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]

    # @macro collection
    collection :questions

    # survey gizmo sends a hash back for :title
    # @private
    def title_with_multilingual=(val)
      self.title_without_multilingual = val.is_a?(Hash) ? val : { "English" => val }
    end

    alias_method_chain :title=, :multilingual

    # @see SurveyGizmo::Resource#to_param_options
    def to_param_options
      {:id => self.id, :survey_id => self.survey_id}
    end
  end
end; end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
survey-gizmo-ruby-1.0.5 lib/survey_gizmo/api/page.rb
survey-gizmo-ruby-1.0.4 lib/survey_gizmo/api/page.rb
survey-gizmo-ruby-1.0.3 lib/survey_gizmo/api/page.rb
survey-gizmo-ruby-1.0.1 lib/survey_gizmo/api/page.rb