lib/google_apps/transport.rb in google_apps-0.3.3 vs lib/google_apps/transport.rb in google_apps-0.3.4

- old
+ new

@@ -107,10 +107,26 @@ File.new(filename, "w") do |file| file.puts request(uri).body end end + # get is a generic target for method_missing. It is + # intended to handle the general case of retrieving a + # record from the Google Apps Domain. It takes an API + # endpoint and an id as arguments. + # + # get 'endpoint', 'username' + # + # get returns the HTTP response received from Google. + def get(endpoint, id) + uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}") + @request = Net::HTTP::Get.new(uri.path) + set_headers :user + + @response = request(uri) + end + # add is a generic target for method_missing. It is # intended to handle the general case of adding # to the GoogleApps Domain. It takes an API endpoint # and a GoogleApps::Atom document as arguments. # @@ -179,9 +195,11 @@ case $1 when "new" self.send(:add, $2, *args) when "delete" self.send(:delete, $2, *args) + when "get" + self.send(:get, $2, *args) else super end end \ No newline at end of file