lib/groupr.rb in groupr-0.2.2 vs lib/groupr.rb in groupr-0.2.4

- old
+ new

@@ -35,39 +35,39 @@ members << m.text end members end - # https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Members - def get_effective_membership - end + # # https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Members + # def get_effective_membership + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Update+Members - def update_membership - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Update+Members + # def update_membership + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Members - def delete_membership - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Members + # def delete_membership + # end - ## Member-related methods + # ## Member-related methods - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Member - def get_member - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Member + # def get_member + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Member - def get_effective_member - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Effective+Member + # def get_effective_member + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Add+Member - def add_member - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Add+Member + # def add_member + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Member - def delete_member - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Delete+Member + # def delete_member + # end ## Group-related methods. View, create, update, delete. # https://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+Group @@ -126,19 +126,19 @@ @status = "No authorization" false end end - ## Search + # ## Search - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Search - def search - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Search + # def search + # end - # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+History - def get_history - end + # # http://wiki.cac.washington.edu/display/infra/Groups+WebService+Get+History + # def get_history + # end private # This makes a get request against the groups service, useful for getting information def make_get_request @@ -186,27 +186,14 @@ end puts "Response is: #{get_response_code}" puts "Body is: #{@response.body}" @response.body end - # Returns the contact information of a group - def get_contact - @doc.xpath('//span[@class="contact"]').text - end - # Returns the group title - def get_title - @doc.xpath('//span[@class="title"]').text - end - # Returns the group description - def get_description - @doc.xpath('//span[@class="description"]').text - end - # Returns the group name - def get_name - @doc.xpath('//span[@class="name"]').text - end - # Returns the unique group regid - def get_regid - @doc.xpath('//span[@class="regid"]').text + + # Creates some basic methods to pull common classes out + %w(contact title description name regid).each do |element| + define_method("get_#{element}") do + @doc.xpath("//span[@class=\"#{element}\"]").text + end end end