Merge pull request #219 from remi/respect-discovery-paths-with-colons

Respect discovered methods with colons in path
This commit is contained in:
Tim Emiola 2015-04-14 08:45:19 -07:00
commit 3836b558f8
2 changed files with 17 additions and 1 deletions

View File

@ -108,7 +108,7 @@ module Google
# @return [Addressable::Template] The URI template.
def uri_template
return @uri_template ||= Addressable::Template.new(
self.method_base.join(Addressable::URI.parse(@discovery_document['path']))
self.method_base.join(Addressable::URI.parse("./" + @discovery_document['path']))
)
end

View File

@ -688,5 +688,21 @@ RSpec.describe Google::APIClient do
it 'should correctly determine the service root_uri' do
expect(@pubsub.root_uri.to_s).to eq('https://pubsub.googleapis.com/')
end
it 'should discover correct method URIs' do
list = CLIENT.discovered_method(
"pubsub.projects.topics.list", "pubsub", "v1beta2"
)
expect(list.uri_template.pattern).to eq(
"https://pubsub.googleapis.com/v1beta2/{+project}/topics"
)
publish = CLIENT.discovered_method(
"pubsub.projects.topics.publish", "pubsub", "v1beta2"
)
expect(publish.uri_template.pattern).to eq(
"https://pubsub.googleapis.com/v1beta2/{+topic}:publish"
)
end
end
end