diff --git a/Gemfile.d/app.rb b/Gemfile.d/app.rb index 7d8724f9471..57c5685243e 100644 --- a/Gemfile.d/app.rb +++ b/Gemfile.d/app.rb @@ -73,7 +73,7 @@ gem 'flamegraph', '0.1.0', require: false gem 'stackprof', '0.2.7', require: false gem 'rake', '10.4.2' gem 'rdoc', '3.12' -gem 'ratom', '0.9.0', require: false +gem 'ratom-nokogiri', '0.10.3', require: false gem 'rdiscount', '1.6.8', require: false gem 'ritex', '1.0.1', require: false diff --git a/gems/google_docs/google_docs.gemspec b/gems/google_docs/google_docs.gemspec index 5efbaef4bef..68af62aec19 100644 --- a/gems/google_docs/google_docs.gemspec +++ b/gems/google_docs/google_docs.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "ratom", ">=0.6.10" + spec.add_dependency "ratom-nokogiri", "0.10.3" spec.add_dependency "oauth-instructure", "0.4.10" spec.add_development_dependency "bundler", "~> 1.5" diff --git a/gems/google_docs/lib/google_docs/connection.rb b/gems/google_docs/lib/google_docs/connection.rb index 2dbedfb9507..0bee10ba6de 100644 --- a/gems/google_docs/lib/google_docs/connection.rb +++ b/gems/google_docs/lib/google_docs/connection.rb @@ -157,10 +157,8 @@ module GoogleDocs self.type = operation_type end - def to_xml(*opts) - n = XML::Node.new("batch:operation") - n['type'] = type - n + def to_xml(builder, *_opts) + builder['batch'].operation(type: type) end end end @@ -173,10 +171,8 @@ module GoogleDocs self.role = "writer" end - def to_xml(*opts) - n = XML::Node.new("gAcl:role") - n['value'] = role - n + def to_xml(builder, *_opts) + builder['gAcl'].role(value: role) end end @@ -188,11 +184,8 @@ module GoogleDocs self.value = email end - def to_xml(*opts) - n = XML::Node.new("gAcl:scope") - n['type'] = type - n['value'] = value - n + def to_xml(builder, *_opts) + builder['gAcl'].scope(type: type, value: value) end end end @@ -228,7 +221,7 @@ module GoogleDocs category.label = "document" end end - xml = entry.to_xml + xml = entry.to_xml.to_s begin response = access_token.post(url, xml, {'Content-Type' => 'application/atom+xml'}) rescue => e @@ -274,7 +267,7 @@ module GoogleDocs end end end - response = access_token.post(url, request_feed.to_xml, {'Content-Type' => 'application/atom+xml'}) + response = access_token.post(url, request_feed.to_xml.to_s, {'Content-Type' => 'application/atom+xml'}) feed = Atom::Feed.load_feed(response.body) res = [] @@ -321,8 +314,8 @@ module GoogleDocs return unless user_added - response = access_token.post(url, request_feed.to_xml, {'Content-Type' => 'application/atom+xml'}) - feed = Atom::Feed.load_feed(response.body) + post_response = access_token.post(url, request_feed.to_xml.to_s, {'Content-Type' => 'application/atom+xml'}) + feed = Atom::Feed.load_feed(post_response.body) feed.entries.inject([]) do |response, entry| user = allowed_users.find do |u| u.id == entry['http://schemas.google.com/gdata/batch', 'id'][0].to_i diff --git a/gems/google_docs/spec/fixtures/google_docs/add_user_acl.xml b/gems/google_docs/spec/fixtures/google_docs/add_user_acl.xml index 624a36ec0b2..38983b1583e 100644 --- a/gems/google_docs/spec/fixtures/google_docs/add_user_acl.xml +++ b/gems/google_docs/spec/fixtures/google_docs/add_user_acl.xml @@ -1,6 +1,6 @@ - + 192 diff --git a/gems/google_docs/spec/fixtures/google_docs/remove_doc_request.xml b/gems/google_docs/spec/fixtures/google_docs/remove_doc_request.xml index 49cb5ba7e79..111ee7cc54d 100644 --- a/gems/google_docs/spec/fixtures/google_docs/remove_doc_request.xml +++ b/gems/google_docs/spec/fixtures/google_docs/remove_doc_request.xml @@ -1,6 +1,6 @@ - + https://docs.google.com/feeds/acl/private/full/document%3A1HJoN38KHlnu32B5z_THgchnTMUbj7dgs8P-Twrm38cA/user%3Auser%40example.com