Class: Basecamp3::Question

Inherits:
Model
  • Object
show all
Includes:
Concerns::Bucketable, Concerns::Creatorable, Concerns::Parentable
Defined in:
lib/basecamp3/models/question.rb

Overview

Constant Summary

Constants inherited from Model

Model::REQUIRED_FIELDS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Concerns::Parentable

#parent

Methods included from Concerns::Bucketable

#bucket

Methods included from Concerns::Creatorable

#creator

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Basecamp3::Model

Instance Attribute Details

#answers_countObject

Returns the value of attribute answers_count



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def answers_count
  @answers_count
end

#created_atObject

Returns the value of attribute created_at



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def created_at
  @created_at
end

#idObject

Returns the value of attribute id



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def id
  @id
end

#pausedObject

Returns the value of attribute paused



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def paused
  @paused
end

#statusObject

Returns the value of attribute status



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def status
  @status
end

#titleObject

Returns the value of attribute title



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def title
  @title
end

#updated_atObject

Returns the value of attribute updated_at



9
10
11
# File 'lib/basecamp3/models/question.rb', line 9

def updated_at
  @updated_at
end

Class Method Details

.all(bucket_id, parent_id, params = {}) ⇒ Array<Basecamp3::Question>

Returns a paginated list of questions.

Parameters:

  • params (Hash) (defaults to: {})

    additional parameters

Options Hash (params):

  • :page (Integer) — default: optional

    to paginate results

Returns:



30
31
32
# File 'lib/basecamp3/models/question.rb', line 30

def self.all(bucket_id, parent_id, params = {})
  Basecamp3.request.get("/buckets/#{bucket_id}/questionnaires/#{parent_id}/questions", params, Basecamp3::Question)
end

.find(bucket_id, id) ⇒ Basecamp3::Question

Returns the question.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the question

Returns:



40
41
42
# File 'lib/basecamp3/models/question.rb', line 40

def self.find(bucket_id, id)
  Basecamp3.request.get("/buckets/#{bucket_id}/questions/#{id}", {}, Basecamp3::Question)
end

Instance Method Details

#answersArray<Basecamp3::QuestionAnswer>

Returns a list of related answers.

Returns:



20
21
22
# File 'lib/basecamp3/models/question.rb', line 20

def answers
  @mapped_answers ||= Basecamp3::QuestionAnswer.all(bucket.id, id)
end