Class: Rubyoverflow::Tags

Inherits:
PagedBase show all
Defined in:
lib/rubyoverflow/tags.rb

Instance Attribute Summary collapse

Attributes inherited from PagedBase

#page, #pagesize, #query_parameters, #request_path, #total

Class Method Summary collapse

Instance Method Summary collapse

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 = '') ⇒ Tags

Returns a new instance of Tags.



6
7
8
9
10
11
12
# File 'lib/rubyoverflow/tags.rb', line 6

def initialize(hash, request_path = '')
  dash = TagsDash.new hash
  @tags = Array.new
  dash.tags.each{ |tagHash| @tags.push(Tag.new tagHash)}

  super(dash, request_path)
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



4
5
6
# File 'lib/rubyoverflow/tags.rb', line 4

def tags
  @tags
end

Class Method Details

.retrieve_all(parameters = {}) ⇒ Object

Retrieves all of the tags

Maps to ‘/tags/



24
25
26
27
# File 'lib/rubyoverflow/tags.rb', line 24

def retrieve_all(parameters = {})
  hash, url = request('tags', parameters)
  Tags.new hash, url
end

.retrieve_by_user(id, parameters = {}) ⇒ Object

Retieves all of the tags assign to a set of users by their ids

id can be an int, string, or an array of ints or strings

Maps to ‘users/id/tags’



34
35
36
37
38
# File 'lib/rubyoverflow/tags.rb', line 34

def retrieve_by_user(id, parameters = {})
  id = convert_to_id_list(id)
  hash, url = request('users/'+id.to_s+'/tags',parameters)
  Tags.new hash, url
end

Instance Method Details

#get_next_setObject

Retrieves the next set of tags using the same parameters used to retrieve the current set



15
16
17
18
# File 'lib/rubyoverflow/tags.rb', line 15

def get_next_set
  hash,url = perform_next_page_request
  Tags.new hash,url
end