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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef77b9ca9950251544f7a6d1fd8fd9c99183f1be
4
- data.tar.gz: ca8d37c5dba0325c3bf68ae98717fc2d633f59a5
3
+ metadata.gz: d98c9d4c3597c0f77ce1d7b3dcb9b0a6a06a47b4
4
+ data.tar.gz: 9c2be2c71a31ee33b6b73f9ce2d6930dffbccf9f
5
5
  SHA512:
6
- metadata.gz: 92511cbedf49028e4f2c80bf6090686fd666e347ef4d4b55a7eccc857dbc1d06971f3e3be0787f2b0c2625d5ff6de4ffe470d3083834c4648c94568e1d3c3e98
7
- data.tar.gz: d235456f2bbd555734323cfc43b49e1aa1bfa6f4893ce9b2cf45d89dc4178400bdefb660389c46686bf269b5092fcdf0223b1e2983996b56df610459c9ac6f21
6
+ metadata.gz: ee8acbd64242aec823310e25be8a78138d99ddca198e7264375a5411d3dd070ade27bce415bf0d8560eea7d0be40bf92c25375f973433b9a726f8b177d23b0ab
7
+ data.tar.gz: 33300789f9bab5f084f20bccbe0c622b5bc93349d4aeab1e60d5c84744e9e91c8287392dc66ded38288cbdd2bf8b332db291420cce58a831b433aabf9aeec74e
@@ -1,3 +1,7 @@
1
+ # 0.8.6
2
+ * Use discovered 'rootUrl' as base URI for services
3
+ * Respect discovered methods with colons in path
4
+
1
5
  # 0.8.5
2
6
  * Corrects the regression Rails 4 support in the 0.8.4 release.
3
7
 
@@ -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 service
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.document_base.join(Addressable::URI.parse(@discovery_document['basePath']))
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)
@@ -18,7 +18,7 @@ module Google
18
18
  module VERSION
19
19
  MAJOR = 0
20
20
  MINOR = 8
21
- TINY = 5
21
+ TINY = 6
22
22
  PATCH = nil
23
23
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
24
24
  end
@@ -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.5
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-01 00:00:00.000000000 Z
12
+ date: 2015-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable