Class: Podio::Question

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/question.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes

Class Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, has_many, has_one, #hash, #initialize, #initialize_attributes, klass_from_string, list, member, #new_record?, output_attribute_as_json, #parent_model, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.answer(question_id, ref_type, ref_id, question_option_id) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/podio/models/question.rb', line 22

def answer(question_id, ref_type, ref_id, question_option_id)
  response = Podio.connection.post do |req|
    req.url "/question/#{question_id}/#{ref_type}/#{ref_id}/"
    req.body = {:question_option_id => question_option_id }
  end
  
  response.status
end

.create(ref_type, ref_id, text, options) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/podio/models/question.rb', line 14

def create(ref_type, ref_id, text, options)
  response = Podio.connection.post do |req|
    req.url "/question/#{ref_type}/#{ref_id}/"
    req.body = {:text => text, :options => options }
  end
  member response.body
end