switch to ratom-nokogiri gem

refs CNVS-22298

Change-Id: I4752fa491dcdd8f8f0eea9fb3b9ed63f2d0bb1e9
Reviewed-on: https://gerrit.instructure.com/59981
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2015-08-04 15:29:09 -06:00
parent 4597fb5730
commit a0d0b686f2
5 changed files with 14 additions and 21 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gAcl="http://schemas.google.com/acl/2007">
<entry xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gAcl="http://schemas.google.com/acl/2007">
<entry>
<batch:id>192</batch:id>
<batch:operation type="insert"/>
<gAcl:role value="writer"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gAcl="http://schemas.google.com/acl/2007">
<entry xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gAcl="http://schemas.google.com/acl/2007">
<entry>
<id>https://docs.google.com/feeds/acl/private/full/document%3A1HJoN38KHlnu32B5z_THgchnTMUbj7dgs8P-Twrm38cA/user%3Auser%40example.com</id>
<batch:operation type="delete"/>
<gAcl:role value="writer"/>