Class: Rubyoverflow::Answers
- Defined in:
- lib/rubyoverflow/answers.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
readonly
Returns the value of attribute answers.
Attributes inherited from PagedBase
#page, #pagesize, #query_parameters, #request_path, #total
Class Method Summary collapse
-
.retrieve_by_id(id, parameters = {}) ⇒ Object
Retrieves a set of questions by their id(s).
-
.retrieve_by_question(id, parameters = {}) ⇒ Object
Retrieves a set of answers from a set of questions by the questions’ ids.
-
.retrieve_by_user(id, parameters = {}) ⇒ Object
Retrieves a set of answers made by a set of users by their ids.
Instance Method Summary collapse
-
#get_next_set ⇒ Object
Retrieves the next set of answers using the same parameters used to retrieve the current set.
-
#initialize(hash, request_path = '') ⇒ Answers
constructor
A new instance of Answers.
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 = '') ⇒ Answers
Returns a new instance of Answers.
5 6 7 8 9 10 11 12 |
# File 'lib/rubyoverflow/answers.rb', line 5 def initialize(hash, request_path = '') dash = AnswersDash.new hash @answers = Array.new dash.answers.each {|answerHash| @answers.push(Answer.new answerHash)} super(dash, request_path) end |
Instance Attribute Details
#answers ⇒ Object (readonly)
Returns the value of attribute answers.
3 4 5 |
# File 'lib/rubyoverflow/answers.rb', line 3 def answers @answers end |
Class Method Details
.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 ‘/answers/id’
27 28 29 30 31 |
# File 'lib/rubyoverflow/answers.rb', line 27 def retrieve_by_id(id, parameters = {}) id = convert_to_id_list(id) hash,url = request('answers/'+id.to_s, parameters) Answers.new hash,url end |
.retrieve_by_question(id, parameters = {}) ⇒ Object
Retrieves a set of answers from a set of questions by the questions’ ids
id can be an int, string, or an array of ints or strings
Maps to ‘questions/id/answers’
49 50 51 52 53 |
# File 'lib/rubyoverflow/answers.rb', line 49 def retrieve_by_question(id, parameters={}) id = convert_to_id_list(id) hash, url = request('questions/'+id.to_s+"/answers", parameters) Answers.new hash, url end |
.retrieve_by_user(id, parameters = {}) ⇒ Object
Retrieves a set of answers made by a set of users by their ids
id can be an int, string, or an array of ints or strings
Maps to ‘users/id/answers’
38 39 40 41 42 |
# File 'lib/rubyoverflow/answers.rb', line 38 def retrieve_by_user(id, parameters={}) id = convert_to_id_list(id) hash, url = request('users/'+id.to_s+"/answers", parameters) Answers.new hash, url end |