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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40cf27a2e19679987b6aa02d3419450df91b0cf8
4
- data.tar.gz: c1a8dbb160c470f63784633e8a41516ccb81c51f
3
+ metadata.gz: b70c01bd4080d80b7f7d7d3784b67fc05f3a7e9e
4
+ data.tar.gz: 8aa06cf24e59306e651bca149466b2c988f35585
5
5
  SHA512:
6
- metadata.gz: 9b70082d8f1a07f02c13b26ee88de8314c67862d5370cfdf1b9dabc650c311bc1055251d883d3a6e66fde309a616f7fcacc307daabb0cb5799b39413af0c767a
7
- data.tar.gz: 8019e1af722bdce66e749725a7dbec8a02555e50c1c86891cf5728c6c2b80e728c0b67366d18b745820eb01740a98293c96adabe6cfce92efd2fa4943b764b95
6
+ metadata.gz: b186f46c062f560695f5aedd2f49b29467f20b5984e590021d63cb642cdbefbf4b362f312b83ca0036dfb8219bd42001e86bb28d8ea6b39cfaaa7aef51acccbf
7
+ data.tar.gz: b09cded1788098ad944c0e2629d0a1eb6932e00639311895acc31970b710232fe0d15e0b60880c26e9e430138c8e212476c41878df1ef3f028dab7936983423f
@@ -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.4)
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.4)
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.4
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).inject({}){|h, (k, v)| h[k.to_s.gsub(/_(.)/){$1.upcase}.to_sym] = v if v; h}
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] || {}).symbolize_keys
22
- params[0].reverse_merge!(default_params)
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
- @default_params
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)
@@ -1,7 +1,7 @@
1
1
  module GoogleApis
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 4
4
+ TINY = 5
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
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
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-20 00:00:00.000000000 Z
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