fog-google 1.11.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +10 -0
  3. data/.github/workflows/ruby.yml +34 -0
  4. data/.github/workflows/stale.yml +23 -0
  5. data/CHANGELOG.md +88 -1
  6. data/README.md +19 -10
  7. data/ci/docker-image/Dockerfile +3 -3
  8. data/fog-google.gemspec +2 -2
  9. data/lib/fog/compute/google/models/address.rb +1 -1
  10. data/lib/fog/compute/google/models/addresses.rb +6 -6
  11. data/lib/fog/compute/google/models/backend_service.rb +1 -1
  12. data/lib/fog/compute/google/models/disk.rb +3 -3
  13. data/lib/fog/compute/google/models/disk_types.rb +2 -2
  14. data/lib/fog/compute/google/models/disks.rb +2 -2
  15. data/lib/fog/compute/google/models/firewall.rb +2 -2
  16. data/lib/fog/compute/google/models/firewalls.rb +1 -1
  17. data/lib/fog/compute/google/models/forwarding_rules.rb +2 -2
  18. data/lib/fog/compute/google/models/global_addresses.rb +1 -1
  19. data/lib/fog/compute/google/models/global_forwarding_rules.rb +1 -1
  20. data/lib/fog/compute/google/models/http_health_check.rb +2 -2
  21. data/lib/fog/compute/google/models/instance_group_managers.rb +2 -2
  22. data/lib/fog/compute/google/models/machine_types.rb +2 -2
  23. data/lib/fog/compute/google/models/operations.rb +3 -3
  24. data/lib/fog/compute/google/models/servers.rb +3 -3
  25. data/lib/fog/compute/google/models/subnetworks.rb +2 -2
  26. data/lib/fog/compute/google/models/target_instances.rb +2 -2
  27. data/lib/fog/compute/google/models/target_pools.rb +2 -2
  28. data/lib/fog/compute/google/models/url_maps.rb +1 -1
  29. data/lib/fog/compute/google/requests/abandon_instances.rb +1 -1
  30. data/lib/fog/compute/google/requests/add_instance_group_instances.rb +3 -3
  31. data/lib/fog/compute/google/requests/add_server_access_config.rb +3 -3
  32. data/lib/fog/compute/google/requests/add_target_pool_health_checks.rb +2 -2
  33. data/lib/fog/compute/google/requests/add_target_pool_instances.rb +2 -2
  34. data/lib/fog/compute/google/requests/attach_disk.rb +1 -1
  35. data/lib/fog/compute/google/requests/create_disk_snapshot.rb +1 -1
  36. data/lib/fog/compute/google/requests/expand_subnetwork_ip_cidr_range.rb +1 -1
  37. data/lib/fog/compute/google/requests/get_backend_service_health.rb +1 -1
  38. data/lib/fog/compute/google/requests/get_server_serial_port_output.rb +2 -2
  39. data/lib/fog/compute/google/requests/get_target_pool_health.rb +1 -1
  40. data/lib/fog/compute/google/requests/insert_address.rb +2 -2
  41. data/lib/fog/compute/google/requests/insert_backend_service.rb +1 -1
  42. data/lib/fog/compute/google/requests/insert_disk.rb +1 -1
  43. data/lib/fog/compute/google/requests/insert_firewall.rb +1 -1
  44. data/lib/fog/compute/google/requests/insert_forwarding_rule.rb +1 -1
  45. data/lib/fog/compute/google/requests/insert_global_address.rb +1 -1
  46. data/lib/fog/compute/google/requests/insert_global_forwarding_rule.rb +1 -1
  47. data/lib/fog/compute/google/requests/insert_http_health_check.rb +1 -1
  48. data/lib/fog/compute/google/requests/insert_image.rb +1 -1
  49. data/lib/fog/compute/google/requests/insert_instance_group.rb +3 -3
  50. data/lib/fog/compute/google/requests/insert_instance_group_manager.rb +7 -7
  51. data/lib/fog/compute/google/requests/insert_instance_template.rb +3 -3
  52. data/lib/fog/compute/google/requests/insert_network.rb +1 -1
  53. data/lib/fog/compute/google/requests/insert_route.rb +10 -10
  54. data/lib/fog/compute/google/requests/insert_server.rb +12 -8
  55. data/lib/fog/compute/google/requests/insert_ssl_certificate.rb +4 -4
  56. data/lib/fog/compute/google/requests/insert_subnetwork.rb +1 -1
  57. data/lib/fog/compute/google/requests/insert_target_http_proxy.rb +3 -3
  58. data/lib/fog/compute/google/requests/insert_target_https_proxy.rb +4 -4
  59. data/lib/fog/compute/google/requests/insert_target_instance.rb +1 -1
  60. data/lib/fog/compute/google/requests/insert_target_pool.rb +1 -1
  61. data/lib/fog/compute/google/requests/insert_url_map.rb +1 -1
  62. data/lib/fog/compute/google/requests/invalidate_url_map_cache.rb +1 -1
  63. data/lib/fog/compute/google/requests/list_addresses.rb +4 -4
  64. data/lib/fog/compute/google/requests/list_aggregated_addresses.rb +1 -1
  65. data/lib/fog/compute/google/requests/list_aggregated_disk_types.rb +2 -2
  66. data/lib/fog/compute/google/requests/list_aggregated_disks.rb +2 -2
  67. data/lib/fog/compute/google/requests/list_aggregated_forwarding_rules.rb +2 -2
  68. data/lib/fog/compute/google/requests/list_aggregated_instance_group_managers.rb +4 -4
  69. data/lib/fog/compute/google/requests/list_aggregated_instance_groups.rb +1 -1
  70. data/lib/fog/compute/google/requests/list_aggregated_machine_types.rb +2 -2
  71. data/lib/fog/compute/google/requests/list_aggregated_servers.rb +2 -2
  72. data/lib/fog/compute/google/requests/list_aggregated_subnetworks.rb +4 -4
  73. data/lib/fog/compute/google/requests/list_aggregated_target_instances.rb +4 -4
  74. data/lib/fog/compute/google/requests/list_aggregated_target_pools.rb +4 -4
  75. data/lib/fog/compute/google/requests/list_disk_types.rb +2 -2
  76. data/lib/fog/compute/google/requests/list_disks.rb +2 -2
  77. data/lib/fog/compute/google/requests/list_firewalls.rb +4 -4
  78. data/lib/fog/compute/google/requests/list_forwarding_rules.rb +2 -2
  79. data/lib/fog/compute/google/requests/list_global_addresses.rb +5 -5
  80. data/lib/fog/compute/google/requests/list_global_forwarding_rules.rb +2 -2
  81. data/lib/fog/compute/google/requests/list_global_operations.rb +4 -4
  82. data/lib/fog/compute/google/requests/list_http_health_checks.rb +2 -2
  83. data/lib/fog/compute/google/requests/list_images.rb +2 -2
  84. data/lib/fog/compute/google/requests/list_instance_group_managers.rb +2 -2
  85. data/lib/fog/compute/google/requests/list_instance_templates.rb +4 -4
  86. data/lib/fog/compute/google/requests/list_machine_types.rb +4 -4
  87. data/lib/fog/compute/google/requests/list_networks.rb +4 -4
  88. data/lib/fog/compute/google/requests/list_subnetworks.rb +4 -4
  89. data/lib/fog/compute/google/requests/list_target_pools.rb +4 -4
  90. data/lib/fog/compute/google/requests/list_url_maps.rb +2 -2
  91. data/lib/fog/compute/google/requests/patch_firewall.rb +1 -1
  92. data/lib/fog/compute/google/requests/remove_instance_group_instances.rb +3 -3
  93. data/lib/fog/compute/google/requests/remove_target_pool_health_checks.rb +2 -2
  94. data/lib/fog/compute/google/requests/remove_target_pool_instance.rb +2 -2
  95. data/lib/fog/compute/google/requests/remove_target_pool_instances.rb +2 -2
  96. data/lib/fog/compute/google/requests/set_common_instance_metadata.rb +2 -2
  97. data/lib/fog/compute/google/requests/set_forwarding_rule_target.rb +1 -1
  98. data/lib/fog/compute/google/requests/set_global_forwarding_rule_target.rb +1 -1
  99. data/lib/fog/compute/google/requests/set_server_metadata.rb +2 -2
  100. data/lib/fog/compute/google/requests/set_server_tags.rb +2 -2
  101. data/lib/fog/compute/google/requests/set_snapshot_labels.rb +2 -2
  102. data/lib/fog/compute/google/requests/set_subnetwork_private_ip_google_access.rb +1 -1
  103. data/lib/fog/compute/google/requests/set_target_http_proxy_url_map.rb +1 -1
  104. data/lib/fog/compute/google/requests/set_target_https_proxy_ssl_certificates.rb +1 -1
  105. data/lib/fog/compute/google/requests/set_target_https_proxy_url_map.rb +1 -1
  106. data/lib/fog/compute/google/requests/set_target_pool_backup.rb +2 -2
  107. data/lib/fog/compute/google/requests/update_firewall.rb +1 -1
  108. data/lib/fog/compute/google/requests/update_http_health_check.rb +1 -1
  109. data/lib/fog/compute/google/requests/update_url_map.rb +1 -1
  110. data/lib/fog/compute/google/requests/validate_url_map.rb +1 -1
  111. data/lib/fog/dns/google/requests/create_change.rb +2 -2
  112. data/lib/fog/google/models/sql/instance.rb +2 -2
  113. data/lib/fog/google/requests/monitoring/create_metric_descriptor.rb +8 -8
  114. data/lib/fog/google/requests/monitoring/create_timeseries.rb +1 -1
  115. data/lib/fog/google/requests/monitoring/list_timeseries.rb +1 -1
  116. data/lib/fog/google/requests/pubsub/acknowledge_subscription.rb +1 -1
  117. data/lib/fog/google/requests/pubsub/create_subscription.rb +3 -3
  118. data/lib/fog/google/requests/sql/clone_instance.rb +4 -4
  119. data/lib/fog/google/requests/sql/delete_user.rb +1 -1
  120. data/lib/fog/google/requests/sql/export_instance.rb +3 -3
  121. data/lib/fog/google/requests/sql/import_instance.rb +2 -2
  122. data/lib/fog/google/requests/sql/insert_backup_run.rb +1 -1
  123. data/lib/fog/google/requests/sql/insert_instance.rb +2 -2
  124. data/lib/fog/google/requests/sql/insert_ssl_cert.rb +1 -1
  125. data/lib/fog/google/requests/sql/insert_user.rb +1 -1
  126. data/lib/fog/google/requests/sql/restore_instance_backup.rb +4 -4
  127. data/lib/fog/google/requests/sql/update_instance.rb +2 -2
  128. data/lib/fog/google/shared.rb +3 -3
  129. data/lib/fog/google/version.rb +1 -1
  130. data/lib/fog/storage/google_json/models/directories.rb +1 -1
  131. data/lib/fog/storage/google_json/models/directory.rb +1 -1
  132. data/lib/fog/storage/google_json/models/file.rb +1 -1
  133. data/lib/fog/storage/google_json/models/files.rb +1 -1
  134. data/lib/fog/storage/google_json/requests/copy_object.rb +12 -1
  135. data/lib/fog/storage/google_json/requests/get_object.rb +6 -3
  136. data/lib/fog/storage/google_json/requests/list_buckets.rb +4 -4
  137. data/lib/fog/storage/google_json/requests/list_objects.rb +1 -1
  138. data/lib/fog/storage/google_json/requests/put_bucket.rb +1 -1
  139. data/lib/fog/storage/google_json/requests/put_bucket_acl.rb +1 -1
  140. data/lib/fog/storage/google_json/requests/put_object.rb +1 -1
  141. data/lib/fog/storage/google_json/requests/put_object_acl.rb +1 -1
  142. data/lib/fog/storage/google_json/utils.rb +5 -1
  143. data/lib/fog/storage/google_xml/models/file.rb +2 -2
  144. data/tasks/changelog.rake +5 -3
  145. data/test/integration/monitoring/test_metric_descriptors.rb +1 -1
  146. data/test/integration/storage/storage_shared.rb +7 -2
  147. data/test/integration/storage/test_objects.rb +39 -1
  148. data/test/unit/storage/test_common_xml_collections.rb +11 -0
  149. data/test/unit/storage/test_json_requests.rb +8 -0
  150. metadata +14 -13
  151. data/.travis.yml +0 -16
@@ -39,7 +39,7 @@ module Fog
39
39
  end
40
40
  end
41
41
 
42
- @monitoring.list_project_time_series("projects/#{@project}", options)
42
+ @monitoring.list_project_time_series("projects/#{@project}", **options)
43
43
  end
44
44
  end
45
45
 
@@ -12,7 +12,7 @@ module Fog
12
12
  ack_ids = [ack_ids]
13
13
  end
14
14
  ack_request = ::Google::Apis::PubsubV1::AcknowledgeRequest.new(
15
- :ack_ids => ack_ids
15
+ ack_ids: ack_ids
16
16
  )
17
17
 
18
18
  @pubsub.acknowledge_subscription(subscription, ack_request)
@@ -18,9 +18,9 @@ module Fog
18
18
  # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/create
19
19
  def create_subscription(subscription_name, topic, push_config = {}, ack_deadline_seconds = nil)
20
20
  subscription = ::Google::Apis::PubsubV1::Subscription.new(
21
- :topic => topic,
22
- :ack_deadline_seconds => ack_deadline_seconds,
23
- :push_config => push_config
21
+ topic: topic,
22
+ ack_deadline_seconds: ack_deadline_seconds,
23
+ push_config: push_config
24
24
  )
25
25
 
26
26
  @pubsub.create_subscription(subscription_name, subscription)
@@ -15,14 +15,14 @@ module Fog
15
15
 
16
16
  unless log_filename.nil? || log_position.nil?
17
17
  context[:bin_log_coordinates] = ::Google::Apis::SqladminV1beta4::BinLogCoordinates.new(
18
- :kind => "sql#binLogCoordinates",
19
- :log_filename => log_filename,
20
- :log_position => log_position
18
+ kind: "sql#binLogCoordinates",
19
+ log_filename: log_filename,
20
+ log_position: log_position
21
21
  )
22
22
  end
23
23
 
24
24
  clone_request = ::Google::Apis::SqladminV1beta4::CloneInstancesRequest.new(
25
- :clone_context => ::Google::Apis::SqladminV1beta4::CloneContext.new(context)
25
+ clone_context: ::Google::Apis::SqladminV1beta4::CloneContext.new(**context)
26
26
  )
27
27
 
28
28
  @sql.clone_instance(@project, instance_id, clone_request)
@@ -8,7 +8,7 @@ module Fog
8
8
 
9
9
  class Real
10
10
  def delete_user(instance_id, host, name)
11
- @sql.delete_user(@project, instance_id, host, name)
11
+ @sql.delete_user(@project, instance_id, host: host, name: name)
12
12
  end
13
13
  end
14
14
 
@@ -24,12 +24,12 @@ module Fog
24
24
 
25
25
  unless csv_export_options.empty?
26
26
  data[:csv_export_options] =
27
- ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(csv_export_options)
27
+ ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(**csv_export_options)
28
28
  end
29
29
 
30
30
  unless sql_export_options.nil?
31
31
  data[:sql_export_options] =
32
- ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(sql_export_options)
32
+ ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(**sql_export_options)
33
33
  end
34
34
 
35
35
  export_context = ::Google::Apis::SqladminV1beta4::ExportContext.new(export_context)
@@ -37,7 +37,7 @@ module Fog
37
37
  @project,
38
38
  instance_id,
39
39
  ::Google::Apis::SqladminV1beta4::ExportInstancesRequest.new(
40
- :export_context => export_context
40
+ export_context: export_context
41
41
  )
42
42
  )
43
43
  end
@@ -19,14 +19,14 @@ module Fog
19
19
  data[:import_user] = import_user unless import_user.nil?
20
20
  unless csv_import_options.nil?
21
21
  data[:csv_import_options] =
22
- ::Google::Apis::SqladminV1beta4::ImportContext::CsvImportOptions.new(csv_import_options)
22
+ ::Google::Apis::SqladminV1beta4::ImportContext::CsvImportOptions.new(**csv_import_options)
23
23
  end
24
24
 
25
25
  @sql.import_instance(
26
26
  @project,
27
27
  instance_id,
28
28
  ::Google::Apis::SqladminV1beta4::ImportInstancesRequest.new(
29
- :import_context => ::Google::Apis::SqladminV1beta4::ImportContext.new(data)
29
+ import_context: ::Google::Apis::SqladminV1beta4::ImportContext.new(**data)
30
30
  )
31
31
  )
32
32
  end
@@ -11,7 +11,7 @@ module Fog
11
11
  @sql.insert_backup_run(
12
12
  @project,
13
13
  instance_id,
14
- ::Google::Apis::SqladminV1beta4::BackupRun.new(backup_run)
14
+ ::Google::Apis::SqladminV1beta4::BackupRun.new(**backup_run)
15
15
  )
16
16
  end
17
17
  end
@@ -8,9 +8,9 @@ module Fog
8
8
 
9
9
  class Real
10
10
  def insert_instance(name, tier, options = {})
11
- instance = ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(options)
11
+ instance = ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(**options)
12
12
  instance.name = name
13
- instance.settings = ::Google::Apis::SqladminV1beta4::Settings.new(instance.settings || {})
13
+ instance.settings = ::Google::Apis::SqladminV1beta4::Settings.new(**instance.settings || {})
14
14
  instance.settings.tier = tier
15
15
  @sql.insert_instance(@project, instance)
16
16
  end
@@ -12,7 +12,7 @@ module Fog
12
12
  @project,
13
13
  instance_id,
14
14
  ::Google::Apis::SqladminV1beta4::InsertSslCertsRequest.new(
15
- :common_name => common_name
15
+ common_name: common_name
16
16
  )
17
17
  )
18
18
  end
@@ -9,7 +9,7 @@ module Fog
9
9
  class Real
10
10
  def insert_user(instance_id, user)
11
11
  @sql.insert_user(@project, instance_id,
12
- ::Google::Apis::SqladminV1beta4::User.new(user))
12
+ ::Google::Apis::SqladminV1beta4::User.new(**user))
13
13
  end
14
14
  end
15
15
 
@@ -9,10 +9,10 @@ module Fog
9
9
  class Real
10
10
  def restore_instance_backup(instance_id, backup_run_id)
11
11
  request = ::Google::Apis::SqladminV1beta4::RestoreInstancesBackupRequest.new(
12
- :restore_backup_context => ::Google::Apis::SqladminV1beta4::RestoreBackupContext.new(
13
- :backup_run_id => backup_run_id,
14
- :instance_id => instance_id,
15
- :kind => "sql#restoreBackupContext"
12
+ restore_backup_context: ::Google::Apis::SqladminV1beta4::RestoreBackupContext.new(
13
+ backup_run_id: backup_run_id,
14
+ instance_id: instance_id,
15
+ kind: "sql#restoreBackupContext"
16
16
  )
17
17
  )
18
18
  @sql.restore_instance_backup(@project, instance_id, request)
@@ -7,14 +7,14 @@ module Fog
7
7
  # @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/update
8
8
  class Real
9
9
  def update_instance(instance_id, settings_version, tier, settings = {})
10
- settings = ::Google::Apis::SqladminV1beta4::Settings.new(settings)
10
+ settings = ::Google::Apis::SqladminV1beta4::Settings.new(**settings)
11
11
  settings.tier = tier
12
12
  settings.settings_version = settings_version
13
13
 
14
14
  @sql.update_instance(
15
15
  @project,
16
16
  instance_id,
17
- ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(:settings => settings)
17
+ ::Google::Apis::SqladminV1beta4::DatabaseInstance.new(settings: settings)
18
18
  )
19
19
  end
20
20
  end
@@ -87,10 +87,10 @@ module Fog
87
87
  # Applies given options to the client instance
88
88
  #
89
89
  # @param [Google::Apis::Core::BaseService] service API service client instance
90
- # @param [Hash] google_client_options Service client options to apply
91
- # @param [Hash] _ignored Rest of the options (for convenience, ignored)
90
+ # @param [Hash] options (all ignored a.t.m., except :google_client_options)
92
91
  # @return [void]
93
- def apply_client_options(service, google_client_options: nil, **_ignored)
92
+ def apply_client_options(service, options = {})
93
+ google_client_options = options[:google_client_options]
94
94
  return if google_client_options.nil? || google_client_options.empty?
95
95
  (service.client_options.members & google_client_options.keys).each do |option|
96
96
  service.client_options[option] = google_client_options[option]
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Google
3
- VERSION = "1.11.0".freeze
3
+ VERSION = "1.15.0".freeze
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ module Fog
5
5
  model Fog::Storage::GoogleJSON::Directory
6
6
 
7
7
  def all(opts = {})
8
- data = service.list_buckets(opts).to_h[:items] || []
8
+ data = service.list_buckets(**opts).to_h[:items] || []
9
9
  load(data)
10
10
  end
11
11
 
@@ -52,7 +52,7 @@ module Fog
52
52
 
53
53
  def save
54
54
  requires :key
55
- service.put_bucket(key, attributes)
55
+ service.put_bucket(key, **attributes)
56
56
  true
57
57
  end
58
58
  end
@@ -105,7 +105,7 @@ module Fog
105
105
 
106
106
  options[:predefined_acl] ||= @predefined_acl
107
107
 
108
- service.put_object(directory.key, key, body, options)
108
+ service.put_object(directory.key, key, body, **options)
109
109
  self.content_length = Fog::Storage.get_body_size(body)
110
110
  self.content_type ||= Fog::Storage.get_content_type(body)
111
111
  true
@@ -33,7 +33,7 @@ module Fog
33
33
 
34
34
  def get(key, options = {}, &block)
35
35
  requires :directory
36
- data = service.get_object(directory.key, key, options, &block).to_h
36
+ data = service.get_object(directory.key, key, **options, &block).to_h
37
37
  new(data)
38
38
  rescue ::Google::Apis::ClientError => e
39
39
  raise e unless e.status_code == 404
@@ -14,9 +14,20 @@ module Fog
14
14
  def copy_object(source_bucket, source_object,
15
15
  target_bucket, target_object, options = {})
16
16
  request_options = ::Google::Apis::RequestOptions.default.merge(options)
17
+
18
+ object = ::Google::Apis::StorageV1::Object.new(**options)
19
+
17
20
  @storage_json.copy_object(source_bucket, source_object,
18
21
  target_bucket, target_object,
19
- request_options)
22
+ object, options: request_options, **filter_keyword_args(options))
23
+ end
24
+
25
+ private
26
+
27
+ def filter_keyword_args(options)
28
+ method = @storage_json.method(:copy_object)
29
+ allowed = method.parameters.filter { |param| %i(key keyreq).include?(param[0]) }.map { |param| param[1] }.compact
30
+ options.filter { |key, _| allowed.include?(key) }
20
31
  end
21
32
  end
22
33
 
@@ -39,6 +39,8 @@ module Fog
39
39
  raise ArgumentError.new("object_name is required") unless object_name
40
40
 
41
41
  buf = Tempfile.new("fog-google-storage-temp")
42
+ buf.binmode
43
+ buf.unlink
42
44
 
43
45
  # Two requests are necessary, first for metadata, then for content.
44
46
  # google-api-ruby-client doesn't allow fetching both metadata and content
@@ -53,18 +55,19 @@ module Fog
53
55
  :options => request_options
54
56
  }
55
57
 
56
- object = @storage_json.get_object(bucket_name, object_name, all_opts).to_h
58
+ object = @storage_json.get_object(bucket_name, object_name, **all_opts).to_h
57
59
  @storage_json.get_object(
58
60
  bucket_name,
59
61
  object_name,
60
- all_opts.merge(:download_dest => buf.path)
62
+ **all_opts.merge(:download_dest => buf)
61
63
  )
62
64
 
65
+ buf.seek(0)
66
+
63
67
  if block_given?
64
68
  yield buf.read, nil, nil
65
69
  else
66
70
  object[:body] = buf.read
67
- buf.unlink
68
71
  end
69
72
 
70
73
  object
@@ -11,10 +11,10 @@ module Fog
11
11
  prefix: nil, projection: nil)
12
12
  @storage_json.list_buckets(
13
13
  @project,
14
- :max_results => max_results,
15
- :page_token => page_token,
16
- :prefix => prefix,
17
- :projection => projection
14
+ max_results: max_results,
15
+ page_token: page_token,
16
+ prefix: prefix,
17
+ projection: projection
18
18
  )
19
19
  end
20
20
  end
@@ -31,7 +31,7 @@ module Fog
31
31
 
32
32
  @storage_json.list_objects(
33
33
  bucket,
34
- options.select { |k, _| allowed_opts.include? k }
34
+ **options.select { |k, _| allowed_opts.include? k }
35
35
  )
36
36
  end
37
37
  end
@@ -19,7 +19,7 @@ module Fog
19
19
  predefined_default_object_acl: nil,
20
20
  **options)
21
21
  bucket = ::Google::Apis::StorageV1::Bucket.new(
22
- options.merge(:name => bucket_name)
22
+ **options.merge(:name => bucket_name)
23
23
  )
24
24
 
25
25
  @storage_json.insert_bucket(
@@ -12,7 +12,7 @@ module Fog
12
12
  raise ArgumentError.new("bucket_name is required") unless bucket_name
13
13
  raise ArgumentError.new("acl is required") unless acl
14
14
 
15
- acl_update = ::Google::Apis::StorageV1::BucketAccessControl.new(acl)
15
+ acl_update = ::Google::Apis::StorageV1::BucketAccessControl.new(**acl)
16
16
  @storage_json.insert_bucket_access_control(bucket_name, acl_update)
17
17
  end
18
18
  end
@@ -51,7 +51,7 @@ module Fog
51
51
  data, options = normalize_data(data, options)
52
52
 
53
53
  object_config = ::Google::Apis::StorageV1::Object.new(
54
- options.merge(:name => object_name)
54
+ **options.merge(:name => object_name)
55
55
  )
56
56
 
57
57
  @storage_json.insert_object(
@@ -15,7 +15,7 @@ module Fog
15
15
  raise ArgumentError.new("object_name is required") unless object_name
16
16
  raise ArgumentError.new("acl is required") unless acl
17
17
 
18
- acl_object = ::Google::Apis::StorageV1::ObjectAccessControl.new(acl)
18
+ acl_object = ::Google::Apis::StorageV1::ObjectAccessControl.new(**acl)
19
19
 
20
20
  @storage_json.insert_object_access_control(
21
21
  bucket_name, object_name, acl_object
@@ -19,7 +19,11 @@ module Fog
19
19
 
20
20
  def host_path_query(params, expires)
21
21
  params[:headers]["Date"] = expires.to_i
22
- params[:path] = URI.encode(params[:path]).gsub("%2F", "/")
22
+ # implementation from CGI.escape, but without ' ' to '+' conversion
23
+ params[:path] = params[:path].b.gsub(/([^a-zA-Z0-9_.\-~]+)/) { |m|
24
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
25
+ }.gsub("%2F", "/")
26
+
23
27
  query = []
24
28
 
25
29
  if params[:query]
@@ -51,7 +51,7 @@ module Fog
51
51
 
52
52
  remove_method :metadata
53
53
  def metadata
54
- attributes.reject { |key, _value| key.to_s =~ /^x-goog-meta-/ }
54
+ attributes.select { |key, _value| key.to_s =~ /^x-goog-meta-/ }
55
55
  end
56
56
 
57
57
  remove_method :metadata=
@@ -109,7 +109,7 @@ module Fog
109
109
  options["Expires"] = expires if expires
110
110
  options.merge!(metadata)
111
111
 
112
- data = service.put_object(directory.key, key, body, options)
112
+ data = service.put_object(directory.key, key, body, **options)
113
113
  merge_attributes(data.headers.reject { |key, _value| ["Content-Length", "Content-Type"].include?(key) })
114
114
  self.content_length = Fog::Storage.get_body_size(body)
115
115
  self.content_type ||= Fog::Storage.get_content_type(body)
data/tasks/changelog.rake CHANGED
@@ -25,13 +25,15 @@ end
25
25
 
26
26
  # Extracts all github users contributed since last tag
27
27
  def users_since_last_tag
28
- `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%s" | cut -d' ' -f 6 | cut -d/ -f1 | uniq`
28
+ `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%s" | cut -d' ' -f 6 | cut -d/ -f1 | sort | uniq`
29
29
  end
30
30
 
31
31
  namespace :changelog do
32
32
  task :generate do
33
33
  insert_after_line("CHANGELOG.md", changes_since_last_tag, /^## Next/)
34
- printf("Users contributed since last release:\n")
35
- printf(users_since_last_tag)
34
+ contributors = users_since_last_tag.split("\n").map { |name| "@" + name }
35
+ printf("Huge thanks to all our contributors 🎆\n")
36
+ printf("Special thanks to: " + contributors.join(" ") + "\n")
37
+ printf("\nI'll merge this and release the gem once all tests pass.\n")
36
38
  end
37
39
  end
@@ -68,7 +68,7 @@ class TestMetricDescriptors < FogIntegrationTest
68
68
  :labels => [label]
69
69
  }
70
70
 
71
- created = @client.create_metric_descriptor(options)
71
+ created = @client.create_metric_descriptor(**options)
72
72
 
73
73
  # Check created metric descriptor
74
74
  assert_equal(_full_name(metric_type), created.name)
@@ -86,9 +86,14 @@ class StorageShared < FogIntegrationTest
86
86
  "hello world"
87
87
  end
88
88
 
89
- def some_temp_file
89
+ def binary_file_content
90
+ "PK\x03\x04\x14\x00\x00\x00\b\x00\x18\x89\x8AM\xE7!\xB7\x1C\x1C\x15j\x00\xB4\xB9".force_encoding(Encoding::ASCII_8BIT)
91
+ end
92
+
93
+ def some_temp_file(content = temp_file_content)
90
94
  @some_temp_file ||= Tempfile.new("fog-google-storage").tap do |t|
91
- t.write(temp_file_content)
95
+ t.binmode
96
+ t.write(content)
92
97
  t.close
93
98
  end
94
99
  File.open(@some_temp_file.path, "r")