gcloud 0.6.1 → 0.6.2

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODE4NzljMmM3NWM4ZTAzNjExY2E2YWEwMWQ5MjY3YzdiZjAwOGJmOQ==
4
+ MDViNDRlOTQwOWM0MzQyM2IwNDJhODBkOWU1NzU3N2MxZjg4M2NiYw==
5
5
  data.tar.gz: !binary |-
6
- MDdlNWYxMjBiMjk1Mjc1ZTNjNjRkZmU0Y2M0NmZiMjVmOWVmODI4NA==
6
+ YmEyNDM2ZTM1N2RmNWM0MzliYzU1NTAwMmYwZDdiYTAzN2M4OTM3OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDRmODU3NjQ0MWIxYjU3NWVlMGU1YTZjMjQ5ZDQ1ZmVlZjQ0ZDUwODVkNjA0
10
- NjcyNGJlMTFkOGVjNmJiZjkwZGMzMzlhNmMzYjI1ZGVlZmE5ZDhmYzU3OGVi
11
- ODBmNDM1ZmEzYjAzNDkwZjBmMzhiYmE2MjZlMjM5MzgyM2MxMmY=
9
+ OWEzOTIyMjBmZjZkZDNkMjcwMjgzOTNmY2I2NzNiN2I0ZGFmYTllNjQyNDQy
10
+ NjY0Yzk4OTRjN2MzZGQyYzEyNWJmMzg4NWZmMDNkZTQxNDJhODU1ZTExZWUx
11
+ YmYyMzVkNTQ5NWZiMTllMDc0Y2IxZWY1Y2RmMmQyOWYzZjc3YWE=
12
12
  data.tar.gz: !binary |-
13
- YWNmNzNiNzBlOTA1NjZjOGIwYzlhYzdiYTg3YTU1MWM4NTVlZjU4MjJkNDU2
14
- YmUwNTdiZWEyMzJhYmNiZTNmNzhhZTdhY2EzMTkyOTU0Y2EyZWQyNWQ0YmUz
15
- OTkwNGJiMGVhZjIzNDY0MmUyOWY0NzI0ZjhkZDBhOGRmZDYzNjU=
13
+ ZGYzNzFlMjMyOWY5YWM2MWYxYmJkN2NmYjE0Yzc3ZWI2ZjRjODI4MGEyZGY1
14
+ OTdjZWQ2MzE3ZDI4YTA5ZTUzNjkxMTUyOGJjMTQ0ZGY5ZDgyOGFhZmJiNWFh
15
+ ZWNmNzgyNjRkNTUyZDg0M2YzNDlhMzA4NmZmOGYyYTI1MzY0NGE=
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Release History
2
2
 
3
+ ### 0.6.2 / 2016-03-02
4
+
5
+ #### Changes
6
+
7
+ * BigQuery
8
+ * Fix error accessing a job's data before the job is complete (yhirano55)
9
+ * Fix undefined local variable in Dataset's access rules (yhirano55)
10
+ * Optionally specify location when creating a Dataset (gramos74)
11
+ * Datastore
12
+ * Fix bug in calculating an Entity's `exclude_from_indexes` (bmclean)
13
+ * Pub/Sub
14
+ * Correctly raise error when accessing a policy without permissions
15
+ * Update policy permissions documentation
16
+
3
17
  ### 0.6.1 / 2015-12-29
4
18
 
5
19
  #### Changes
@@ -355,7 +355,8 @@ module Gcloud
355
355
  "friendlyName" => options[:name],
356
356
  "description" => options[:description],
357
357
  "defaultTableExpirationMs" => options[:expiration],
358
- "access" => options[:access]
358
+ "access" => options[:access],
359
+ "location" => options[:location]
359
360
  }.delete_if { |_, v| v.nil? }
360
361
  end
361
362
 
@@ -93,8 +93,8 @@ module Gcloud
93
93
  # Disabled rubocop because this implementation will not last.
94
94
 
95
95
  def self.format_rows rows, fields
96
- headers = fields.map { |f| f["name"] }
97
- field_types = fields.map { |f| f["type"] }
96
+ headers = Array(fields).map { |f| f["name"] }
97
+ field_types = Array(fields).map { |f| f["type"] }
98
98
 
99
99
  Array(rows).map do |row|
100
100
  values = row["f"].map { |f| f["v"] }
@@ -426,7 +426,7 @@ module Gcloud
426
426
  def validate_special_group value #:nodoc:
427
427
  good_value = GROUPS[value.to_s]
428
428
  return good_value unless good_value.nil?
429
- scope
429
+ value
430
430
  end
431
431
 
432
432
  def validate_view view #:nodoc:
@@ -50,18 +50,14 @@ module Gcloud
50
50
  # The delimiter used between fields in the source data. The default is a
51
51
  # comma (,).
52
52
  def delimiter
53
- val = config["load"]["fieldDelimiter"]
54
- val = "," if val.nil?
55
- val
53
+ config["load"]["fieldDelimiter"] || ","
56
54
  end
57
55
 
58
56
  ##
59
57
  # The number of header rows at the top of a CSV file to skip. The default
60
58
  # value is +0+.
61
59
  def skip_leading_rows
62
- val = config["load"]["skipLeadingRows"]
63
- val = 0 if val.nil?
64
- val
60
+ config["load"]["skipLeadingRows"] || 0
65
61
  end
66
62
 
67
63
  ##
@@ -295,6 +295,9 @@ module Gcloud
295
295
  # data structure of an array of hashes. See {BigQuery Access
296
296
  # Control}[https://cloud.google.com/bigquery/access-control] for more
297
297
  # information. (+Array of Hashes+)
298
+ # +location+::
299
+ # The geographic location where the dataset should reside. Possible
300
+ # values include +EU+ and +US+. The default value is +US+.
298
301
  #
299
302
  # === Returns
300
303
  #
@@ -343,7 +346,7 @@ module Gcloud
343
346
  # end
344
347
  #
345
348
  def create_dataset dataset_id, name: nil, description: nil,
346
- expiration: nil, access: nil
349
+ expiration: nil, access: nil, location: nil
347
350
  if block_given?
348
351
  access_builder = Dataset::Access.new connection.default_access_rules,
349
352
  "projectId" => project
@@ -353,7 +356,7 @@ module Gcloud
353
356
 
354
357
  ensure_connection!
355
358
  options = { name: name, description: description,
356
- expiration: expiration, access: access }
359
+ expiration: expiration, access: access, location: location }
357
360
  resp = connection.insert_dataset dataset_id, options
358
361
  return Dataset.from_gapi(resp.data, connection) if resp.success?
359
362
  fail ApiError.from_response(resp)
@@ -106,8 +106,12 @@ module Gcloud
106
106
  ##
107
107
  # New Data from a response object.
108
108
  def self.from_gapi gapi, connection #:nodoc:
109
- formatted_rows = format_rows gapi["rows"],
110
- gapi["schema"]["fields"]
109
+ if gapi["schema"].nil?
110
+ formatted_rows = []
111
+ else
112
+ formatted_rows = format_rows gapi["rows"],
113
+ gapi["schema"]["fields"]
114
+ end
111
115
 
112
116
  data = new formatted_rows
113
117
  data.gapi = gapi
@@ -314,9 +314,9 @@ module Gcloud
314
314
  def update_exclude_indexes! entity #:nodoc:
315
315
  @_exclude_indexes = {}
316
316
  Array(entity.property).each do |property|
317
- @_exclude_indexes[property.name] = property.value.indexed
317
+ @_exclude_indexes[property.name] = !property.value.indexed
318
318
  unless property.value.list_value.nil?
319
- exclude = Array(property.value.list_value).map(&:indexed)
319
+ exclude = Array(property.value.list_value).map{|v| !v.indexed}
320
320
  @_exclude_indexes[property.name] = exclude
321
321
  end
322
322
  end
@@ -498,6 +498,7 @@ module Gcloud
498
498
  @policy ||= begin
499
499
  ensure_connection!
500
500
  resp = connection.get_subscription_policy name
501
+ fail ApiError.from_response(resp) unless resp.success?
501
502
  policy = resp.data
502
503
  policy = policy.to_hash if policy.respond_to? :to_hash
503
504
  policy
@@ -559,6 +560,15 @@ module Gcloud
559
560
  # (such as +*+ or +storage.*+) are not allowed.
560
561
  # (String or Array of Strings)
561
562
  #
563
+ # The permissions that can be checked on a subscription are:
564
+ #
565
+ # * pubsub.subscriptions.consume
566
+ # * pubsub.subscriptions.get
567
+ # * pubsub.subscriptions.delete
568
+ # * pubsub.subscriptions.update
569
+ # * pubsub.subscriptions.getIamPolicy
570
+ # * pubsub.subscriptions.setIamPolicy
571
+ #
562
572
  # === Returns
563
573
  #
564
574
  # The permissions that have access. (Array of Strings)
@@ -570,10 +580,10 @@ module Gcloud
570
580
  # gcloud = Gcloud.new
571
581
  # pubsub = gcloud.pubsub
572
582
  # sub = pubsub.subscription "my-subscription"
573
- # perms = sub.test_permissions "projects.subscriptions.list",
574
- # "projects.subscriptions.pull"
575
- # perms.include? "projects.subscriptions.list" #=> true
576
- # perms.include? "projects.subscriptions.pull" #=> false
583
+ # perms = sub.test_permissions "pubsub.subscriptions.get",
584
+ # "pubsub.subscriptions.consume"
585
+ # perms.include? "pubsub.subscriptions.get" #=> true
586
+ # perms.include? "pubsub.subscriptions.consume" #=> false
577
587
  #
578
588
  def test_permissions *permissions
579
589
  permissions = Array(permissions).flatten
@@ -395,6 +395,7 @@ module Gcloud
395
395
  @policy ||= begin
396
396
  ensure_connection!
397
397
  resp = connection.get_topic_policy name
398
+ fail ApiError.from_response(resp) unless resp.success?
398
399
  policy = resp.data
399
400
  policy = policy.to_hash if policy.respond_to? :to_hash
400
401
  policy
@@ -456,6 +457,16 @@ module Gcloud
456
457
  # (such as +*+ or +storage.*+) are not allowed.
457
458
  # (String or Array of Strings)
458
459
  #
460
+ # The permissions that can be checked on a topic are:
461
+ #
462
+ # * pubsub.topics.publish
463
+ # * pubsub.topics.attachSubscription
464
+ # * pubsub.topics.get
465
+ # * pubsub.topics.delete
466
+ # * pubsub.topics.update
467
+ # * pubsub.topics.getIamPolicy
468
+ # * pubsub.topics.setIamPolicy
469
+ #
459
470
  # === Returns
460
471
  #
461
472
  # The permissions that have access. (Array of Strings)
@@ -467,10 +478,10 @@ module Gcloud
467
478
  # gcloud = Gcloud.new
468
479
  # pubsub = gcloud.pubsub
469
480
  # topic = pubsub.topic "my-topic"
470
- # perms = topic.test_permissions "projects.topic.list",
471
- # "projects.topic.publish"
472
- # perms.include? "projects.topic.list" #=> true
473
- # perms.include? "projects.topic.publish" #=> false
481
+ # perms = topic.test_permissions "pubsub.topics.get",
482
+ # "pubsub.topics.publish"
483
+ # perms.include? "pubsub.topics.get" #=> true
484
+ # perms.include? "pubsub.topics.publish" #=> false
474
485
  #
475
486
  def test_permissions *permissions
476
487
  permissions = Array(permissions).flatten
@@ -16,5 +16,5 @@
16
16
  #--
17
17
  # Google Cloud Version
18
18
  module Gcloud
19
- VERSION = "0.6.1"
19
+ VERSION = "0.6.2"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Silvano Luciani
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-30 00:00:00.000000000 Z
13
+ date: 2016-03-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: beefcake
@@ -170,16 +170,16 @@ dependencies:
170
170
  name: rubocop
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - ~>
173
+ - - <=
174
174
  - !ruby/object:Gem::Version
175
- version: '0.27'
175
+ version: 0.35.1
176
176
  type: :development
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - ~>
180
+ - - <=
181
181
  - !ruby/object:Gem::Version
182
- version: '0.27'
182
+ version: 0.35.1
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: httpclient
185
185
  requirement: !ruby/object:Gem::Requirement