google-api-client 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ # 0.6.3
2
+
3
+ * Update autoparse to 0.3.3 to fix cases where results aren't correctly parsed.
4
+ * Fix railtie loading for compatibility with rails < 3.0
5
+ * Fix refresh of access token when passing credentials as parameter to execute
6
+ * Fix URI processing in batch requests to allow query parameters
7
+
1
8
  # 0.6.2
2
9
 
3
10
  * Update signet to 0.4.6 to support server side continuation of postmessage
@@ -0,0 +1,32 @@
1
+ # How to become a contributor and submit your own code
2
+
3
+ ## Contributor License Agreements
4
+
5
+ We'd love to accept your sample apps and patches! Before we can take them, we
6
+ have to jump a couple of legal hurdles.
7
+
8
+ Please fill out either the individual or corporate Contributor License Agreement
9
+ (CLA).
10
+
11
+ * If you are an individual writing original source code and you're sure you
12
+ own the intellectual property, then you'll need to sign an [individual CLA]
13
+ (http://code.google.com/legal/individual-cla-v1.0.html).
14
+ * If you work for a company that wants to allow you to contribute your work,
15
+ then you'll need to sign a [corporate CLA]
16
+ (http://code.google.com/legal/corporate-cla-v1.0.html).
17
+
18
+ Follow either of the two links above to access the appropriate CLA and
19
+ instructions for how to sign and return it. Once we receive it, we'll be able to
20
+ accept your pull requests.
21
+
22
+ ## Contributing A Patch
23
+
24
+ 1. Submit an issue describing your proposed change to the repo in question.
25
+ 1. The repo owner will respond to your issue promptly.
26
+ 1. If your proposed change is accepted, and you haven't already done so, sign a
27
+ Contributor License Agreement (see details above).
28
+ 1. Fork the desired repo, develop and test your code changes.
29
+ 1. Ensure that your code is clear and comprehensible.
30
+ 1. Ensure that your code has an appropriate set of unit tests which all pass.
31
+ 1. Submit a pull request.
32
+
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
  gem 'signet', '>= 0.4.5'
6
6
  gem 'addressable', '>= 2.3.2'
7
7
  gem 'uuidtools', '>= 2.1.0'
8
- gem 'autoparse', '>= 0.3.2'
8
+ gem 'autoparse', '>= 0.3.3'
9
9
  gem 'faraday', '~> 0.8.4'
10
10
  gem 'multi_json', '>= 1.0.0'
11
11
  gem 'extlib', '>= 0.9.15'
data/README.md CHANGED
@@ -23,11 +23,6 @@ For normal client usage, this is sufficient:
23
23
 
24
24
  $ sudo gem install google-api-client
25
25
 
26
- The command line interface, the example applications, and the test suite
27
- require additional dependencies. These may be obtained with:
28
-
29
- $ sudo gem install google-api-client --development --force --no-rdoc --no-ri
30
-
31
26
  ## Example Usage
32
27
 
33
28
  # Initialize the client & Google+ API
@@ -16,6 +16,7 @@ require 'webrick'
16
16
  require 'google/api_client/version'
17
17
  require 'google/api_client'
18
18
  require 'google/api_client/auth/installed_app'
19
+ require 'irb'
19
20
 
20
21
  ARGV.unshift('--help') if ARGV.empty?
21
22
 
@@ -30,7 +30,7 @@ require 'google/api_client/result'
30
30
  require 'google/api_client/media'
31
31
  require 'google/api_client/service_account'
32
32
  require 'google/api_client/batch'
33
- require 'google/api_client/railtie' if defined?(Rails)
33
+ require 'google/api_client/railtie' if defined?(Rails::Railtie)
34
34
 
35
35
  module Google
36
36
 
@@ -561,10 +561,10 @@ module Google
561
561
  request.authorization = options[:authorization] || self.authorization unless options[:authenticated] == false
562
562
 
563
563
  result = request.send(connection)
564
- if result.status == 401 && authorization.respond_to?(:refresh_token) && auto_refresh_token
564
+ if result.status == 401 && request.authorization.respond_to?(:refresh_token) && auto_refresh_token
565
565
  begin
566
566
  logger.debug("Attempting refresh of access token & retry of request")
567
- authorization.fetch_access_token!
567
+ request.authorization.fetch_access_token!
568
568
  result = request.send(connection)
569
569
  rescue Signet::AuthorizationError
570
570
  # Ignore since we want the original error
@@ -286,7 +286,7 @@ module Google
286
286
  # the serialized request
287
287
  def serialize_call(call_id, call)
288
288
  method, uri, headers, body = call.to_http_request
289
- request = "#{method.to_s.upcase} #{Addressable::URI.parse(uri).path} HTTP/1.1"
289
+ request = "#{method.to_s.upcase} #{Addressable::URI.parse(uri).request_uri} HTTP/1.1"
290
290
  headers.each do |header, value|
291
291
  request << "\r\n%s: %s" % [header, value]
292
292
  end
@@ -181,14 +181,15 @@ module Google
181
181
  # @return [Array<(Symbol, Addressable::URI, Hash, [#read,#to_str])>]
182
182
  def to_http_request
183
183
  request = (
184
- if self.uri
184
+ if self.api_method
185
+ self.api_method.generate_request(self.parameters, self.body, self.headers)
186
+ elsif self.uri
185
187
  unless self.parameters.empty?
186
188
  self.uri.query = Addressable::URI.form_encode(self.parameters)
187
189
  end
188
190
  [self.http_method, self.uri.to_s, self.headers, self.body]
189
- else
190
- self.api_method.generate_request(self.parameters, self.body, self.headers)
191
191
  end)
192
+ return request
192
193
  end
193
194
 
194
195
  ##
@@ -227,7 +228,7 @@ module Google
227
228
  def to_env(connection)
228
229
  method, uri, headers, body = self.to_http_request
229
230
  http_request = connection.build_request(method) do |req|
230
- req.url(uri)
231
+ req.url(uri.to_s)
231
232
  req.headers.update(headers)
232
233
  req.body = body
233
234
  end
@@ -22,7 +22,7 @@ if !defined?(::Google::APIClient::VERSION)
22
22
  module VERSION
23
23
  MAJOR = 0
24
24
  MINOR = 6
25
- TINY = 2
25
+ TINY = 3
26
26
  STRING = [MAJOR, MINOR, TINY].join('.')
27
27
  end
28
28
  end
@@ -33,6 +33,15 @@ describe Google::APIClient::BatchRequest do
33
33
  end).should raise_error(Google::APIClient::BatchError)
34
34
  end
35
35
 
36
+ it 'should allow query parameters in batch requests' do
37
+ batch = Google::APIClient::BatchRequest.new
38
+ batch.add(:uri => 'https://example.com', :parameters => {
39
+ 'a' => '12345'
40
+ })
41
+ method, uri, headers, body = batch.to_http_request
42
+ body.read.should include("/?a=12345")
43
+ end
44
+
36
45
  describe 'with the discovery API' do
37
46
  before do
38
47
  CLIENT.authorization = nil
@@ -432,8 +432,7 @@ describe Google::APIClient do
432
432
 
433
433
  it 'should generate requests against the correct URIs' do
434
434
  conn = stub_connection do |stub|
435
- stub.get('/plus/v1/people/107807692475771887386/activities/public' +
436
- '?collection=public&userId=107807692475771887386') do |env|
435
+ stub.get('/plus/v1/people/107807692475771887386/activities/public') do |env|
437
436
  end
438
437
  end
439
438
 
@@ -631,9 +630,10 @@ describe Google::APIClient do
631
630
  end
632
631
 
633
632
  it 'should succeed when validating repeated parameters in a correct call' do
633
+ pending("This is caused by Faraday's encoding of query parameters.")
634
634
  conn = stub_connection do |stub|
635
- stub.get('/adsense/v1/reports?dimension%5B%5D=DATE&dimension%5B%5D=PRODUCT_CODE'+
636
- '&endDate=2010-01-01&metric%5B%5D=CLICKS&metric%5B%5D=PAGE_VIEWS&'+
635
+ stub.get('/adsense/v1/reports?dimension=DATE&dimension=PRODUCT_CODE'+
636
+ '&endDate=2010-01-01&metric=CLICKS&metric=PAGE_VIEWS&'+
637
637
  'startDate=2000-01-01') do |env|
638
638
  end
639
639
  end
@@ -27,7 +27,7 @@ namespace :gem do
27
27
  s.add_runtime_dependency('signet', '>= 0.4.4')
28
28
  s.add_runtime_dependency('addressable', '>= 2.3.2')
29
29
  s.add_runtime_dependency('uuidtools', '>= 2.1.0')
30
- s.add_runtime_dependency('autoparse', '>= 0.3.2')
30
+ s.add_runtime_dependency('autoparse', '>= 0.3.3')
31
31
  s.add_runtime_dependency('faraday', '~> 0.8.4')
32
32
  s.add_runtime_dependency('multi_json', '>= 1.0.0')
33
33
  s.add_runtime_dependency('extlib', '>= 0.9.15')
@@ -15,7 +15,7 @@ begin
15
15
  yardoc.options = ['--verbose', '--markup', 'markdown']
16
16
  yardoc.files = [
17
17
  'lib/**/*.rb', 'ext/**/*.c', '-',
18
- 'README.md', 'CHANGELOG.md', 'LICENSE'
18
+ 'README.md', 'CONTRIB.md', 'CHANGELOG.md', 'LICENSE'
19
19
  ]
20
20
  end
21
21
  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.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-18 00:00:00.000000000Z
13
+ date: 2013-03-26 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: signet
17
- requirement: &70363858471620 !ruby/object:Gem::Requirement
17
+ requirement: &70263882810660 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.4.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70363858471620
25
+ version_requirements: *70263882810660
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: addressable
28
- requirement: &70363858470340 !ruby/object:Gem::Requirement
28
+ requirement: &70263882810200 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.3.2
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70363858470340
36
+ version_requirements: *70263882810200
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: uuidtools
39
- requirement: &70363858466240 !ruby/object:Gem::Requirement
39
+ requirement: &70263882809740 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,21 +44,21 @@ dependencies:
44
44
  version: 2.1.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70363858466240
47
+ version_requirements: *70263882809740
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: autoparse
50
- requirement: &70363858464540 !ruby/object:Gem::Requirement
50
+ requirement: &70263882809280 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.3.2
55
+ version: 0.3.3
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70363858464540
58
+ version_requirements: *70263882809280
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: faraday
61
- requirement: &70363858461100 !ruby/object:Gem::Requirement
61
+ requirement: &70263882808820 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.8.4
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70363858461100
69
+ version_requirements: *70263882808820
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: multi_json
72
- requirement: &70363858458560 !ruby/object:Gem::Requirement
72
+ requirement: &70263882808360 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.0.0
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70363858458560
80
+ version_requirements: *70263882808360
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: extlib
83
- requirement: &70363858456260 !ruby/object:Gem::Requirement
83
+ requirement: &70263882807900 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 0.9.15
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *70363858456260
91
+ version_requirements: *70263882807900
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: jwt
94
- requirement: &70363858454900 !ruby/object:Gem::Requirement
94
+ requirement: &70263882807440 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 0.1.5
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *70363858454900
102
+ version_requirements: *70263882807440
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: launchy
105
- requirement: &70363858452680 !ruby/object:Gem::Requirement
105
+ requirement: &70263882806980 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 2.1.1
111
111
  type: :runtime
112
112
  prerelease: false
113
- version_requirements: *70363858452680
113
+ version_requirements: *70263882806980
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: rake
116
- requirement: &70363858450700 !ruby/object:Gem::Requirement
116
+ requirement: &70263882806520 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: 0.9.0
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70363858450700
124
+ version_requirements: *70263882806520
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
- requirement: &70363858449840 !ruby/object:Gem::Requirement
127
+ requirement: &70263882806060 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,7 +132,7 @@ dependencies:
132
132
  version: 2.11.0
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70363858449840
135
+ version_requirements: *70263882806060
136
136
  description: ! 'The Google API Ruby Client makes it trivial to discover and access
137
137
  supported
138
138
 
@@ -147,19 +147,18 @@ extra_rdoc_files:
147
147
  - README.md
148
148
  files:
149
149
  - lib/compat/multi_json.rb
150
- - lib/google/api_client.rb
151
150
  - lib/google/api_client/auth/installed_app.rb
152
151
  - lib/google/api_client/auth/jwt_asserter.rb
153
152
  - lib/google/api_client/auth/key_utils.rb
154
153
  - lib/google/api_client/auth/pkcs12.rb
155
154
  - lib/google/api_client/batch.rb
156
155
  - lib/google/api_client/client_secrets.rb
157
- - lib/google/api_client/discovery.rb
158
156
  - lib/google/api_client/discovery/api.rb
159
157
  - lib/google/api_client/discovery/media.rb
160
158
  - lib/google/api_client/discovery/method.rb
161
159
  - lib/google/api_client/discovery/resource.rb
162
160
  - lib/google/api_client/discovery/schema.rb
161
+ - lib/google/api_client/discovery.rb
163
162
  - lib/google/api_client/environment.rb
164
163
  - lib/google/api_client/errors.rb
165
164
  - lib/google/api_client/logging.rb
@@ -170,6 +169,7 @@ files:
170
169
  - lib/google/api_client/result.rb
171
170
  - lib/google/api_client/service_account.rb
172
171
  - lib/google/api_client/version.rb
172
+ - lib/google/api_client.rb
173
173
  - lib/google/inflection.rb
174
174
  - spec/fixtures/files/privatekey.p12
175
175
  - spec/fixtures/files/sample.txt
@@ -188,10 +188,11 @@ files:
188
188
  - tasks/wiki.rake
189
189
  - tasks/yard.rake
190
190
  - CHANGELOG.md
191
+ - CONTRIB.md
191
192
  - Gemfile
192
193
  - LICENSE
193
- - README.md
194
194
  - Rakefile
195
+ - README.md
195
196
  - bin/google-api
196
197
  homepage: http://code.google.com/p/google-api-ruby-client/
197
198
  licenses: []