Skip to content

Commit 3836b55

Browse files
committed
Merge pull request googleapis#219 from remi/respect-discovery-paths-with-colons
Respect discovered methods with colons in path
2 parents 0003e56 + 94a979b commit 3836b55

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/google/api_client/discovery/method.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def http_method
108108
# @return [Addressable::Template] The URI template.
109109
def uri_template
110110
return @uri_template ||= Addressable::Template.new(
111-
self.method_base.join(Addressable::URI.parse(@discovery_document['path']))
111+
self.method_base.join(Addressable::URI.parse("./" + @discovery_document['path']))
112112
)
113113
end
114114

spec/google/api_client/discovery_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,5 +688,21 @@
688688
it 'should correctly determine the service root_uri' do
689689
expect(@pubsub.root_uri.to_s).to eq('https://pubsub.googleapis.com/')
690690
end
691+
692+
it 'should discover correct method URIs' do
693+
list = CLIENT.discovered_method(
694+
"pubsub.projects.topics.list", "pubsub", "v1beta2"
695+
)
696+
expect(list.uri_template.pattern).to eq(
697+
"https://pubsub.googleapis.com/v1beta2/{+project}/topics"
698+
)
699+
700+
publish = CLIENT.discovered_method(
701+
"pubsub.projects.topics.publish", "pubsub", "v1beta2"
702+
)
703+
expect(publish.uri_template.pattern).to eq(
704+
"https://pubsub.googleapis.com/v1beta2/{+topic}:publish"
705+
)
706+
end
691707
end
692708
end

0 commit comments

Comments
 (0)