google-apis 0.1.4 → 0.1.5
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.rdoc +5 -0
- data/README.md +4 -3
- data/VERSION +1 -1
- data/lib/google_apis/api/base/instance_methods.rb +10 -5
- data/lib/google_apis/version.rb +1 -1
- 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: b70c01bd4080d80b7f7d7d3784b67fc05f3a7e9e
|
4
|
+
data.tar.gz: 8aa06cf24e59306e651bca149466b2c988f35585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b186f46c062f560695f5aedd2f49b29467f20b5984e590021d63cb642cdbefbf4b362f312b83ca0036dfb8219bd42001e86bb28d8ea6b39cfaaa7aef51acccbf
|
7
|
+
data.tar.gz: b09cded1788098ad944c0e2629d0a1eb6932e00639311895acc31970b710232fe0d15e0b60880c26e9e430138c8e212476c41878df1ef3f028dab7936983423f
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Google APIs CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.5 (April 22, 2015)
|
4
|
+
|
5
|
+
* Also correcting passed params when invoking api#execute
|
6
|
+
* Only applying default parameters which apply to an optionally passed API method
|
7
|
+
|
3
8
|
== Version 0.1.4 (April 21, 2015)
|
4
9
|
|
5
10
|
* Introduced GoogleApis.config
|
data/README.md
CHANGED
@@ -194,6 +194,7 @@ If it isn't already clear, you can specify a global Google API connection and us
|
|
194
194
|
...
|
195
195
|
[6] pry(main)> Google::Storage.objects.list :prefix => "path/to/your/file/awesome.txt"
|
196
196
|
=> {"kind"=>"storage#objects",
|
197
|
+
...
|
197
198
|
```
|
198
199
|
|
199
200
|
### Using the console
|
@@ -204,8 +205,8 @@ Run the following command in your console:
|
|
204
205
|
|
205
206
|
```ruby
|
206
207
|
$ script/console
|
207
|
-
Loading Google APIs development environment (0.1.
|
208
|
-
[1] pry(main)> GoogleApis.connect :email_address => "", :private_key => "/path/to/private/key.p12"
|
208
|
+
Loading Google APIs development environment (0.1.5)
|
209
|
+
[1] pry(main)> GoogleApis.connect :email_address => "lorem@developer.gserviceaccount.com", :private_key => "/path/to/private/key.p12"
|
209
210
|
=> #<GoogleApis::Connection:0x007ff3d356cbf0 [lorem@developer.gserviceaccount.com]>
|
210
211
|
[2] pry(main)> bq = Google::BigQuery.new :project_id => "your_project_id", :dataset_id => "your_dataset_id"
|
211
212
|
=> #<Google::BigQuery:0x007f8c09a05338 v2:[datasets,jobs,projects,tabledata,tables] {projectId:"your_project_id",datasetId:"your_dataset_id"}>
|
@@ -225,7 +226,7 @@ And immediately start instantiating a Google API:
|
|
225
226
|
|
226
227
|
```ruby
|
227
228
|
$ script/console
|
228
|
-
Loading Google APIs development environment (0.1.
|
229
|
+
Loading Google APIs development environment (0.1.5)
|
229
230
|
[1] pry(main)> Google::BigQuery.connection
|
230
231
|
=> #<Google::BigQuery:0x007fa6c9cc3450 v2:[datasets,jobs,projects,tabledata,tables] {projectId:"your_project_id",datasetId:"your_dataset_id"}>
|
231
232
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -11,15 +11,15 @@ module GoogleApis
|
|
11
11
|
@connection = config.empty? ? GoogleApis.connection : GoogleApis::Connection.new(config)
|
12
12
|
raise Error, "Please ensure a Google API connection" unless @connection
|
13
13
|
|
14
|
-
params = GoogleApis.config.merge(params)
|
14
|
+
params = correct_params(GoogleApis.config.merge(params))
|
15
15
|
|
16
16
|
@discovered_api = connection.discover_api self.class.api, self.class.version
|
17
17
|
@default_params = params.select{|k, v| self.class.default_parameters.include?(k)}
|
18
18
|
end
|
19
19
|
|
20
20
|
def execute(api_method, *params)
|
21
|
-
params[0] = (params[0]
|
22
|
-
params[0].reverse_merge!(
|
21
|
+
params[0] = correct_params(params[0])
|
22
|
+
params[0].reverse_merge! default_params(api_method)
|
23
23
|
connection.execute self.class, api_method, *params
|
24
24
|
end
|
25
25
|
|
@@ -41,8 +41,13 @@ module GoogleApis
|
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
def default_params
|
45
|
-
|
44
|
+
def default_params(api_method = nil)
|
45
|
+
parameters = api_method.parameters.collect(&:to_sym) if api_method
|
46
|
+
parameters ? @default_params.slice(*parameters) : @default_params
|
47
|
+
end
|
48
|
+
|
49
|
+
def correct_params(params)
|
50
|
+
params ? params.inject({}){|h, (k, v)| h[k.to_s.gsub(/_(.)/){$1.upcase}.to_sym] = v if v; h} : {}
|
46
51
|
end
|
47
52
|
|
48
53
|
def find(name)
|
data/lib/google_apis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-apis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Engel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|