Class: Rubyoverflow::Questions
- Defined in:
 - lib/rubyoverflow/questions.rb
 
Instance Attribute Summary collapse
- 
  
    
      #questions  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute questions.
 
Attributes inherited from PagedBase
#page, #pagesize, #query_parameters, #request_path, #total
Class Method Summary collapse
- 
  
    
      .retrieve_all(parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieves all questions using the parameters provided.
 - 
  
    
      .retrieve_by_id(id, parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieves a set of questions by their id(s).
 - 
  
    
      .retrieve_by_tag(tags, parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieves a set of questions by their tag(s).
 - 
  
    
      .retrieve_by_user(id, parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieve question summary for user(s) by their id(s).
 - 
  
    
      .retrieve_favorites(user_id, parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieves a set of favorite questions for user(s) by the users’ id(s).
 - 
  
    
      .retrieve_unanswered(parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retieves a set of unanswered questions using the parameters provided.
 - 
  
    
      .search(parameters = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Searches questions.
 
Instance Method Summary collapse
- 
  
    
      #get_next_set  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Retrieves the next set of questions using the same parameters used to retrieve the current set.
 - 
  
    
      #initialize(hash, request_path = '')  ⇒ Questions 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Questions.
 
Methods inherited from PagedBase
#next_page_parameters, #perform_next_page_request
Methods inherited from Base
change_end_point, client, convert_if_array, convert_to_id_list, #find_parse_querystring, request, #request
Constructor Details
#initialize(hash, request_path = '') ⇒ Questions
Returns a new instance of Questions.
      5 6 7 8 9 10 11 12  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 5 def initialize(hash, request_path = '') dash = QuestionsDash.new hash @questions = Array.new dash.questions.each {|questionHash| @questions.push(Question.new questionHash)} super(dash,request_path) end  | 
  
Instance Attribute Details
#questions ⇒ Object (readonly)
Returns the value of attribute questions.
      3 4 5  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 3 def questions @questions end  | 
  
Class Method Details
.retrieve_all(parameters = {}) ⇒ Object
Retrieves all questions using the parameters provided
Maps to ‘/questions’
      25 26 27 28  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 25 def retrieve_all(parameters = {}) hash, url = request('questions',parameters) Questions.new hash, url end  | 
  
.retrieve_by_id(id, parameters = {}) ⇒ Object
Retrieves a set of questions by their id(s)
id can be an int, string, or an array of ints or strings
Maps to ‘/questions/id’
      35 36 37 38 39 40  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 35 def retrieve_by_id(id, parameters = {}) id = convert_to_id_list(id) hash, url = request('questions/' + id.to_s, parameters) Questions.new hash, url end  | 
  
.retrieve_by_tag(tags, parameters = {}) ⇒ Object
Retrieves a set of questions by their tag(s)
tag can be a string or an array of strings, tag(s) should be URL Encoded
Maps to ‘/questions/tagged/tags
      47 48 49 50 51 52  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 47 def retrieve_by_tag(, parameters = {}) = convert_to_id_list() parameters['tagged'] = hash, url = request('questions/', parameters) Questions.new hash, url end  | 
  
.retrieve_by_user(id, parameters = {}) ⇒ Object
Retrieve question summary for user(s) by their id(s)
id can be an int, string, or an array of ints or strings
Maps to ‘/users/id/questions’
      79 80 81 82 83 84  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 79 def retrieve_by_user(id, parameters = {}) id = convert_to_id_list(id) hash, url = request('users/'+id.to_s+'/questions', parameters) Questions.new hash, url end  | 
  
.retrieve_favorites(user_id, parameters = {}) ⇒ Object
Retrieves a set of favorite questions for user(s) by the users’ id(s)
user_id can be an int, string, or an array of ints or strings
Maps to ‘/users/id/favorites
      67 68 69 70 71 72  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 67 def retrieve_favorites(user_id, parameters = {}) user_id = convert_to_id_list(user_id) hash, url = request('users/'+user_id.to_s+'/favorites', parameters) Questions.new hash, url end  | 
  
.retrieve_unanswered(parameters = {}) ⇒ Object
Retieves a set of unanswered questions using the parameters provided
Maps to ‘/questions/unanswered’
      57 58 59 60  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 57 def retrieve_unanswered(parameters = {}) hash, url = request('questions/unanswered', parameters) Questions.new hash, url end  | 
  
.search(parameters = {}) ⇒ Object
Searches questions. One of intitle, tagged, or nottagged must be set.
Example: Questions.search(:tagged=>‘c%23’,:nottagged=>‘sql;asp:tagged=>‘c%23’,:nottagged=>‘sql;asp.net’)
Maps to ‘/search’
      91 92 93 94  | 
    
      # File 'lib/rubyoverflow/questions.rb', line 91 def search(parameters = {}) hash, url = request('search', parameters) Questions.new hash, url end  |