google-api-client 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/google/api_client/discovery/api.rb +12 -2
- data/lib/google/api_client/discovery/method.rb +1 -1
- data/lib/google/api_client/discovery/schema.rb +0 -2
- data/lib/google/api_client/version.rb +1 -1
- data/spec/google/api_client/discovery_spec.rb +46 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d98c9d4c3597c0f77ce1d7b3dcb9b0a6a06a47b4
|
4
|
+
data.tar.gz: 9c2be2c71a31ee33b6b73f9ce2d6930dffbccf9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8acbd64242aec823310e25be8a78138d99ddca198e7264375a5411d3dd070ade27bce415bf0d8560eea7d0be40bf92c25375f973433b9a726f8b177d23b0ab
|
7
|
+
data.tar.gz: 33300789f9bab5f084f20bccbe0c622b5bc93349d4aeab1e60d5c84744e9e91c8287392dc66ded38288cbdd2bf8b332db291420cce58a831b433aabf9aeec74e
|
data/CHANGELOG.md
CHANGED
@@ -30,7 +30,7 @@ module Google
|
|
30
30
|
# Creates a description of a particular version of a service.
|
31
31
|
#
|
32
32
|
# @param [String] document_base
|
33
|
-
# Base URI for the
|
33
|
+
# Base URI for the discovery document.
|
34
34
|
# @param [Hash] discovery_document
|
35
35
|
# The section of the discovery document that applies to this service
|
36
36
|
# version.
|
@@ -126,6 +126,16 @@ module Google
|
|
126
126
|
return @discovery_document['features'] || []
|
127
127
|
end
|
128
128
|
|
129
|
+
##
|
130
|
+
# Returns the root URI for this service.
|
131
|
+
#
|
132
|
+
# @return [Addressable::URI] The root URI.
|
133
|
+
def root_uri
|
134
|
+
return @root_uri ||= (
|
135
|
+
Addressable::URI.parse(self.discovery_document['rootUrl'])
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
129
139
|
##
|
130
140
|
# Returns true if this API uses a data wrapper.
|
131
141
|
#
|
@@ -148,7 +158,7 @@ module Google
|
|
148
158
|
def method_base
|
149
159
|
if @discovery_document['basePath']
|
150
160
|
return @method_base ||= (
|
151
|
-
self.
|
161
|
+
self.root_uri.join(Addressable::URI.parse(@discovery_document['basePath']))
|
152
162
|
).normalize
|
153
163
|
else
|
154
164
|
return nil
|
@@ -108,7 +108,7 @@ module Google
|
|
108
108
|
# @return [Addressable::Template] The URI template.
|
109
109
|
def uri_template
|
110
110
|
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']))
|
112
112
|
)
|
113
113
|
end
|
114
114
|
|
@@ -41,7 +41,6 @@ module Google
|
|
41
41
|
api.document_base +
|
42
42
|
(schema_name[0..0] != '#' ? '#' + schema_name : schema_name)
|
43
43
|
)
|
44
|
-
# puts schema_uri
|
45
44
|
|
46
45
|
# Due to an oversight, schema IDs may not be URI references.
|
47
46
|
# TODO(bobaman): Remove this whole lambda once this has been resolved.
|
@@ -75,7 +74,6 @@ module Google
|
|
75
74
|
end
|
76
75
|
end
|
77
76
|
schema_data = reformat_references.call(schema_data)
|
78
|
-
# puts schema_data.inspect
|
79
77
|
|
80
78
|
if schema_name
|
81
79
|
api_name_string = ActiveSupport::Inflector.camelize(api.name)
|
@@ -473,6 +473,10 @@ RSpec.describe Google::APIClient do
|
|
473
473
|
).to_env(CLIENT.connection)
|
474
474
|
end).to raise_error(ArgumentError)
|
475
475
|
end
|
476
|
+
|
477
|
+
it 'should correctly determine the service root_uri' do
|
478
|
+
expect(@plus.root_uri.to_s).to eq('https://www.googleapis.com/')
|
479
|
+
end
|
476
480
|
end
|
477
481
|
|
478
482
|
describe 'with the adsense API' do
|
@@ -659,4 +663,46 @@ RSpec.describe Google::APIClient do
|
|
659
663
|
expect(@drive.files.insert.media_upload.max_size).not_to eq(nil)
|
660
664
|
end
|
661
665
|
end
|
666
|
+
|
667
|
+
describe 'with the Pub/Sub API' do
|
668
|
+
before do
|
669
|
+
CLIENT.authorization = nil
|
670
|
+
@pubsub = CLIENT.discovered_api('pubsub', 'v1beta2')
|
671
|
+
end
|
672
|
+
|
673
|
+
it 'should generate requests against the correct URIs' do
|
674
|
+
conn = stub_connection do |stub|
|
675
|
+
stub.get('/v1beta2/projects/12345/topics') do |env|
|
676
|
+
expect(env[:url].host).to eq('pubsub.googleapis.com')
|
677
|
+
[200, {}, '{}']
|
678
|
+
end
|
679
|
+
end
|
680
|
+
request = CLIENT.execute(
|
681
|
+
:api_method => @pubsub.projects.topics.list,
|
682
|
+
:parameters => {'project' => 'projects/12345'},
|
683
|
+
:connection => conn
|
684
|
+
)
|
685
|
+
conn.verify
|
686
|
+
end
|
687
|
+
|
688
|
+
it 'should correctly determine the service root_uri' do
|
689
|
+
expect(@pubsub.root_uri.to_s).to eq('https://pubsub.googleapis.com/')
|
690
|
+
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
|
707
|
+
end
|
662
708
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|