Respect discovered methods with colons in path

This commit is contained in:
remi Taylor 2015-04-13 21:38:47 -07:00
parent 0003e564b1
commit 94a979b512
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